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

Author Topic: Can't get OpenGL to work (SFML2, Windows, mingw)  (Read 2806 times)

0 Members and 1 Guest are viewing this topic.

Lupinius

  • Jr. Member
  • **
  • Posts: 85
    • View Profile
Can't get OpenGL to work (SFML2, Windows, mingw)
« on: May 21, 2012, 11:19:29 pm »
After many failed attempts to learn a bit of OpenGL I wanted to try again, this time with the help of SFML. I can't even get simple examples to compile though. This is my test code:

#include <SFML/Window.hpp>

int main() {
        sf::Window app(sf::VideoMode(800, 600), "Test", sf::Style::Default, sf::ContextSettings(0, 0, 0, 4, 0));
        GLuint buffer;
        glGenBuffer(1, &buffer);
       
        return 0;
}

The compiler complains about glGenBuffer not being declared. Using functions such as "glGetString(GL_VERSION)" works however (and returns the expected result). What am I doing wrong? Did something change from SFML 1.6 so I need to include more headers or is the mistake somewhere in my configuration?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Can't get OpenGL to work (SFML2, Windows, mingw)
« Reply #1 on: May 22, 2012, 08:04:57 am »
glGenBuffers is part of OpenGL 1.5. Unfortunately, Windows only provides headers for OpenGL 1.1, so the function is not declared there. You must use the extensions system, with a library such as GLEW or GLEE.
Laurent Gomila - SFML developer

 

anything