QT/OpenGL: Textur Problem
Verfasst: 3. März 2008 17:43
dies hier funktioniert prima. Ich rufe ein Pixel-array auf und speicher es via QImage und QPixmap als png und rufe es als Textur auf.
dies hier stürzt ab: Ich übergebe das Pixelarray via QImage
glTexImage2D( GL_TEXTURE_2D, 0, 3, tex.width(), tex.height(), 0, GL_RGBA, GL_UNSIGNED_BYTE, tex.bits() );[/code]
es zerlegt das programm mit einem segfault bei
OpenGL mag also scheinbar nicht das Format? Oder irre ich? Wie löse ich das Problem
Code: Alles auswählen
buf.load( "temp.png" )
tex= QGLWidget::convertToGLFormat( buffer );
glTexImage2D( GL_TEXTURE_2D, 0, 3, tex.width(), tex.height(), 0, GL_RGBA, GL_UNSIGNED_BYTE, tex.bits() );Code: Alles auswählen
QImage myImage(width ,height,QImage::Format_ARGB32);
for(int i = 0; i < width; i++){
for(int j = 0; j < height; j++)
{
uint convVal = ((uint) image->data[(j*width + i)*2]);
value = qRgb(convVal, convVal, convVal);
myImage.setPixel(i,j,value);
}
}
[code] tex = QGLWidget::convertToGLFormat(myImage);es zerlegt das programm mit einem segfault bei
Code: Alles auswählen
tex = QGLWidget::convertToGLFormat(myImage);