Jump to content
  • Advertisement
Sign in to follow this  
szalejot

Why glEnable(GL_LIGHTING) is raising GL_INVALID_ENUM?

This topic is 2591 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi,

I'm using samples from http://www.g-truc.ne...-0415.html#menu to learn instancing - I need it in my academic project. I'm most interested in ogl-330-draw-instanced-arrays sample. I tried to add lightning to it (for learning and practice purpose). But when I added glEnable(GL_LIGHTING); and only that in intialization I've got GL_INVALID_ENUM from glGetError()
Parts of sample code:
int main(int argc, char* argv[])
{
if(glf::run(
argc, argv,
glm::ivec2(::SAMPLE_SIZE_WIDTH, ::SAMPLE_SIZE_HEIGHT),
::SAMPLE_MAJOR_VERSION,
::SAMPLE_MINOR_VERSION))
return 0;
return 1;
}

inline bool run
(
int argc, char* argv[],
glm::ivec2 const & Size,
int Major, int Minor
)
{
glutInitWindowSize(Size.x, Size.y);
glutInitWindowPosition(64, 64);
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_DEPTH | GLUT_MULTISAMPLE);

int WindowHandle = glutCreateWindow(argv[0]);
#if !defined(__APPLE__)
glewInit();
#endif//__APPLE__
glutDestroyWindow(WindowHandle);

#if !defined(__APPLE__)
glutInitContextVersion(Major, Minor);
if(glf::version(Major, Minor) >= 320)
{
#if defined(WIN32)
glutInitContextProfile(GLUT_CORE_PROFILE); // GLUT_COMPATIBILITY_PROFILE
#else
glutInitContextProfile(GLUT_COMPATIBILITY_PROFILE); // GLUT_COMPATIBILITY_PROFILE
#endif
glutInitContextFlags(GLUT_FORWARD_COMPATIBLE | GLUT_DEBUG);
}
#endif//__APPLE__

glutCreateWindow(argv[0]);
init();

if(begin())
{
glutDisplayFunc(display);
glutReshapeFunc(glf::reshape);
glutMouseFunc(glf::mouse);
glutMotionFunc(glf::motion);
glutKeyboardFunc(glf::keyboard);
glutIdleFunc(glf::idle);
#if !defined(__APPLE__)
glutCloseFunc(glf::close);
glutSetOption(GLUT_ACTION_ON_WINDOW_CLOSE, GLUT_ACTION_CONTINUE_EXECUTION);
#endif//__APPLE__
glutMainLoop();

return 0;
}

return 1;
}




I'm using Windows 7 (to let you know what will application in idef's do)

Share this post


Link to post
Share on other sites
Advertisement
Perhaps you are using a core profile (glutInitContextProfile(GLUT_CORE_PROFILE))
and that means the old GL stuff is dead and gone. GL_LIGHTINGis not valid for glEnable so it raises that error.

I suggest you use glutInitContextProfile(GLUT_COMPATIBILITY_PROFILE) or just create a GL 2.1 context.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!