Jump to content
  • Advertisement
Sign in to follow this  

OpenGL Beginners question: Can't get OpenGL to draw outside coordinates -1 - 1. Why?

This topic is 2429 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hey all

I've been studing OpenGL at the uni' and I'm a bit stuck on this topic.
No matter how I define the gluOrtho2D coordinates, or the glViewport, I just can't seem to draw anything outside of coordinates -1.0 - 1.0. Anything I draw outside of these coordinates is just not shown.

Here's a test code I've been trying to play with:

void myMouseFunc(int button, int state, int x, int y) {
if (state == GLUT_DOWN)

void myDispFunc() {
glClearColor(1.0f, 1.0f, 0.0f, 0.0);

glRectf(0, 0, 1, 1);


void testFunc(int* argc, char** argv) {
glutInit(argc, argv);
glutInitDisplayMode(GLUT_RGB | GLUT_SINGLE);
gluOrtho2D(0, 15, 0, 15);
glutCreateWindow("Test window!");


Thank you all in advance for trying to help smile.png

Share this post

Link to post
Share on other sites
You need to move the OpenGL code to after glutCreateWindow. No window means no rendering context, and no rendering context means no OpenGL.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!