flyx / OpenGLAda

Thick Ada binding for OpenGL and GLFW
flyx.github.io/OpenGLAda/
MIT License
96 stars 13 forks source link

Lighting functions fail. #78

Closed rogermc2 closed 7 years ago

rogermc2 commented 7 years ago

I can't get the following lighting functions to work:

if GL.Toggles.State (GL.Toggles.Lighting) = GL.Toggles.Enabled then
      GL.Toggles.Disable (GL.Toggles.Lighting);
end if; 
GL.Toggles.Enable (GL.Toggles.Lighting);

They fail with:

raised GL.ERRORS.INTERNAL_ERROR : gl-raise_exception_on_opengl_error.adb:30

The following from Mac OpenGL.Frameworks gl3.h seem OK? GLAPI void APIENTRY glDisable (GLenum cap); GLAPI void APIENTRY glEnable (GLenum cap); From Mac OpenGL.Frameworks gl.h:

define GL_LIGHTING_BIT 0x00000040

/ Enable / / GL_FOG / / GL_LIGHTING /

define GL_LIGHTING 0x0B50

flyx commented 7 years ago

The lighting API has been deprecated with OpenGL 3. You need to create an OpenGL 2 context in order to use that API, I guess.

rogermc2 commented 7 years ago

OK, thanks. I'll look into OpenGL 3 lighting aspects which I currently know nothing about. The code I am trying to implement is probably OpenGL 2, so not only C++ to Ada but also OpenGL 2 to 3.