Reputation: 161
glViewport(0, 0, w, h);
gluOrtho2D(10, 100, 10, 100);
I am not getting any output, can you help me?
If I set it to
gluOrtho2D(-50, 50,-50, 50);
Then object created at center of window.
Upvotes: 2
Views: 9361
Reputation: 32587
gluOrtho2D(left, right, top, bottom)
defines a view box. That means that there is no perspective.
With
gluOrtho2D(-50,50,-50,50);
you say (assuming you have no additional model view matrix):
If then your object appears at the screen's center, it is probably located at the world's origin.
If you specify
gluOrtho2D(10,100,10,100);
then you can see an x-range of 10 to 100. The origin is not within this range and therefore not visible (it is beyond the left edge of the viewport).
Note that there are apparently two different signatures of this function based on the API:
gluOrtho2D(left, right, bottom, top)
and gluOrtho2D(left, right, top, bottom)
.
Upvotes: 10