<pre lang="c++">
#define CALLBACK __stdcall
void loadGLTextures() { QImage t; QImage b; if ( !b.load( ":/images/nehe.bmp" ) ) { //b = QImage( 16, 16, 32 ); //original //b.fill( Qt::green.rgb() ); //original QMessageBox::information(this, "Error", "Could not load file"); QImage b(16, 16, QImage::Format_RGB32); //******* b.fill(Qt::green); //************* } t = QGLWidget::convertToGLFormat( b ); if(t.isNull()) { QMessageBox::information(this, "Error", "IMAGE IS NULL"); } glGenTextures( 1, texture );// Create The Texture glBindTexture( GL_TEXTURE_2D, texture[0] ); //assign a texture name to texture data. glTexImage2D( GL_TEXTURE_2D, 0, 3, t.width(), t.height(), 0, GL_RGBA, GL_UNSIGNED_BYTE, t.bits() ); //Linear Filtering glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR ); glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR ); }
if ( !b.load( ":/images/nehe.bmp" ) )
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)