Archived

This topic is now archived and is closed to further replies.

Crispy

glLoadName() vs glPushName()

Recommended Posts

Hi, I''ve just implemented my own raycasting mechanism with the help of the www.gametutorials.com tut which explains that the use of glPushName()/glPopName() is discouraged due to problems with portability between different cards. On the other hand I can''t get glLoadName() working. Furthermore, the code in the tut seems kinda strange:
  
//////////////////////////////////////////////

//courtesy of DigiBen, www.gametutorials.com//

//////////////////////////////////////////////


glBindTexture(GL_TEXTURE_2D, g_Texture[0]);	
glLoadName(SUN);					
glBegin(GL_LINES);
glEnd();

glPushMatrix();					
 glTranslatef(0, 0, 0);					
 glRotatef(SunRotation, 0, 1.0, 0);			
 gluSphere(pObj, 0.5f, 20, 20);			
glPopMatrix();						

glEnd();	
//comments were removed

  
Notice a missing glBegin()... Anyhow - this method is not working on my TNT2 although my implementation is pretty much the same. Can anyone give a comment on the glPush/PopName() functions (how bad they perform on different cards, etc) and whether I should avoid them for the sake of gamespeed (also hinted in the abovementioned tutorial)? Thanks, Crispy

Share this post


Link to post
Share on other sites
quote:
Original post by miles vignol
I think a loadname on an empty name stack produces an error. push one on there first, then load all you want...



You''re right. I pushed zero on the stack though ( glPushName(0); ) before calling glLoadName();

Crispy

Share this post


Link to post
Share on other sites
You are ending the lines right after you start, before you even draw them. If that end is supposed to be closing something else, stick it before the glbegin.

Share this post


Link to post
Share on other sites