I've tried to set up SFML 2.0 with the latest version of the qt creator, I've set up SFML right and I imported a small game I wrote in visual studio. Upon compilation, I get this:
What I tried
Additional details
I'm running windows XP SP3, latest version of mingw and qt SDK and SFML
The code I'm trying to work with works without any errors or even warnings on Visual Studio 2010 and Code::Blocks
Yes, I am sure that SFML is set up on my IDE, basic code works but shows those errors and more advanced code shows all sprites and text as boxes.
I did not compile SFML myself
My gcc version is 4.6.2
My gcc is a DW2 one
I'm getting no results, I don't even know how to remotely get close to fixing this, not even where to start.
EDIT I can't show you all of my code, it's over 20 files and I'm almost 90% sure it's not my code, I've said it above: I can run this code without any warnings or even errors on any IDE except qt creator.
It's because you are not initializing OpenGL. Example with the lib glut.
Wrong:
glewInit(); // ERROR MISSING GL VERSION
glutInitDisplayMode(GLUT_RGB);
Good:
glutInitDisplayMode(GLUT_RGB);
glewInit();
EDIT I think for SFML:
sf::Window App(sf::VideoMode(400, 400, 32), "Window");
glewInit();
EDIT 2 Test this code.
#include <SFML/Window.hpp>
#include <iostream>
#include <GL/glew.h>
int
main(int, const char**)
{
GLenum err;
std::cout << "Start" << std::endl;
std::cout << "Test 1" << std::endl;
if ((err = glewInit()) != GLEW_OK)
std::cout << glewGetErrorString(err) << std::endl;
std::cout << "Init window" << std::endl;
sf::Window app(sf::VideoMode(400, 400, 32), "Windows");
std::cout << "Test 2" << std::endl;
if ((err = glewInit()) != GLEW_OK)
std::cout << glewGetErrorString(err) << std::endl;
std::cout << "End" << std::endl;
return 0;
}
My output:
Start
Test 1
Missing GL version
Init window
Test 2
End
Compile with: g++ -W -Wall -Werror main.cpp -lsfml-window -lGLEW
Good Luck ;)
At the request of user3648895, I am posting my answer outside of the comments separately.
For those using GLFW instead of SFML, you need to call glewInit() after glfwMakeContextCurrent
If you're using glew with glfw, use glfwMakeContextCurrent
(https://github.com/Cloudef/glhck/issues/15)
For those using SDL2's Renderer functions, it needs to be right after SDL_CreateRenderer
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With