SFML community forums

Help => Graphics => Topic started by: Carlitox on August 03, 2016, 06:11:02 pm

Title: [SOLVED] How to detect in sfml that opengl driver fails?
Post by: Carlitox on August 03, 2016, 06:11:02 pm
In intel g41 chipset my game is showing an error telling that "open gl cannot use vsync so i will see artifacts" I cannot access anymore to that computer so i cannot write the exact error message.

Something similar to this but not sure if is this message:

Quote
OpenGL extension SGIS_texture_edge_clamp unavailable
Artifacts may occur along texture edges
Ensure that hardware acceleration is enabled if available

I cannot use sf::RenderTextures in that computer and when i draw directily to the screen without render texture the cpu goes to 50% instead of 3%.

What can i do to detect this in my code and show the correct message for the player? By the moment the message is seen in the console.

The version of sfml is 2.3.2.

Title: Re: How to detect in sfml that opengl driver fails?
Post by: binary1248 on August 03, 2016, 07:42:15 pm
I cannot use sf::RenderTextures in that computer
Why not? If hardware acceleration isn't available, SFML will fall back to emulation. sf::RenderTexture should always be available, even on really crappy systems.

when i draw directily to the screen without doble buffer the cpu goes to 50% instead of 3%.
What do you mean by "without double buffering"? SFML will always use OpenGL double buffering. If a double buffering pixel format is not available, context creation will fail and you won't see anything at all. Double buffering isn't something you have to do yourself...

What can i do to detect this in my code and show the correct message for the player? By the moment the message is seen in the console.
All console messages are for debugging purposes only. In release, you would either want to disable the console all together or divert the output somewhere else.

A relatively simple way to tell if the system isn't being nice with OpenGL is to check the version of the context after you created your window. If it is 1.1 or lower then it is pretty safe to say that it is not truly hardware accelerated. You can also include OpenGL.hpp and read out the OpenGL implementation strings if you feel like it.
Title: Re: How to detect in sfml that opengl driver fails?
Post by: Carlitox on August 04, 2016, 12:50:05 pm
Sorry i didn't explained myself correctly. The message told that hardware acceleration was not possible and vsync it's not possible, i think that could be the reason to not see the tilemap. I draw the vertexarray of each layer i want to draw into a sf::RenderTexture before drawing, but I see a black screen. Only the characters and text are showed. If I draw directly the vertxarray directly without using sf::RenderTexture it works but very slow and increasing cpu usage. The problem it's on the intel g41 graphics card.

I think that the error message is the reason of this issue.


The operating system it's windows 8.1 and it seems that the graphic card doesn't have driver support but 2 commercial games i played worked.

http://www.intel.com/content/www/us/en/support/graphics-drivers/000005526.html (http://www.intel.com/content/www/us/en/support/graphics-drivers/000005526.html)

Not sure what happens





I read this in sdl forums.

https://forums.libsdl.org/viewtopic.php?t=12014&sid=4e3df6ffcd258d5463eb4ae7ee6202af (https://forums.libsdl.org/viewtopic.php?t=12014&sid=4e3df6ffcd258d5463eb4ae7ee6202af)

Quote
urbo Sliders (http://www.turbosliders.com/) is my old indie project which I still sometimes update for a new version after players bombard me long enough with new feature requests. It is still using SDL 1.2 and I would really much not like to upgrade to 2.0 yet as I really don't have the time for that right now.

One known nasty bug currently is that for players with certain video cards - especially Intel's integrated ones (Intel G41 Express, Intel Q45/Q43 Express, Intel HD Graphics 5500) - if the game is in OpenGL mode (the default) and players Alt+Tab out of the game and back, the game doesn't work anymore. In the logs, I can see that glGetError keeps returning GL_INVALID_FRAMEBUFFER_OPERATION 0x0506 after every operation.

Any ideas on what I should do? Players can use DirectDraw driver which works but with the horribly slow alpha blending ruining the game. With DD, there is manual texture reloading if blits start returning -2 after alt-tabbing but I understood that wouldn't be necessary with OpenGL? Is there something else I am missing or is OpenGL with SDL 1.2 inherently flawed?

Any ideas for quick fixes? Or is SDL2 the only way?
Title: Re: [SOLVED] How to detect in sfml that opengl driver fails?
Post by: Carlitox on August 27, 2016, 04:07:13 pm
The computer that had problems was using opengl 1.1 versión. The solution is to check the correct version and show to the player the recommendation to update the opengl driver.

bool GameApp::checkOpenGL()
{
        sf::ContextSettings settings = window.getSettings();
        float openGL_version = std::stod(std::to_string(settings.majorVersion) + "." + std::to_string(settings.minorVersion));
        return openGL_version >= 1.2f;
}
 
Title: Re: [SOLVED] How to detect in sfml that opengl driver fails?
Post by: eXpl0it3r on August 29, 2016, 11:07:56 pm
The computer that had problems was using opengl 1.1 versión. The solution is to check the correct version and show to the player the recommendation to update the opengl driver.
Or more like install a dedicated driver in the first place. :P
Title: Re: [SOLVED] How to detect in sfml that opengl driver fails?
Post by: Carlitox on August 30, 2016, 12:04:26 am
The computer that had problems was using opengl 1.1 versión. The solution is to check the correct version and show to the player the recommendation to update the opengl driver.
Or more like install a dedicated driver in the first place. :P

Yes exactly. That should be the message.

But in that concrete case Intel G41 chipset with graphic card integrated doesn't have drivers for Windows 8.1. Maibe the only solution is to install a Windows version that have graphic drivers support.