Archived

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

quick question

This topic is 5662 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

Recommended Posts

Yes this is a quick question and probably pretty stupid but I just wanted to doublecheck. Right now in my ogl program I have 3d mode for the game and an ortho2d mode to display the actual interface. Now the problem is that the coordinate systems used for my text outputter and my 2d graphics are different. The text outputter uses the screen widths and height as its coordinates with 0,0 being on the bottom left. If I were to call gluOrtho2d( 0, SCREEN_WIDTH, 0, SCREEN_HEIGHT ) would that match the coordinates, and I realize that the y axis is reversed but my code is already coded with that in mind so I want it to be reversed. Again I apologize if I am wasting your time but I just wanted to make sure I understood before I totally revamped my code (and yes I have backed it up but still...)

Share on other sites
as long as you have SCREEN_H

then make a quick inline function called

inline float I_Y(float y){ return SCREEN_H - y;}

and place that whenever you call your 2d functions, so

before:
drawsquare(y)
after:
drawsquare(I_Y(y));

---
"you are the poet laureat (sp?) of programming. ALL HAIL!!!" -capn_midnight

Share on other sites

Yeah it worked fine with no problem and since I replaced about 60 float calls with ints my fps actually went up about 2 or 3.

1. 1
2. 2
Rutin
19
3. 3
khawk
18
4. 4
5. 5
A4L
11

• 9
• 12
• 16
• 26
• 10
• Forum Statistics

• Total Topics
633769
• Total Posts
3013759
×