Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: OpenGL not rendering  (Read 6947 times)

0 Members and 1 Guest are viewing this topic.

drummerp

  • Newbie
  • *
  • Posts: 18
    • View Profile
OpenGL not rendering
« Reply #15 on: August 03, 2011, 04:34:09 am »
Quote from: "Laurent"
Have you tried the Window or OpenGL examples provided with the SFML SDK?


Yes, both of them work just fine, which confuses me greatly.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
OpenGL not rendering
« Reply #16 on: August 03, 2011, 08:00:27 am »
Ok, so you can start from them and try to build your own code on top of that.
Laurent Gomila - SFML developer

SCPM

  • Newbie
  • *
  • Posts: 11
    • View Profile
OpenGL not rendering
« Reply #17 on: August 04, 2011, 09:34:26 pm »
Quote from: "drummerp"
It still displays no more than a blank screen, and I cannot determine why. Please, any explanation is greatly appreciated, let alone help. I just want to get this working.


Hello:
In your code at the end of your setup function, you need to setup a perspective projection like so:
Code: [Select]
   glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    gluPerspective(90.f, 1.f, 1.f, 500.f);


And in your render function you need to add glMatrixMode(GL_MODELVIEW); like so:

Code: [Select]
void render() {
    // Clear the window with current clearing color
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    glMatrixMode(GL_MODELVIEW);

I hope that helps!

 

anything