Skip to main content
gamedev.net
🔒 Locked

OpenGL Problems

Started by Mad_Koder Jul 29, 2006 at 1:23 PM 3 replies 750+ views
Original Post
Mad_Koder
Mad_Koder
I am haveing problems with a Wiggle app , the window isn't exactly the size i declare it to be, I cant figure out how to know where points will be based on glTriangles(): pixels per unit (which is verry annopying, for i cant draw polygons). I cant rerember all these terms for the different pipeline for modelview, and I dont understand how glPush(); and glPop(); work. Can someone explain this stuff I am verry confused.
Dont need one.... i'm so cool, dont ask me just do what you do..... meet me in the trap its going down....
Brother Bob
Brother Bob
If you're using Windows, then keep in mind that the size passed to CreateWindow is the size of the window, not the client area inside the window. Either adjust the window size with AdjustWindowRect or catch the WM_SIZE message for the actual size. If you're using a third party library, check the documentation for size callbacks or query functions.
Mad_Koder
Mad_Koder
thanks, but what about the coordinate system , I cant figure out how many units is a pixel to get primitives exact , how do I do so. I used to know but I'm brain dead at the moment.
Dont need one.... i'm so cool, dont ask me just do what you do..... meet me in the trap its going down....
hplus0603
hplus0603
To get 1:1 mapping, you have to first get the size of the viewport, which you'll get through the windowing system (typically, using GetClientRect()).

Then, set glOrtho() to that size window, and you have a 1:1 relation between coordinates and pixels.
enum Bool { True, False, FileNotFound };
Ezbez
Ezbez
An example call to glOrto():
glOrtho(0,SCREEN_WIDTH,0,SCREEN_HEIGHT,0,1);

Will make it a 1:1 ratio, like hplus said.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.