[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    Redux: QGLWidget::convertToGLFormat
From:       "Troy Corbin Jr." <t_corbin () charter ! net>
Date:       2002-02-24 1:58:57
[Download RAW message or body]

Hello,

I'm trying to use a QImage as a texture for an OpenGL poly. I see in the
doc API where the above static method will convert it into an OpenGL
friendly format, but just what is that format?

Or, to be more specific, how should I call glTexImage2D? Here's my snip of
code:

GLenum format;
QImage tempImage = QGLWidget::convertToGLFormat( someImage );
if( tempImage.hasAlphaBuffer() ) format = GL_RGBA;
else format = GL_RGB;
glPixelStorei( GL_UNPACK_ALIGNMENT, 4 );
glPixelStorei( GL_PACK_ALIGNMENT, 4 );
glGenTextures( 1, (GLuint*)&textureList[numTextures] );
glBindTexture( GL_TEXTURE_2D, textureList[numTextures] );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT );
glTexParameteri( GL_TEXTURE_2D,
GL_TEXTURE_MAG_FILTER,SET_TextureFilterMag); glTexParameteri(
GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,SET_TextureFilterMin);
glTexImage2D(GL_TEXTURE_2D,0,format,tempImage.width(),tempImage.height(),0,
format,GL_UNSIGNED_BYTE,tempImage.bits());

Thanks for any help you can provide.
-- 
Troy Corbin Jr.
tcorbin@users.sourceforge.net
http://knights.sourceforge.net
 
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic