What do you mean "after the matrices are set"? is it when I'm doing an
"initgl" like this: glShadeModel(GL_SMOOTH) glClearColor(0.0, 0.0, 0.0, 0.0) glClearDepth(1.0) glEnable(GL_DEPTH_TEST) glDepthFunc(GL_LEQUAL) glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST) glEnable(GL_COLOR_MATERIAL) glEnable(GL_TEXTURE_2D) or when the window resize is being called: def resize(self,(width, height)): if height==0: height=1 glViewport(0, 0, width, height) glMatrixMode(GL_PROJECTION) glLoadIdentity() gluPerspective(45, 1.0*width/height, 1.0, 10000.0) glMatrixMode(GL_MODELVIEW) glLoadIdentity() also, you lost me at your last sentence...I have no idea what that means but I'll google around. thanks again Forrest Voight wrote: When are you doing the gluProject? It should be after the matrices are set for the frame. Can you paste the code for that? To billboard text, you'd render it to a texture. Something like: surface = self.font.render(s, True, (255, 255, 255)) gluBuild2DMipmaps(GL_TEXTURE_2D, GL_RGBA, surface.get_width(), surface.get_height(), GL_RGBA, GL_UNSIGNED_BYTE, pygame.image.tostring(surface, "RGBA", True) Then, when rendering, transform the modelview matrix as in that link, and draw a quad with the correct aspect ratio. On Wed, Jul 1, 2009 at 10:58 PM, Astan Chee<astan.chee@xxxxxxxxx> wrote:Thanks for that, but it doesn't seem to work. Well, it gives coordinates of x,y(,z) but when the camera changes angle (but not position), the coordinates don't change. What else do I need to be doing in this? Anyway, I also forgot to mention this is how I make the text images: def __init__(self): pygame.font.init() self.font = pygame.font.Font(FONT,18) self.char = [] for c in range(256): self.char.append(self.CreateCharacter(chr(c))) self.char = tuple(self.char) def CreateCharacter(self,s): try: letter_render = self.font.render(s,1,(255,255,255), (0,0,0)) letter = pygame.image.tostring(letter_render,'RGBA',1) letter_w,letter_h = letter_render.get_size() except: letter = None letter_w = letter_h= 0 return (letter,letter_w,letter_h) Since I make the text this way, I'm thinking of just doing it billboard but I'm not sure how to implement half of this. Thanks again for any help. Cheers Astan Ian Mallett wrote: Er, the last three arguments return the data in C. In Python, the syntax is different: C: gluProject(objx,objy,objz,model,proj,view,winx,winy,winz) Python: winx,winy,winz = gluProject(objx,objy,objz,model,proj) And yes, it returns a z-coord, which should take into account the near clipping plane. As long as the plane is ~0, (x,y) should be fairly accurate. Keep in mind that the (x,y) coordinates are *real* coordinates, (i.e., the y is not flipped). (0,0) is the bottom left. If you rasterize the font as you were, it shouldn't be a problem. Ian |