Jump to content
  • Advertisement
Sign in to follow this  
Mekan

OpenGL Migration From Glfw + Anttweakbar To Sdl2 + Imgui Performance Issues.

This topic is 715 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi,

 

I just migrated a single app which loads and renders one single model from GLFW+AntTweakBar to SDL2+ImGui .

OpenGL code remained the same but there is more than half of FPS drop with the use of  SDL2+ImGui .

 

While on GLFW i have an average fps of 100 and on SDL2 i have an average of 30-40. SDL/GL init code is below :

    SDL_GL_SetAttribute(SDL_GL_CONTEXT_FLAGS, SDL_GL_CONTEXT_FORWARD_COMPATIBLE_FLAG);
    SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE);
    SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
    SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3);
    SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 2);

    SDL_DisplayMode current;
    SDL_GetCurrentDisplayMode(0, &current);

    gWindow = SDL_CreateWindow("", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, windowWidth, windowHeight, SDL_WINDOW_OPENGL | SDL_WINDOW_RESIZABLE);
    if (gWindow == NULL)
    {
        std::cout << "Window could not be created! SDL Error: " << SDL_GetError() << std::endl;
        success = false;
    }
    else
    {
        std::cout << std::endl << "Yay! Created window sucessfully!" << std::endl << std::endl;
        //Create context
        gContext = SDL_GL_CreateContext(gWindow);
        if (gContext == NULL)
        {
            std::cout << "OpenGL context could not be created! SDL Error: " << SDL_GetError() << std::endl;
            success = false;
        }
        else
        {
            //Initialize GLEW
            glewExperimental = GL_TRUE;
            GLenum glewError = glewInit();
            if (glewError != GLEW_OK)
            {
                std::cout << "Error initializing GLEW! " << glewGetErrorString(glewError) << std::endl;
            }

            //Use Vsync
            if (SDL_GL_SetSwapInterval(1) < 0)
            {
                std::cout << "Warning: Unable to set Vsync! SDL Error: " << SDL_GetError << std::endl;
            }

If i try setting SDL_GL_SetSwapInterval(0) for immediate update i get an average of 60FPS but it still doesn't look smooth and there is small tearing on the model.

I tried removing the ImGui code and it's better as it ought to be but still much worse performance . Is this normal ?

Thanks in advance. 

 

update: Tearing stopped since i change BUFFER_DEPTH_BIT from 16 to 24 . But still the FPS is pretty low and i if i use "camera" it goes around 25 which make its unbearable to the eye. 

Edited by Mekan

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!