• Announcements

Archived

This topic is now archived and is closed to further replies.

Simple positioning question

Recommended Posts

moogle33    122
Hello everybody, How do I put a point at a standard windows co-ordinate in a window i.e 0,0 at the top left and 1028*768 at the bottom right. Hope that makes sense. James

Share on other sites
Guest Anonymous Poster
quote:
Hope that makes sense.

Err, not really. Do you mean you want to make a window full size (size of the screen)? You want to plot a pixel on the screen? I assume you are developing on a Windows machine? What API are you using (GDI, DirectDraw, etc)?

Share on other sites
Enigma    1410
Assuming I''m understanding you correctly you need to set your projection matrix to an orthographic projection:
glMatrixMode(GL_PROJECTION);glLoadIdentity();glOrtho(0, 1024, 0, 768, -1, 1);glMatrixMode(GL_MODELVIEW);

Enigma

Share on other sites
tgraupmann    112
You forget to do the final offset as shown below. Otherwise the pixels will be slightly off.

glViewport(0, 0, g_rRect.right, g_rRect.bottom);
glMatrixMode(GL_PROJECTION);