问题列表 - 第49369页

在OpenGL中使用QImage

我最近选择了Qt并且正在将它与OpenGL一起使用但事情是,当我将SDL代码移动到Qt并更改纹理代码以使用QImage时它停止工作.

图像确实正确加载,如错误检查代码所示.

谢谢!

PS:请不要建议我使用glDrawPixels,我需要解决手头的问题.其中一些原因是1.慢2. android(这个代码可能最终运行)是OpenGL ES并且不支持glDrawPixels

这是代码:

//original image
QImage img;
if(!img.load(":/star.png"))
{
    //loads correctly
    qWarning("ERROR LOADING IMAGE");
}

//array for holding texture ID
GLuint texture[1];

//get the OpenGL-friendly image
QImage GL_formatted_image;
GL_formatted_image = QGLWidget::convertToGLFormat(img);

//make sure its not null
if(GL_formatted_image.isNull())
    qWarning("IMAGE IS NULL");
else
    qWarning("IMAGE NOT NULL");

//generate the texture name
glGenTextures(1, texture);

//bind the texture ID
glBindTexture(GL_TEXTURE_2D, texture[0]);

//generate the texture
glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, GL_formatted_image.width(),
              GL_formatted_image.height(),
              0, GL_RGBA, GL_UNSIGNED_BYTE, GL_formatted_image.bits() );

//texture parameters
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR …
Run Code Online (Sandbox Code Playgroud)

qt textures opengl-es qimage

9
推荐指数
2
解决办法
2万
查看次数

如何在php中检查请求是来自移动设备还是计算机

我需要检查请求是来自手机设备或台式电脑使用PHP请帮助.谢谢

php mobile

13
推荐指数
3
解决办法
3万
查看次数

Apache LOG:子pid xxxx退出信号分段错误(11)

Apache + PHP + Mysql + Linux

[注意]儿童pid 23145退出信号分段故障(11),可能coredump在/ tmp

但在/ tmp下找不到任何东西

我怎样才能找到错误?

php linux apache

4
推荐指数
1
解决办法
2万
查看次数

声音结束时的通话功能

在Javascript中,我有这样的代码:

var sound = new Audio(name);
sound.onended = function () {
  alert("finished");
  }
sound.play();
Run Code Online (Sandbox Code Playgroud)

也就是说,在sound.play方法完成之后,我想提醒它已经完成了.这适用于IE9,但有没有办法在Chrome中执行此操作?

我也尝试过类似下面代码的回调,但它不起作用

sound.play(function () {alert("finished")});
Run Code Online (Sandbox Code Playgroud)

javascript jquery html5 google-chrome javascript-events

5
推荐指数
1
解决办法
1067
查看次数

如何在cygwin中执行shell脚本?

name.sh已保存在C:\ Documents and Settings\user中,我输入sh name.sh

sh:testing.sh:没有这样的文件或目录

任何帮助将不胜感激!

windows shell cygwin

8
推荐指数
1
解决办法
2万
查看次数

Google Test可以测试C代码吗?

所以我喜欢和喜欢使用Google Test来参与我参与的C++项目.我只是提出一个新的项目,它将是直接的C(一个库),到目前为止看不出任何理由即使它是一个C++框架,也不要继续使用Google Test.拥有C++编译器不会成为问题.

我不应该使用Google Test测试直接C代码的具体原因吗?

谢谢.

c googletest

62
推荐指数
5
解决办法
3万
查看次数

如何使用PHP发送电子邮件?

我在网站上使用PHP,我想添加电子邮件功能.

我安装了WAMPSERVER.

如何使用PHP发送电子邮件?

php email wamp wampserver

296
推荐指数
12
解决办法
92万
查看次数

为多个表中的数据创建摘要行

我正在尝试编写SQL查询以生成给定时间段内给定用户执行的操作的摘要行.我有以下相关的表结构:

用户

  • ID
  • 球队

audit_periods(可以处理,运输,休息等)

  • 用户身份
  • period_type(可以是"处理","运送"等 - 目前尚未规范化)
  • started_at
  • finished_at(对于当前时期可以为null,因此逻辑在下面的时间)

audit_tasks

  • audit_period_id
  • audit_task_type_id
  • created_at
  • 得分了

audit_task_types

  • 名称("扫描","place_in_pallet"等)
  • 得分(似乎多余,但我们需要保持audit_task在执行时收到的分数,因为audit_task_type分数可以在以后更改)

ER图

对于给定时期内的每个用户,我想创建类似以下数据行的内容:

users.id users.email time_spent_processing time_spent_shipping ... number_of_scans number_of_pallets

这将通过计算每个用户来计算:

  • audit_periods至少部分落在期望的窗口中?(使用started_at和finished_at.)
  • 用户在每种audit_period中花费了多长时间?(应该通过audit_periods.period_type参与分组,我想.)
  • audit_tasks属于所需窗口的范围?(使用created_at - 不在下面的代码中.)
  • 用户在窗口期间完成了每种类型的audit_task中有多少个?(加入audit_task_type,可能涉及audit_task_types.name上的一个组.)
  • 在这段时间内赚了多少积分?(汇总窗口中所有audit_tasks的分数.)

我已经筋疲力尽了所有我知道的SQL技巧(并不多),并提出了类似以下的内容:

select 
    u.id as user_id,
    u.email as email,
    u.team as team,
    ap.period_type as period_type,
    att.name,
    time_to_sec(
      timediff(least("2011-03-17 00:00:00", ifnull(ap.finished_at, utc_timestamp())), greatest("2011-03-16 00:00:00", ap.started_at))
    ) as period_duration,
    sum(at.score) as period_score
  from audit_periods as ap
  inner join users as u on ap.user_id = u.id
  left join audit_tasks …
Run Code Online (Sandbox Code Playgroud)

mysql sql

9
推荐指数
1
解决办法
1585
查看次数

Yii找到条件> =

我需要找到summ> = 250的行

我正在做以下事情:

$criteria = new CDbCriteria;  
$criteria->condition ='summ >= 250';
$winnerBid = Bids::model()->find($criteria);
Run Code Online (Sandbox Code Playgroud)

但我没有得到任何结果.如何实施?

php mysql activerecord yii

5
推荐指数
1
解决办法
3万
查看次数

使用Apache POI在Excel单元格中写入数字

如何在poi的帮助下在单元格中写出我的全部价值?

即如果值是1000.000,那么如何在不"#"之后截断000的情况下写出这个完整的值.与POI?意味着我想要全部价值.

在我的情况下,它只需要1000,但这对我来说不是正确的格式.

java excel apache-poi

23
推荐指数
1
解决办法
6万
查看次数