Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enabling GL_LIGHTING with freeglut+opengl2 makes the ui components black #1996

Closed
EldarZ opened this issue Aug 2, 2018 · 6 comments
Closed

Comments

@EldarZ
Copy link

EldarZ commented Aug 2, 2018

Version/Branch of Dear ImGui:
1.63 WIP

Back-end file/Renderer/OS:
Nvidia 1060
Back-ends: imgui_impl_freeglut.cpp + imgui_impl_opengl2.cpp
OS: Win10
Compiler: VS2017

My Issue/Question:
I'm running the freeglut + opengl2 example, I used it to integrate imgui to my existing project, written in opengl 1.1 (unfortunately this version is required), whenever I enable GL_LIGHTING the ui components turn to black, I googled this issue + searched this repository's issues, but got nothing.
To my understanding this is because there's no glMaterial definition to the ui component, but I'm not sure how to fix it.

Is this a known issue with opengl? I have't seen any lighting related code in imgui to maybe override it.
Standalone, minimal, complete and verifiable example:

//anywhere in the freeglut + opengl2 example code
glEnable(GL_LIGHTING);

Screenshots/Video
capture

@EldarZ EldarZ changed the title enabling GL_LIGHTING with freeglut make the ui components black enabling GL_LIGHTING with freeglut+opengl2 makes the ui components black Aug 2, 2018
@EldarZ EldarZ changed the title enabling GL_LIGHTING with freeglut+opengl2 makes the ui components black Enabling GL_LIGHTING with freeglut+opengl2 makes the ui components black Aug 2, 2018
@ocornut
Copy link
Owner

ocornut commented Aug 2, 2018 via email

@EldarZ
Copy link
Author

EldarZ commented Aug 2, 2018

my project requires lighting, how do I exclude imgui ui components from the global glEnable(GL_LIGHTING) state in freeglut + legacy opengl?

@jarikomppa
Copy link

jarikomppa commented Aug 2, 2018 via email

@EldarZ
Copy link
Author

EldarZ commented Aug 2, 2018

right... I just wrapped ImGui_ImplOpenGL2_RenderDrawData(ImGui::GetDrawData()); with disable and enable lighting, sorry about the newbie question. Thanks!!

@EldarZ EldarZ closed this as completed Aug 2, 2018
ocornut added a commit that referenced this issue Aug 3, 2018
…IAL to increase compatibility with legacy OpenGL applications. (#1996)
@ocornut
Copy link
Owner

ocornut commented Aug 3, 2018

No worry @EldarZ . As it turns out, our rendering back-end aim to explicitly enable/disable all the OpenGL states they needs, then restoring the changes when it finish rendering. It's just tricky to do it exhaustively for OpenGL. So few people actually use those legacy OpenGL features and you are the first person to report something with GL_LIGHTING conflicting so imgui_impl_opengl2.cpp didn't explicitly disable it.

I've know pushed a change to disable GL_LIGHTING and GL_COLOR_MATERIAL so it should work even if you don't disable it on your end.

@EldarZ
Copy link
Author

EldarZ commented Aug 5, 2018

@ocornut great!, awesome library! 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants