Hi folks, how are you ?
Ok, I already made a Snake game in openGL and all, it was just to see if i could really do something, the code was all-messed-up, I just taked the functions that I needed and did everything without “thinking”…
Now I’m REALLY starting to learn openGL, and here’s my first problem: I can’t understand the View Stuff, I mean… look my code:
#include <gl/glut.h>
void Desenha(){
glClearColor(0,0,0,0);
glClear(GL_COLOR_BUFFER_BIT);
glColor3f(1, 0, 0.0f);
glBegin(GL_QUADS);
glVertex2i(0, 10);
glVertex2i(0, 0);
glVertex2i(10, 0);
glVertex2i(10, 10);
glEnd();
glutSwapBuffers();
glutPostRedisplay();
}
int main(){
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB);
glutInitWindowSize(500, 400);
glutCreateWindow("Teste Viewports");
glutDisplayFunc(Desenha);
glutMainLoop();
return 0;
}
Simple, right ? It was a Screen with 500x400px, where I drawn a square in “10, 10 position”, right ? NO! for some reason the square appears giantly at 1/4 of the screen … I just want to know the size of things, you know ? It would be nice if I understand something like…
screenSize(500,400);
goto(10,10);
drawRetangle(10,10);
And with that he creates a 500x400px screen where in 10px to X and 10px to Y he draws a retangle with 10x10px, you know ?
Do someone have any tutorial to understand that ? I have a openGL book here, but it doesn’t help with that
Thanks.