Changing the openGL coordinate system
Right now, my openGL window scales from -1 to 1 on both the X and Y axis. How would I 开发者_C百科change this, to say, -2 and 2?
Add transformation for halving every coordinate: glScalef(0.5,0.5,0.5);
. Note however, you won't get far without understanding OpenGL matrices, various transformations you can add and working with the stacks. See, for example, OpenGL FAQs regarding transformations and in more detail, the specification.
If working as 2D (say ortho), change it to the:
gluOrtho2D(-2,2,-2,2)
精彩评论