void GLView::initializeGL() { GLenum err; if ( scene->options & Scene::DoMultisampling ) { if ( !glContext->hasExtension( "GL_EXT_framebuffer_multisample" ) ) { scene->options &= ~Scene::DoMultisampling; //qDebug() << "System does not support multisampling"; } /* else { GLint maxSamples; glGetIntegerv( GL_MAX_SAMPLES, &maxSamples ); qDebug() << "Max samples:" << maxSamples; }*/ } initializeTextureUnits( glContext ); if ( scene->renderer->initialize() ) updateShaders(); // Initial viewport values // Made viewport and aspect member variables. // They were being updated every single frame instead of only when resizing. //glGetIntegerv( GL_VIEWPORT, viewport ); aspect = (GLdouble)width() / (GLdouble)height(); // Check for errors while ( ( err = glGetError() ) != GL_NO_ERROR ) qDebug() << tr( "glview.cpp - GL ERROR (init) : " ) << (const char *)gluErrorString( err ); }
void UVWidget::initializeGL() { glMatrixMode( GL_MODELVIEW ); initializeTextureUnits( context() ); glShadeModel( GL_SMOOTH ); glShadeModel( GL_LINE_SMOOTH ); glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA ); glEnable( GL_BLEND ); glDepthFunc( GL_LEQUAL ); glEnable( GL_DEPTH_TEST ); glEnable( GL_MULTISAMPLE ); glDisable( GL_LIGHTING ); qglClearColor( Options::bgColor() ); if( !texfile.isEmpty() ) bindTexture( texfile ); else bindTexture( texsource ); glEnableClientState( GL_VERTEX_ARRAY ); glVertexPointer( 2, GL_SHORT, 0, vertArray ); glEnableClientState( GL_TEXTURE_COORD_ARRAY ); glTexCoordPointer( 2, GL_SHORT, 0, texArray ); // check for errors GLenum err; while ( ( err = glGetError() ) != GL_NO_ERROR ) { qDebug() << "GL ERROR (init) : " << (const char *) gluErrorString( err ); } }