Sign in to follow this  
FooLeo

glSelectBuffer and glOrtho?

Recommended Posts

FooLeo    100
So basically I'm having problems with glSelectBuffer once I have called glOrtho.

I am trying to make a minimap for my game, so I am trying to draw it using glOrtho (right now I am just drawing one rectangle where it should be). I had selection code that worked just fine until added my draw map function. I was trying to debug it and noticed that my selectbuffer array acts very odd.

Is it not possible to use glSelectBuffer and glOrtho at the same time? That would suck...

If you need the code to check it out just ask.




So it seems to be adding a blank hit to the beginning of my selectbuffer array, as in it says that there are 0 names on the stack, and it gives the minZ and maxZ, then it starts with the TRUE hits (althought if i click on the minimap rectangle it won't show up in the array).

**

Ahh sorry, so right for some reason it gets an empty hit on the select buffer, but i've been able to fix my selection method to work with that (i wasn't checking if names on stack were 0), but now I need to know how to use selection with glOrtho/2d things?

What can I use to find if and where on the minimap I am clicking? Or any 2d object for that matter.

[Edited by - FooLeo on October 10, 2010 9:59:46 PM]

Share this post


Link to post
Share on other sites
swiftcoder    18439
Quote:
Original post by FooLeo
What can I use to find if and where on the minimap I am clicking? Or any 2d object for that matter.
If the minimap is a 2D HUD element (as they often are), then any sort of picking is overkill.

Just manually check the mouse coordinates against the bounds of the minimap to ensure that the user is actually clicking on the minimap, and then you already have the point at which they clicked from the original mouse coordinates.

Share this post


Link to post
Share on other sites
FooLeo    100
So since I'm going to have other HUD elements, should i just create like a vector of HUD elements, and every time I click, search through the vector and check if I'm within the bounds of each element?

I mean I'll probably do it this way unless somebody suggests a better way to do it.

Share this post


Link to post
Share on other sites
othello    100
Sure, that sounds good. This probably isn't a bottleneck area so it shouldn't be necessary to optimize it too much (but you should probably use a stl list instead of a vector if you're going to be adding or removing elements often).

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this