🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Keeping a 2d image at the same position on the screen in a 3d game.

Started by
0 comments, last by Keith P Parsons 24 years ago
I''m writing a 3d game using opengl and I''m having trouble keeping a 2d bitmap such a player score at the same positon on the screen as the camera changes positon. Does any one know how I should go about doing this? or where I could find and example of some code that changes the 3d perspective with out affecting 2d game information on the screen? Help me! Please!
Advertisement
Switch to orto projection when rendering 2d.

glOrtho(0, 640, 480, 0, -2, 2);

this would make:

0, 0 --------------- 640, 0

SCREEN

480, 0 ------------- 640, 480

glVertex2i( 0, 0 ) .....



void glOrtho(
GLdouble left,
GLdouble right,
GLdouble bottom,
GLdouble top,
GLdouble near,
GLdouble far
);

Parameters

- left, right
The coordinates for the left and right vertical clipping planes.

- bottom, top
The coordinates for the bottom and top horizontal clipping planes.

- near, far
The distances to the nearer and farther depth clipping planes. These distances are negative if the plane is to be behind the viewer.
Ries

This topic is closed to new replies.

Advertisement