I have here a very simple code in openGL and i don’t understand what does:
void reshape(int x, int y)
glViewport(0, 0, x, y);
glOrtho(0.0, 1.0, 0.0, 1.0, 0.0, 1.0);
I have read on the internet about glMatrixMode but i have not understand very well how this works.
Also if i delete
The final scene doesn’t change.
Thank you in advance.
Understanding how matrix transforms work and how to use modeling, viewing, projection, and viewport transforms work is pretty key to rendering with OpenGL. You should definitely spend some quality time reading up on this. You’ll be glad you did.
The OpenGL Programming Guide at one time had a very good description of how these transformations work and how to think about them (it may still in recent versions, but I don’t know for sure). If you can buy or borrow one, it’s worth your time. Failing that, there’s some older versions on-line that may be more appropriate for you since you’re using the old built-in matrix operations (here’s one example.
Also if I delete … The final scene doesn’t change.
Which would suggest either 1) your program isn’t using the MODELVIEW transform setting, or 2) the MODELVIEW transform was already set to the identity transform.
I bought that book, and gave it initially bad reviews, because it doesn’t really walk you through step by step startup in Windows with Visual Studio Community. However, if you are already programming in OpenGL and understand how to compile a simple program, then it’s a great read, I’ve read through it now, and am working on slowly mastering the concepts brought out in each chapter.
Plus, it comes with examples (which weren’t updated when the book was initially released, and is another reason for my initial bad review), which they recently updated and released on the web site.
P.S. Also in the wake of the things that I needed to get started in OpenGL, it motivated me to start a series of YouTube videos covering startup and a few of the concepts that I’ve learned so far from the book and other sources.
This is a link to my youtube channel:
And a link to a great online tutorial, which can be downloaded in PDF format:
Thanks. i will start reading