im having this really wierd problem where my hits are show in the selection buffer at times and at times they dont show. i still havent come across the pattern when this happens, but this is unusual.
shtHits = 0
glGetIntegerv glgViewport, viewport(0)
glSelectBuffer shtBUFSIZE, intSelectbuffer(0)
glRenderMode (GL_SELECT)
glInitNames
glPushName 0 'intializing the name stack
'setting the same geomety as for normal view
glMatrixMode (GL_PROJECTION)
glPushMatrix 'saving the original matrix
glLoadIdentity
gluPickMatrix dblX, viewport(3) - dblY, dblXDist, dblYDist, viewport(0)
'set Camera view, the same for picking as for viewing
gluPerspective msngFieldOfView, msngAspectRatio, mdblNearField, mdblFarField
glMatrixMode (GL_MODELVIEW)
glPushMatrix
my translations and rotations
draw all shapes
…
glPopMatrix
glFlush
shtHits = glRenderMode(GL_RENDER) 'hits = objects in hit
glPopMatrix 'restoring the original matrix
If shtHits > 0 Then
lngNameNum = 0
dblDist = 4294967295#
For intI = 0 To shtHits - 1
'find nearest
If (intSelectbuffer((intI) * 4 + 1) < dblDist) Then
dblDist = intSelectbuffer((intI) * 4 + 1)
lngNameNum = intSelectbuffer((intI) * 4 + 3)
End If
Next intI
End If
instead of renderin the whole scene everytime, i have a screen shot thatz rendered in a 2d othro mode. will that make any difference on selection. i think it wont cause the values in the selection buffer are generated when the same DLs are called when rendering mode is GL_SELECT.
[This message has been edited by mithun_daa (edited 02-10-2004).]