PDA

View Full Version : Picking (selection)



darren
04-15-2003, 03:20 PM
Why would glRenderMode(GL_RENDER) be returning -1 hit values (an error value).

I am setting up an appropriatly large buffer, glRenderMode(GL_SELECT), drawing my vertacies, hits = glRenderMode(GL_RENDER).

Everything works fine, most of the time. Though I occationaly get a seg. fault with my hit processing 'cause glRenderMode is giving me -1 hits. :-(

Help Pls,
-darren

Relic
04-16-2003, 01:47 AM
glRenderMode error return code is 0 not -1.
Read the glSelectBuffer docs for an explanation of the -1 return value.
In brief: -1 means you had a buffer overflow in your selection buffer.
Means not all hits fit into your buffer and (watch out!) you may need to parse only til the last-but-one entry, because the last entry may only contain a partial result if the buffer length modulo entry length is not zero.
So you were wrong with the "appropriately large buffer" assumption and if you crash on -1 return values, it's your fault. http://www.opengl.org/discussion_boards/ubb/wink.gif

[This message has been edited by Relic (edited 04-16-2003).]

darren
04-16-2003, 07:56 AM
You are absolutly correct Relic.
My buffer was too small, and had shotty (no) error checking. All better now.
Thx.