SFML community forums

Help => Graphics => Topic started by: squeakyneb on August 07, 2012, 09:26:52 am

Title: Having issues with OpenGL versions in C++. Using SFML1.6/GLEW.
Post by: squeakyneb on August 07, 2012, 09:26:52 am
I'm trying to learn modern OpenGL with the OGL Wikibook (http://en.wikibooks.org/wiki/OpenGL_Programming). I created a Window just fine with SFML, like I did back when I learnt with immediate mode. I tried creating a shader and it failed at runtime. I wrote some code to dump potentially useful data.

std::cout << "BEGIN!" << std::endl;
sf::WindowSettings winsettings;
winsettings.AntialiasingLevel=8;
winsettings.DepthBits=24;
winsettings.StencilBits=8;
sf::Window AppWindow(sf::VideoMode::GetDesktopMode(),"EITBSGBEAB, DV",sf::Style::Fullscreen,winsettings);

AppWindow.ShowMouseCursor(true);
AppWindow.EnableKeyRepeat(true);
AppWindow.SetActive();

std::cout << "VENDOR:    " << glGetString(GL_VENDOR) << std::endl;
std::cout << "VERSION:   " << glGetString(GL_VERSION) << std::endl;
std::cout << "RENDERER:  " << glGetString(GL_RENDERER) << std::endl;
std::cout << "GLEW 2.0:  " << (GLEW_VERSION_2_0!=0) << std::endl;
std::cout << "GLEW 2.1:  " << (GLEW_VERSION_2_1!=0) << std::endl;
//std::cout << "EXTENSIONS:" << glGetString(GL_EXTENSIONS) << std::endl;
if(!GLEW_VERSION_2_0)
{
    std::cout << "OpenGL 2.0 support is nonexistant! :O" <<std::endl;
    return 1;
}

Quote
BEGIN!
VENDOR: ATI Technologies Inc.
VERSION: 4.2.11740 Compatibility Profile Context
RENDERER: AMD Radeon HD 6700M Series
GLEW 2.0: 0
GLEW 2.1: 0
OpenGL 2.0 support is nonexistant! :O

Process returned 1 (0x1) execution time : 0.608 s
Press any key to continue.

Glewinfo.exe says everything up to to 4.1 is "ok" with my card, my code does say 4.2 but maybe "compatibility mode" counteracts that. I'm thinking it might be something wrong with the way I'm creating the window, but I would've thought SFML would do it right.
Any ideas?
Title: Re: Having issues with OpenGL versions in C++. Using SFML1.6/GLEW.
Post by: Laurent on August 07, 2012, 10:05:04 am
Have you called glewInit() first?
Title: Re: Having issues with OpenGL versions in C++. Using SFML1.6/GLEW.
Post by: squeakyneb on August 07, 2012, 02:02:46 pm
No, I haven't. I assumed that whatever it was doing was helping GLUT set up the window and SFML would've dealt with it. I'll give a success report once I fix this linking issue (was told linking directly to the DLL works, turns out it doesn't quite work, attempting recompile of GLEW under MinGW).
Title: Re: Having issues with OpenGL versions in C++. Using SFML1.6/GLEW.
Post by: squeakyneb on August 07, 2012, 02:09:12 pm
Quote
BEGIN!
VENDOR:    ATI Technologies Inc.
VERSION:   4.2.11740 Compatibility Profile Context
RENDERER:  AMD Radeon HD 6700M Series
GLEW 2.0:  1
GLEW 2.1:  1
init_resources()
allocating shader
loading shader
compiling shader
init_resources is great success!

Process returned 0 (0x0)   execution time : 2.583 s
Press any key to continue.

WHOO

Thanks Laurent, you're a damn magician :P
Title: Re: Having issues with OpenGL versions in C++. Using SFML1.6/GLEW.
Post by: Laurent on August 07, 2012, 02:19:53 pm
Calling glewInit() for GLEW to work, as stated in its documentation, is not what I call "magic" :P