Clicking Objects in the gamewindow

In all games your able to click on NPC’s, Items, Players etc to either bring up a window or to pick up a something off the ground or to even attack. How is this done with OpenGL?

I believe this is typically done without using any OpenGL. Most games probably cast a ray based on the position of the mouse on the screen and do an intersection test against the bounding volumes of pickable objects in the game. Did you need per-pixel picking accuracy?

not really, sure I am just trying to figure out how this type of thing is done. I would like to move on from text based games to something more visual. An that type of thing comes with it

Maybe you want to check out one of the following cross-platform libraries that are used to handle windows.
SDL at
wxWidgets at

OpenGL by itself does not provide any functionality for this purpose.

Opengl is for display objects to the user. The best method for this is to have a scenegraph, that contains all the geometry of the objects you are displaying. Then when the user clicks on the screen, get the near and far points to create a ray, of which you project through your objects in memory, and test if it intersects with any of them.

Hope this helps