-
Sack TVLikes 0Problem Description
I’m trying to make a GUI in my OpenGL project, that obviously is allways in front of everything. Im now doing this by disabling the depthtest before i render GUI elements and then i activate it again, so my code looks like this:
glDepthFunc(GL_NOTEQUAL);
//Draw GUI elements
glDepthFunc(GL_LESS);
But how can i use screen coordinates to draw my elements, so that i can detect if they were clicked?
-
Sonar Systems adminLikes 0
What are you using for the GUI?
-
Sack TVLikes 0
SDL2
-
Sonar Systems adminLikes 0
I would recommend using this https://forums.libsdl.org/viewtopic.php?p=51910
-
Sack TVLikes 0
You probably didn't understand what i want to do. I want to make a GUI in OpenGL. I just need to know how to switch the coordinate system to screen-coordinates, so that i can check with SDL if the location on the screen was clicked.
-
Sack TVLikes 0
You don't understand, I don’t want to use SDL for my GUI, I want to draw OpenGL stuff with screen coordinates.
Is there something like the glm::perspective for screen coordinates. So that OpenGL doesn't draw with 3D room coordinates.
-
Sonar Systems adminLikes 0
This will explain everything https://learnopengl.com/Getting-started/Coordinate-Systems
Login to reply