LWJGL Forum
Programming => OpenGL => Topic started by: baegsi on November 23, 2004, 14:23:48
-
Hi,
I need to create selectable 2D objects in OpenGL, like GUI Buttons. What would be a good way to do this in terms of performance? Do you typically use the selection feature in OpenGL (glRenderMode(GL_SELECT)) or do you have your own mechanism like boundary checking? I'm not sure what would be best because in order to use the selection mode it is necessary to render at least parts of the scene twice, so maybe there's a better/faster way?
regards,
bernhard[/i]
-
Custom boundary checking for sure. Stay away from GL_SELECT. It's not too complicated at all (code-wise), but may take some time, depending on your UI needs of course.
-
I am ok with the boundary stuff, standard 2D stuff... what gets me is the passing of the mouse data to the components. My thought was to keep an arraylist of all "mouseable" components and loop through it each loop.
Is this the norm or is there another way to make a cusomt 2d component "wake-up" or react to nouse entry into its boundaries?
-
Just loop through them all every frame.
Cas :)
-
Sounds like a winner. I guess set a few flags, keep track of the currently focused item/component...then loop de loo
Shouldnt have but a HUD (with a small handfull of mouse areas), and the occasional floating panel/window or compnents on an entirely different screen.
thanks!