Im using OpenGL with c++ to make a game. and right now, im wondering how i would be able to turn 3D coordinates into 2D positions for example: drawing a 2D health bar over a 3D model’s head, or something along those lines. xD
so anyways, im wondering how i would be able to set this up where it can be used in SFML. right now im looking up some information but i dont completely understand the methods…
Basicaly, im asking how would i make 3D opengl coordinates convert to 2D coordinates onto the screen using SFML
im also wondering how i would convert 2D coordinates back to 3D, just so i know that too.
also some example code would be nice, just so i get a better picture
thanks for reading
-Molma
Since you’re using OpenGL, I’d suggest
gluProjectfor mapping from 3D to 2D andgluUnProjectfor mapping from 2D to 3D (note @ChrisF’s comment on unprojecting).Though I gotta admit, I got no real experience with OpenGL, I just know the terminology for what you wanted and googled for it. 🙂