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() { glClearColor(0.f, 0.f, 0.f, 1.f); // BLACK glClear(GL_COLOR_BUFFER_BIT); }
Here we get a glimpse at the first two GL functions we are going to be using. Because GLEW is a C API, code that looks like this will...