Hello,
I'm trying to set up a SFML project with some OpenGL elements drawn over. I've tried following examples I've found online, but they either produce a black screen or a screen such as the one i've attached. Here is the code I'm currently using:
initialization: videomode =sf::VideoMode::getFullscreenModes()[resolution];
sf::ContextSettings settings;
settings.majorVersion = 2;
settings.minorVersion = 1;
window.create(videomode,"Opengl",fullscreen?sf::Style::Fullscreen:sf::Style::Default,settings);
window.setFramerateLimit(60);
sf::Image icon;
if (!icon.loadFromFile(resourcePath() + "icon.png")) throw;
window.setIcon(icon.getSize().x, icon.getSize().y, icon.getPixelsPtr());
if (!starfont.loadFromFile(resourcePath() + "sansation.ttf")) throw;
window.setVerticalSyncEnabled(true);
glEnable(GL_TEXTURE_2D);
glewExperimental = GL_TRUE;
glewInit();
glViewport(0, 0, videomode.width, videomode.height);
window.setActive(true);
glClearDepth(1.f);
glClearColor(0.3f, 0.3f, 1.f, 1.f);
glEnable(GL_DEPTH_TEST);
glDepthMask(GL_TRUE);
Main loop: go->window.setActive(true);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
checkError();
My checkError() function calls glGetError() and prints the error if there is one.
Has anyone run into a similar problem?
EDIT: The code I put here originally wasn't a minimal example, so here's a more minimal example without any vbos or anything. I'm just aiming for a window with a solid fill color, but this gives me a window that flashes between my fill color and the glitchy screen.
Same issue is happening for me, specifically whenever I attempt to draw any UI elements via SFGUI. I get a flashing window and the following error message:
Warning. Compatibility profile not supported on this platform.
Error. Unable to create the context. Retrying without shared context.
Warning. New context created without shared context.
Warning: The created OpenGL context does not fully meet the settings that were requested
Requested: version = 4.1 ; depth bits = 0 ; stencil bits = 0 ; AA level = 0 ; core = false ; debug = false ; sRGB = false
Created: version = 4.1 ; depth bits = 0 ; stencil bits = 0 ; AA level = 0 ; core = true ; debug = false ; sRGB = false
version: 4.1
sfml-graphics requires support for OpenGL 1.1 or greater
Ensure that hardware acceleration is enabled if available
An internal OpenGL call failed in Texture.cpp(785).
Expression:
glMatrixMode(GL_TEXTURE)
Error description:
GL_INVALID_OPERATION
The specified operation is not allowed in the current state.
An internal OpenGL call failed in Texture.cpp(786).
Expression:
glLoadIdentity()
Error description:
GL_INVALID_OPERATION
The specified operation is not allowed in the current state.
An internal OpenGL call failed in Texture.cpp(789).
Expression:
glMatrixMode(GL_MODELVIEW)
Error description:
GL_INVALID_OPERATION
The specified operation is not allowed in the current state.
I'm using an early 2015 Macbook Pro Retina running 10.13.6. I'm suspecting that this is a driver issue (Intel Iris 6100), and whenever I get a chance I'm going to see if I can replicate the issue on my hackintosh running 10.13.6 and NVIDIA GTX 980 Ti.