Picking (selection)

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. :frowning:

Help Pls,
-darren

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.

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

You are absolutly correct Relic.
My buffer was too small, and had shotty (no) error checking. All better now.
Thx.