[Bug] Artifacts after windows resize with OpenGL3Renderer
Moderators: CEGUI MVP, CEGUI Team
Re: [Bug] Artifacts after windows resize with OpenGL3Rendere
Could you try another SDL version?
CrazyEddie: "I don't like GUIs"
-
- Just popping in
- Posts: 10
- Joined: Wed Sep 03, 2014 17:09
Re: [Bug] Artifacts after windows resize with OpenGL3Rendere
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;
}
Re: [Bug] Artifacts after windows resize with OpenGL3Rendere
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.
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"
-
- Just popping in
- Posts: 10
- Joined: Wed Sep 03, 2014 17:09
Re: [Bug] Artifacts after windows resize with OpenGL3Rendere
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.
Re: [Bug] Artifacts after windows resize with OpenGL3Rendere
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?
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"
Re: [Bug] Artifacts after windows resize with OpenGL3Rendere
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 4 guests