[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] converting "object position" to "view position" in (py)opengl



Thanks for that. How do I convert x,y,z to the x,y coordinates of a pygame surface window? Kinda like the coordinates that pygame.mouse.get_pos() returns?
Thanks again

Ian Mallett wrote:
You'll definitely want to use glu somewhere.  gluLookAt(...) comes to mind...

Anyway, for gluProject, try this (not tested, but should work)

x,y,z = gluProject(object.x,object.y,object.z,\
glGetDoublev(GL_MODELVIEW_MATRIX),glGetDoublev(GL_PROJECTION_MATRIX),\
glGetIntegerv(GL_VIEWPORT))


HTH,
Ian