extracting pixels coordinates.


I am a french student and I’m doing an intenship, in which I’m using an open source video game based on OpenGL.

My problem is that I want to know from the OpenGL coordinates of an object what are its coordinates in pixels.

The subject of my internship is not programming in OpenGL, however I searched a lot in the OpenGL library without success.

Hoping someone could help me :slight_smile: .

P.S.: sorry for my english

To map object coordinates to window coordinates you can use gluProject.

Thank you for your help, and sorry to respond you so late (I was having a break). I’ll try to use gluProject.

Thanks a lot.

Hi, I was wondering if the gluProject is the function I’m searching for, because it returns three coordinates Winx Winy and Winz, but I’m waiting for 2D coordinates?

Thanks again for your help.

(WinX, WinY) are your screen coordinates in pixels. WinZ is the fragment depth which is in the depth range (specified by glDepthRange, default one is [0,1]). This value is the depth stored in the depth buffer.

Ok, thanks a lot for your quick answers :slight_smile: .