something was unclear for me, maybe you can explain why. in the rendering code you do
glTranslatef(x, y, 0);
but why the glPopMatrix? as fas I understand it the glPushMatrix() creates a new drawing matrix for custom settings yet the glPopMatrix restores the original settings...
doesnt that conflict with each other? making new settings and then restoring them again? or are those settings just for the white square in the middle?
hope you can help with this question, I got the code working and understand the different aspects but do not understand this specific part completely...
Also I tried to add borders to the white box so it can only go as far as the corners of the screen, not further.
I thought I could do that in the update method where the key movements are put to the x and y coords.
the first ones are fairly obvious:
x -= 4;
x = 0; }
this will work for the 0,0 borders (top and left)
however for the right this wont work, I tried using the coords that we have set (800 and 600) and even Display.getWidth() & Display.getHeight() which we also use when defining the viewport.
Now if I understand it right the Display.getHeight() and getWidth() will not work since they look at the size of the actual window, which if you have a large screen will be way more then 800 and 600 right?
The viewport method that we called is going to take that 800 and 600 and distribute that along the size of the actual window if I'm right.
the 800 and 600 then should work, however this also does not work, the x and y coords can still get quite a bit bigger than the 800 and 600...
I don't see why that doesn't work so perhaps I am missing something very basic when it comes to coding a graphical plane...