I'm currently working on getting DevIL to work with loading textures. Now I know that some people will not like DevIL, and I'm up for hearing any better approaches, but this is what I'm using right now.
Now my issue is that upon calling ilutInit() glGetError will return GL_INVALID_ENUM. This seems strange to me, and it's only set by the call. Now is this a known issue and I should ignore it? I should mention that ilGetError return no problems.
Here's my initialization code:
//
// Check for a valid context
//
if( context == NULL )
{
assert( context && "Need a valid context" );
return;
}
//
// Create our temp context
//
HGLRC tempGLContext = NULL;
#if WIN32
tempGLContext = wglCreateContext( context );
//
// Check for a valid temp context
//
if( tempGLContext == NULL )
{
assert( "Failed to create a temp context" && tempGLContext );
return;
}
//
// Attempt to make the context current
//
if( wglMakeCurrent( context, tempGLContext ) == false )
{
assert( "Failed to make the temp context current" && 0 );
}
CheckGLCall();
//
// Now we need to initialize GLEW
//
GLenum result = glewInit();
assert( "Failed to initialize GLEW" && result == GLEW_OK );
assert( wglewIsSupported("WGL_ARB_create_context") == 1 );
//
// Next we setup our attrib array, this determines the context we want
//
int attribs[] =
{
WGL_CONTEXT_MAJOR_VERSION_ARB, 3, // Set our major version
WGL_CONTEXT_MINOR_VERSION_ARB, 1, // Set our minor version
WGL_CONTEXT_FLAGS_ARB, // Use ARB functions
WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB, // We want forward compatability. Good performance gains
0 // Zero indicates the end of the array
};
//
// Attempt to create our context
//
mhGLRenderContext = wglCreateContextAttribsARB( context, 0, attribs );
CheckGLCall();
if( mhGLRenderContext == NULL )
{
assert( "Failed to create our desired context" && mhGLRenderContext );
return;
}
//
// Clear the active context
//
if( wglMakeCurrent( NULL, NULL ) == false )
{
assert( "Failed to clear context current" && 0 );
return;
}
//
// Delete the previous temp context
//
if( wglDeleteContext( tempGLContext ) == false )
{
assert( "Failed to delete the temporary context" && 0 );
return;
}
//
// Set our current context
//
if( wglMakeCurrent( context, mhGLRenderContext ) == false )
{
assert( "Failed to make our desired context current" && 0 );
return;
}
CheckGLCall();
if ( ilGetInteger(IL_VERSION_NUM) < IL_VERSION ||
iluGetInteger(ILU_VERSION_NUM) < ILU_VERSION ||
ilutGetInteger(ILUT_VERSION_NUM) < ILUT_VERSION )
{
assert( "DevIL versions don't match, aborting!" && 0 );
return;
}
ilInit();
iluInit();
ilutInit();
ilutRenderer( ILUT_OPENGL );
CheckGLCall();
Now if anyone has a better choice then DevIL for texture loading, let me know






