0
\$\begingroup\$

Here is my code :

glMatrixMode(GL_PROJECTION);
glLoadIdentity();

glViewport(0, 0, screen_width, screen_height);

glMatrixMode(GL_PROJECTION);
glLoadIdentity();

glOrtho(0.0, screen_width, 0.0, screen_height, -1.0, 1.0);

glMatrixMode(GL_MODELVIEW_MATRIX);
glTranslatef(0, 0, -5);

glColor4f(rect.color.R(), rect.color.G(), rect.color.B(), rect.color.A());
glClear(GL_COLOR_BUFFER_BIT);

glBegin(GL_QUADS);

glRectd(rect.transforms.position.x, rect.transforms.position.y, rect.transforms.size.width, rect.transforms.size.height);

glEnd();
    
glfwSwapBuffers(window);

glFlush();

Where rect.transforms.position.x is in pixel.

Issue :

Nothing shows up.

The color was tested before & works on a rectangle that use opengl coordinates.

\$\endgroup\$
1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.