O'Reilly logo

Mastering SFML Game Development by Raimondas Pupius

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Using GLEW

The first thing we are going to need if we are working with OpenGL is a window. Luckily, window creation isn't OpenGL specific, so one can be made using almost any library out there that supports it, including SFML. For our purposes, we'll be reusing the Window class with some minor adjustments to it, including the actual SFML window type:

class GL_Window { 
  ... 
private: 
  ... 
  sf::Window m_window; 
  ... 
}; 

Note the data type of the m_window data member. If actual SFML is not used to draw anything, we do not need an instance of sf::RenderWindow and can instead work with sf::Window. This means that any task that does not have anything to do with the actual window has to be handled separately. This even includes clearing the window:

void GL_Window::BeginDraw() ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required