[Bug] Artifacts after windows resize with OpenGL3Renderer

If you found a bug in our library or on our website, please report it in this section. In this forum you can also make concrete suggestions or feature requests.

Moderators: CEGUI MVP, CEGUI Team

User avatar
Ident
CEGUI Team
Posts: 1998
Joined: Sat Oct 31, 2009 13:57
Location: Austria

Re: [Bug] Artifacts after windows resize with OpenGL3Rendere

Postby Ident » Thu Sep 11, 2014 06:00

Could you try another SDL version?
CrazyEddie: "I don't like GUIs"

msiedlarek
Just popping in
Just popping in
Posts: 10
Joined: Wed Sep 03, 2014 17:09

Re: [Bug] Artifacts after windows resize with OpenGL3Rendere

Postby msiedlarek » Fri Sep 12, 2014 16:06

Ident wrote:Could you try another SDL version?

I did one better - tried GLFW3 and... same problem!

Code: Select all

#ifdef USE_SDL2
#   include <SDL2/SDL.h>
#   include <SDL2/SDL_video.h>
#elif USE_GLFW3
#   include <GLFW/glfw3.h>
#endif

#include <CEGUI/System.h>
#include <CEGUI/RendererModules/OpenGL/GL3Renderer.h>
#include <CEGUI/SchemeManager.h>
#include <CEGUI/WindowManager.h>
#include <CEGUI/GUIContext.h>
#include <CEGUI/DefaultResourceProvider.h>
#include <CEGUI/Font.h>
#include <CEGUI/Scheme.h>
#include <CEGUI/WindowManager.h>
#include <CEGUI/falagard/WidgetLookManager.h>
#include <CEGUI/ImageManager.h>

int main()
{
#ifdef USE_SDL2
    SDL_Init(SDL_INIT_VIDEO | SDL_INIT_EVENTS);

    SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3);
    SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 3);
    SDL_GL_SetAttribute(
        SDL_GL_CONTEXT_PROFILE_MASK,
        SDL_GL_CONTEXT_PROFILE_CORE
    );

    SDL_Window * const window = SDL_CreateWindow(
        "Sample",
        SDL_WINDOWPOS_CENTERED,
        SDL_WINDOWPOS_CENTERED,
        1200,
        700,
        SDL_WINDOW_OPENGL | SDL_WINDOW_RESIZABLE
    );
    SDL_GLContext sdl_opengl_context = SDL_GL_CreateContext(window);
#elif USE_GLFW3
    glfwInit();

    glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
    glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
    glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
    glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);

    GLFWwindow * const window = glfwCreateWindow(
        1200,
        700,
        "Sample",
        NULL,
        NULL
    );
    glfwMakeContextCurrent(window);
#endif

    CEGUI::OpenGL3Renderer::bootstrapSystem();
    CEGUI::System & system = CEGUI::System::getSingleton();

    {
        CEGUI::DefaultResourceProvider * rp = (
            static_cast<CEGUI::DefaultResourceProvider*>(
                system.getResourceProvider()
            )
        );
        rp->setResourceGroupDirectory("schemes", "./datafiles/schemes/");
        rp->setResourceGroupDirectory("imagesets", "./datafiles/imagesets/");
        rp->setResourceGroupDirectory("fonts", "./datafiles/fonts/");
        rp->setResourceGroupDirectory("layouts", "./datafiles/layouts/");
        rp->setResourceGroupDirectory("looknfeels", "./datafiles/looknfeel/");

        CEGUI::ImageManager::setImagesetDefaultResourceGroup("imagesets");
        CEGUI::Font::setDefaultResourceGroup("fonts");
        CEGUI::Scheme::setDefaultResourceGroup("schemes");
        CEGUI::WidgetLookManager::setDefaultResourceGroup("looknfeels");
        CEGUI::WindowManager::setDefaultResourceGroup("layouts");
    }

    {
        CEGUI::SchemeManager::getSingleton().createFromFile("Generic.scheme");
        CEGUI::SchemeManager::getSingleton().createFromFile("GameMenu.scheme");
        CEGUI::Window * const root_window = (
            CEGUI::WindowManager::getSingleton().loadLayoutFromFile(
                "GameMenu.layout"
            )
        );
        system.getDefaultGUIContext().setRootWindow(root_window);
    }

#ifdef USE_SDL2
    while (!SDL_QuitRequested()) {
        SDL_Event event;
        while (SDL_PollEvent(&event)) {
            if (event.type == SDL_WINDOWEVENT
                    && event.window.event == SDL_WINDOWEVENT_SIZE_CHANGED) {
                int x, y;
                SDL_GL_GetDrawableSize(window, &x, &y);
                system.notifyDisplaySizeChanged({
                    static_cast<float>(x),
                    static_cast<float>(y)
                });
            }
        }
        system.renderAllGUIContexts();
        SDL_GL_SwapWindow(window);
    }
#elif USE_GLFW3
    while (!glfwWindowShouldClose(window)) {
        int x, y;
        glfwGetFramebufferSize(window, &x, &y);
        system.notifyDisplaySizeChanged({
            static_cast<float>(x),
            static_cast<float>(y)
        });

        system.renderAllGUIContexts();
        glfwSwapBuffers(window);
        glfwPollEvents();
    }
#endif

    CEGUI::OpenGL3Renderer::destroySystem();

#ifdef USE_SDL2
    SDL_GL_DeleteContext(sdl_opengl_context);
    SDL_DestroyWindow(window);
    SDL_Quit();
#elif USE_GLFW3
    glfwDestroyWindow(window);
    glfwTerminate();
#endif

    return 0;
}


User avatar
Ident
CEGUI Team
Posts: 1998
Joined: Sat Oct 31, 2009 13:57
Location: Austria

Re: [Bug] Artifacts after windows resize with OpenGL3Rendere

Postby Ident » Fri Sep 12, 2014 16:12

I have to ask again because it is such a common issue and we often get false reports on this: Did you do any OpenGL calls at all in your code? Please check multiple times before you respond.

It makes no sense why your application would cause this while the samplebrowser does not. There must be some difference.
CrazyEddie: "I don't like GUIs"

msiedlarek
Just popping in
Just popping in
Posts: 10
Joined: Wed Sep 03, 2014 17:09

Re: [Bug] Artifacts after windows resize with OpenGL3Rendere

Postby msiedlarek » Fri Sep 12, 2014 16:19

Ident wrote:I have to ask again because it is such a common issue and we often get false reports on this: Did you do any OpenGL calls at all in your code? Please check multiple times before you respond.

I attached entire code of the sample that presents this problem. You can see the only thing it does is context creation using SDL2/GLFW3 and CEGUI calls.

I'm gonna investigate some more. I'm just posting updates, so if any idea comes to your mind you can suggest something.

User avatar
Ident
CEGUI Team
Posts: 1998
Joined: Sat Oct 31, 2009 13:57
Location: Austria

Re: [Bug] Artifacts after windows resize with OpenGL3Rendere

Postby Ident » Fri Sep 12, 2014 16:31

The only idea i get right now is to update the system and the defaultguicontext with a timepulse (can be 0.0f) in the loop after the notifyDisplaySizeChanged call.

I do not remember the source code well enough though to determine if this makes a difference. From your code everything looks fine. Did you debug if notifyDisplaySizeChanged() is called correctly (correct parameters) after each resize?
CrazyEddie: "I don't like GUIs"

User avatar
Ident
CEGUI Team
Posts: 1998
Joined: Sat Oct 31, 2009 13:57
Location: Austria

Re: [Bug] Artifacts after windows resize with OpenGL3Rendere

Postby Ident » Thu Jan 15, 2015 23:41

Any news on this?
CrazyEddie: "I don't like GUIs"


Return to “Bug Reports, Suggestions, Feature Requests”

Who is online

Users browsing this forum: No registered users and 5 guests