View more

View more

View more

### Image of the Day Submit

IOTD | Top Screenshots

### The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.

# [SFML] Can't draw anything in OpenGL

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

2 replies to this topic

### #1Rimher  Members

Posted 29 September 2012 - 07:43 AM

Hello there! I've just recently started learning OpenGL, and I'm trying to use SFML as a working environment.
But I'm having my first problems.
I'm following Nehe's tutorial on how to get started in OpenGL, and I was trying to draw some simple shapes. The problem is, they do not appear on the screen! I clearly remember doing this on Windows at the time, but since I switched to Mac, everything seems much harder.

Anyway, here's the code...if anyone can help me, it'd be really appreciated.

### #2RulerOfNothing  Members

Posted 29 September 2012 - 08:20 AM

The tutorial in question has these lines of code:
glMatrixMode(GL_PROJECTION);	  // Select The Projection Matrix
glLoadIdentity();		 // Reset The Projection Matrix
// Calculate The Aspect Ratio Of The Window
gluPerspective(45.0f,(GLfloat)width/(GLfloat)height,0.1f,100.0f);
glMatrixMode(GL_MODELVIEW);	   // Select The Modelview Matrix
glLoadIdentity();		 // Reset The Modelview Matrix

in its window resizing code after the call to glViewport which are missing from your code. Maybe this is causing the problem?

Edited by RulerOfNothing, 29 September 2012 - 08:21 AM.

### #3Rimher  Members

Posted 29 September 2012 - 10:04 AM

The tutorial in question has these lines of code:

glMatrixMode(GL_PROJECTION);	  // Select The Projection Matrix
glLoadIdentity();		 // Reset The Projection Matrix
// Calculate The Aspect Ratio Of The Window
gluPerspective(45.0f,(GLfloat)width/(GLfloat)height,0.1f,100.0f);
glMatrixMode(GL_MODELVIEW);	   // Select The Modelview Matrix
glLoadIdentity();		 // Reset The Modelview Matrix

in its window resizing code after the call to glViewport which are missing from your code. Maybe this is causing the problem?

Such a rookie mistake! Thanks a lot, I had a different perspective in my inizialization!

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.