SFML community forums
Help => Window => Topic started by: golgoth on August 11, 2010, 05:18:08 pm
-
Greetings everyone,
I'm using SFML 2.0, Glew 1.5.5 with a gforce 8800… I'm wondering how to create an OpenGL 2.x context.
#define GLEW_STATIC
#include <opengl/glew.h>
#include <opengl/glut.h> /// gluPickMatrix.
…SNIP
sf::ContextSettings l_settings;
l_settings.MajorVersion= 2;
l_settings.MinorVersion= 0;
Still creates a 3.x context… what am I missing?
thx
-
Nothing :)
What is your OS? Which revision of SFML 2 do you use? How do you check the version of the created context?
Can you provide a complete and minimal code that reproduces this problem?
-
Hi Laurent,
I'm using Windows XP 64 with Visual Studio 2008.
Not sure about the version of SFML (still trying to figure how SVN repository works) but I've compiled the SFML 2.0 snapshot less than a week ago.
I'm using glGetString(GL_VERSION)) right after sf::window is being created.
My project is fairly complex so it would be tedious to reproduce. If nothing obvious pops out, I'll try a test project.
thx
-
My project is fairly complex so it would be tedious to reproduce
Do you mean that...
int main()
{
sf::ContextSettings settings;
settings.MajorVersion = 2;
settings.MinorVersion = 0;
sf::Window window(sf::VideoMode(800, 600), "SFML test", sf::Style::Default, settings);
const GLubyte* version = glGetString(GL_VERSION);
return 0;
}
...doesn't reproduce the problem?
-
Yes it does indeed,
const GLubyte* version = glGetString(GL_VERSION); return 3.3.0
while
sf::ContextSettings settings = window.GetSettings(); retrun 2.0
I embed my sf::window in a QT widget so I was not quite sure where was the problem, hope it helps.
-
Technically, the code can't create an OpenGL 3 context if settings.MajorVersion is less than 3.
I'm not sure that glGetString(GL_VERSION) returns the version of the current context, maybe it returns something more generic like the maximum GL version that the driver supports. I couldn't find a clear documentation about that.
From opengl.org:
GL_VERSION Returns a version or release number.
So helpful... :lol:
-
Don’t get me wrong here, I'm definitely inclined to trust your say, but I must find a way to validate which one is telling the truth. :wink:
-
Well, creating an OpenGL 3 context requires to use a totally different code compared to regular contexts, and SFML doesn't use this code if settings.MajorVersion < 3. So it's clearly not a GL 3 context that you get.
However I'd feel better if one could tell me exactly what GL_VERSION is supposed to mean.
-
#include <SFML/OpenGL.hpp>
#include <SFML/Window.hpp>
int main()
{
sf::ContextSettings settings;
settings.MajorVersion = 2;
settings.MinorVersion = 0;
sf::Window window(sf::VideoMode(800, 600), "SFML test", sf::Style::Default, settings);
const GLubyte* version = glGetString(GL_VERSION);
return 0;
}
przemoli@przemoli-laptop:~/Programowanie/OGLProjekt$ g++ -c ogl_version.cpp -I/home/przemoli/Programowanie/sfml2/include
przemoli@przemoli-laptop:~/Programowanie/OGLProjekt$ g++ -o ogl_version ogl_version.o -lsfml2-window -lsfml2-system -lGLU -L/home/przemoli/Programowanie/sfml2/lib/
przemoli@przemoli-laptop:~/Programowanie/OGLProjekt$ /lib/ld-linux.so.2 --library-path /home/przemoli/Programowanie/sfml2/lib/ ./ogl_version
XIO: fatal IO error 11 (Resource temporarily unavailable) on X server "� Ъ�
"
after 115 requests (114 known processed) with 0 events remaining.
Te same komendy, działają dla tutoriala o OpenGL. Co jest nie tak? (ati 5740, OGL 4.0 compatibility profile, catalyst 10.7)
-
Sorry. It was late.
"Te same komendy, działają dla tutoriala o OpenGL. Co jest nie tak? (ati 5740, OGL 4.0 compatibility profile, catalyst 10.7)"
Translate as:
This build commands work fine for OGL tutorial. What is wrong? (ati 5740, OGL 4.0 compatibility profile, catalyst 10.7)
-
This isn't a bug. Rather, in version 3.3 the standard was changed to allow implementations to return a 3.3 Compatibility (not Core) context when asked for < 3.x context, since the two are compatible.