Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: [SOLVED] How to detect in sfml that opengl driver fails?  (Read 4647 times)

0 Members and 1 Guest are viewing this topic.

Carlitox

  • Jr. Member
  • **
  • Posts: 53
    • View Profile
[SOLVED] How to detect in sfml that opengl driver fails?
« 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.

« Last Edit: August 30, 2016, 12:21:36 am by Carlitox »

binary1248

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1405
  • I am awesome.
    • View Profile
    • The server that really shouldn't be running
Re: How to detect in sfml that opengl driver fails?
« Reply #1 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.
SFGUI # SFNUL # GLS # Wyrm <- Why do I waste my time on such a useless project? Because I am awesome (first meaning).

Carlitox

  • Jr. Member
  • **
  • Posts: 53
    • View Profile
Re: How to detect in sfml that opengl driver fails?
« Reply #2 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

Not sure what happens





I read this in sdl forums.

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?
« Last Edit: August 04, 2016, 01:00:39 pm by Carlitox »

Carlitox

  • Jr. Member
  • **
  • Posts: 53
    • View Profile
Re: [SOLVED] How to detect in sfml that opengl driver fails?
« Reply #3 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;
}
 
« Last Edit: August 27, 2016, 10:56:58 pm by Carlitox »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
Re: [SOLVED] How to detect in sfml that opengl driver fails?
« Reply #4 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
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Carlitox

  • Jr. Member
  • **
  • Posts: 53
    • View Profile
Re: [SOLVED] How to detect in sfml that opengl driver fails?
« Reply #5 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.

 

anything