Hi,
I am currently attempting to code an RTS game. I have alot of stuff in place already, like camera’s, etc. but I’m having a hard time with object selection. I have it set up so I can click on an object with the mouse cursor and it will report a hit, using the name stack and gluPickMatrix(). That isn’t where I’m having the difficulty. My problem is this: I’ve got it so when the mouse button gets pressed and stays pressed it draws a bounding rectangle in screen coordinates(like any RTS). I’m just not sure how I can select objects with this dynamic sized screen rect. Any suggestions as to how I might do this?
Hmm, I’m not sure how to do that.
The screen rect is being drawn with four line functions, one for each side of the selection rect:
Line(x0, y0, x1, y1); etc…
but I’m not sure how I pass that to gluPickMatrix()… Will I need more than one call to gluPickMatrix() to set up the drawn rect to be a selection rect?
PARAMETERS
x, y Specify the center of a picking region in window coordinates.
delX, delY
Specify the width and height, respectively, of the picking region in window coordinates.
viewport
Specifies the current viewport (as from a glGetIntegerv call).