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

Author Topic: ”Failed to activate OpenGL context“ After using VS Installer Project  (Read 199 times)

0 Members and 1 Guest are viewing this topic.

Tchai

  • Newbie
  • *
  • Posts: 2
    • View Profile
    • Email
I'm using Win11 VisualStudio 2022 sfml2.6.1
My project includes <SFML>&&<SFML-Imgui>&&<openCV>, everything works fine when running in the visual studio.But sth went wrong after I tried to run the exe file Created by Visual Studio  Installer Project.
It says:
Failed to activate OpenGL context:
Warning: The created OpenGL context does not fully meet the settings that were requested
Requested: version = 1.1 ; depth bits = 0 ; stencil bits = 0 ; AA level = 0 ; core = false ; debug = false ; sRGB = false
Created: version = 0.0 ; depth bits = 0 ; stencil bits = 0 ; AA level = 0 ; core = false ; debug = false ; sRGB = false
Failed to activate OpenGL context:
Failed to activate the window's context
Failed to activate OpenGL context:
Failed to activate the window's context
Failed to activate OpenGL context:
Failed to activate the window's context
Failed to activate OpenGL context:
Failed to activate the window's context
Failed to activate OpenGL context:
Failed to activate the window's context
.......
The window do come up and the Window's Events are Processed,but there is nothing Shown on the Screen.
I have built other project that includes SFML with Installer Project ,no problem occured .

int main() {
        sf::ContextSettings settings;
        settings.antialiasingLevel = 8;
        sf::RenderWindow window(sf::VideoMode(1240, 800), "Map Maker", sf::Style::Default,settings);
        font.loadFromFile("STXIHEI.TTF");
        sf::Clock deltaClock;
        ImGui::CreateContext();
        ImGui::SFML::Init(window);
        ImGui::StyleColorsLight();
        ImGuiIO& io = ImGui::GetIO(); (void)io;
        io.Fonts->Clear();
        ImFont* Font = io.Fonts->AddFontFromFileTTF("C:\\Windows\\Fonts\\msyh.ttc", 25.0f, NULL, io.Fonts->GetGlyphRangesChineseFull());
        ImGui::SFML::UpdateFontTexture();
        while (window.isOpen()) {
                window.clear(sf::Color::White);
                ImGui::SFML::Update(window, deltaClock.restart());
                sf::Event event;
                while (window.pollEvent(event)) {
                        ImGui::SFML::ProcessEvent(event);
                        if (event.type == sf::Event::Closed)
                                window.close();
                }
                ImGui::SFML::Render(window);
                window.display();
        }
        ImGui::SFML::Shutdown();
        return 0;
}



eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10820
    • View Profile
    • development blog
    • Email
Not sure what "SFML with Installer Project" is, but it sounds like you end up using different DLLs, which can cause odd problems.

Make sure the necessary DLLs are next to your executable that you try to run.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Tchai

  • Newbie
  • *
  • Posts: 2
    • View Profile
    • Email
Thank you for your reply! The problem is fixed ;)
I followed your instruction and found that I have an extra dll next to my exe ,after I deleted it ,the problem is fixed.
its OPENGL32.dll
Im not quite sure Why it appears in my project,or I put it here