Hello, i've been having some trouble setting up an OpenGl 3.2 context with sfml 2.0 and glew.
When i call glewInit() it retuns the error "Missing GL version". I've tried the same code using freeGLUT for the context and it worked perfectly. I can only deduce that im using SFML wrong somehow.
Here is the code
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <GL/glew.h>
#include <SFML/Window.hpp>
#include <SFML/OpenGL.hpp>
#define WINDOW_TITLE_PREFIX "Chapter 2"
void Initialize(int, char*[]);
void InitWindow(void);
int main(int argc, char* argv[])
{
InitWindow();
Initialize(argc, argv);
exit(EXIT_SUCCESS);
}
void InitWindow()
{
sf::Window App(sf::VideoMode(800, 600, 32), "OpenGL");
}
void Initialize(int argc, char* argv[])
{
GLenum GlewInitResult;
glewExperimental = GL_TRUE;
GlewInitResult = glewInit();
if (GLEW_OK != GlewInitResult) {
fprintf(
stderr,
"ERROR: %s\n ",
glewGetErrorString(GlewInitResult)
);
exit(EXIT_FAILURE);
}
fprintf(
stdout,
"INFO: OpenGL Version: %s\n",
glGetString(GL_VERSION)
);
}
I'm probably being stupid and I apologize but any help is greatly appreciated!