Jump to content
  • Advertisement
Sign in to follow this  
sunrisefe

OpenGL question on select model

This topic is 3932 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

i am a newer to opengl,thanks for your reply. is the following array selectBuf is the names stack? when we use glPushName()or glLoadName() ,how the names stack and the array selectBuf change? thank you very much. ***************************************** GLuint selectBuf[BUFSIZE]; glSelectBuffer (BUFSIZE, selectBuf); ******************************************

Share this post


Link to post
Share on other sites
Advertisement
Yes any primitives rendered in the viewport with a name attached generate a hit.

The selection buffer is then a list of such hits with the following structure:

hitcount[32] minz[32] maxz[32] name0 name1 ... name[hitcount]

if hitcount is 0, the selection buffer looks like
0 minz maxz

you can have several names for a hit with hierarchical picking (multiple glPushname)
e.g. 2 minz maxz objectname detailofobect

This is a gut tutor:
http://web.engr.oregonstate.edu/~mjb/cs553/Handouts/Picking/picking.pdf

Share this post


Link to post
Share on other sites
thank bene81 very much.

i still have a problem:
selection buffer is the array appointed in the func glSelectBuffer (BUFSIZE, selectBuf)?

Share this post


Link to post
Share on other sites
Right,

and check out
Glu.gluPickMatrix(...);

and disable many stuff you dont need for picking,
like

Gl.glDisable(Gl.GL_BLEND);
Gl.glDisable(Gl.GL_DITHER);
Gl.glDisable(Gl.GL_FOG);
Gl.glDisable(Gl.GL_LIGHTING);
Gl.glDisable(Gl.GL_TEXTURE_1D);
Gl.glDisable(Gl.GL_TEXTURE_2D);
Gl.glDisable(Gl.GL_TEXTURE_3D);
Gl.glDisable(Gl.GL_RESCALE_NORMAL);
Gl.glShadeModel(Gl.GL_FLAT);

You can use push/pop attribs to restore.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!