PDA

View Full Version : transformations



sisyphe
01-16-2017, 04:57 PM
hello, i just started to learn openGL and i tried transformations in a 2D form to see how it works but when i use one of the functions meant to do so(glRotated, glTranslated, glScalef), it react to the movements of my mouse, can anyone help me please.

//the part of the code that draws the square
glClear(GL_COLOR_BUFFER_BIT);

glPushMatrix();
glBegin(GL_QUADS);
glColor3ub(241,176,15);
glVertex2d(100,100);
glVertex2d(100, 200);
glColor3ub(241,0,0);
glVertex2d(200,200);
glVertex2d(200,100);
glEnd();
glPopMatrix();
glTranslated(1, 2, 0);
glFlush();
SDL_GL_SwapBuffers();