Hello Guest

Mouse interaction: selection mode or custom implementation?

  • 4 Replies
  • 6133 Views
Mouse interaction: selection mode or custom implementation?
« 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]

*

Offline spasi

  • *****
  • 2042
    • WebHotelier
Mouse interaction: selection mode or custom implementation?
« Reply #1 on: November 23, 2004, 14:37:38 »
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.

question on implementation..
« Reply #2 on: December 13, 2004, 20:57:36 »
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?
M

*

Offline princec

  • *****
  • 1898
    • Puppygames
Mouse interaction: selection mode or custom implementation?
« Reply #3 on: December 13, 2004, 21:06:22 »
Just loop through them all every frame.

Cas :)

okie dohkie
« Reply #4 on: December 13, 2004, 21:28:18 »
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!
M