SFML community forums

Help => General => Topic started by: znyk on February 21, 2018, 04:05:04 pm

Title: SFML OpenGL implementation
Post by: znyk on February 21, 2018, 04:05:04 pm
I successful build this SFMLexample:
#include <SFML/Graphics.hpp>

int main()
{
    sf::RenderWindow window(sf::VideoMode(200, 200), "SFML works!");
    sf::CircleShape shape(100.f);
    shape.setFillColor(sf::Color::Green);

    while (window.isOpen())
    {
        sf::Event event;
        while (window.pollEvent(event))
        {
            if (event.type == sf::Event::Closed)
                window.close();
        }

        window.clear();
        window.draw(shape);
        window.display();
    }

    return 0;
}

But when I run application It opens 2 windows:
-> First with information:


Warning: Detected "Microsoft Corporation GDI Generic" OpenGL implementation
The current OpenGL implementation is not hardware-accelerated
Setting vertical sync not supported

-> Second with main programme.

My question is how to switch off first window ?
Is somthing wrong with my graphics card driver ?
I have got ATI Radeon HD 3870 graphics card and driver date is 31.01.2018
Title: Re: SFML OpenGL implementation
Post by: eXpl0it3r on February 21, 2018, 06:57:05 pm
If you see that message it means it's not running on your dedicated GPU. Not sure why, but maybe there's some option for your GPU to force some application to run with your GPU.

To remove the console window, check the FAQ: https://www.sfml-dev.org/faq.php#tr-win-console

Make sure to use the Help subforum next time.
Title: Re: SFML OpenGL implementation
Post by: znyk on February 21, 2018, 07:45:47 pm
I know my English isn't perfect but I think i understand everything.

I use Codeblocks. I change setting Console application to GUI application and replace int main with:
int WINAPI WinMain(HINSTANCE hThisInstance, HINSTANCE hPrevInstance, LPSTR lpszArgument, int nCmdShow

So do the step linking libsfml-main.a

But the programme don't run.
error: expected initializer before 'WinMain'
 int WINAPI WinMain(HINSTANCE hThisInstance, HINSTANCE hPrevInstance, LPSTR lpszArgument, int nCmdShow)

Quote
maybe there's some option for your GPU to force some application to run with your GPU.

Where can I find this option ? My workstation is Windows 10.
Title: Re: SFML OpenGL implementation
Post by: eXpl0it3r on February 21, 2018, 10:13:53 pm
Seems like you didn't understand "alternatively". It means either do one or the other, but don't do both.
Either link sfml-main or define WinMain (not really recommended).

Check your AMD settings.
Title: Re: SFML OpenGL implementation
Post by: znyk on February 22, 2018, 09:27:19 am
I enter link sfml-main:

#include <SFML/Main.hpp>
but have the same error.
Title: Re: SFML OpenGL implementation
Post by: znyk on February 23, 2018, 09:10:56 am
I solved this problem :) In  project -> propeties -> build targets I choose GUI application for debug and release and it works fine!!!