-
Sorry to bother you again. In my multi-window application, my first window can run normally. // application start
// process messages continuously
void App::start() {
while (windows.size()>0)
{
for (auto& win:windows)
{
win->ProcessEvents();
}
}
} //WindowBase is the base class of all windows
void WindowBase::ProcessEvents()
{
if (context_dimensions_dirty) {
context_dimensions_dirty = false;
Rml::Vector2i window_size;
float dp_ratio = 1.f;
glfwGetFramebufferSize(glfwWindow, &window_size.x, &window_size.y);
glfwGetWindowContentScale(glfwWindow, &dp_ratio, nullptr);
context->SetDimensions(window_size);
context->SetDensityIndependentPixelRatio(dp_ratio);
}
glfwPollEvents();
const bool result = glfwWindowShouldClose(glfwWindow);
if (result) {
App::get()->closeWindow(this);
}
else {
context->Update();
renderInterface->BeginFrame();
renderInterface->Clear();
auto a = this->windowName;
context->Render();
renderInterface->EndFrame();
glfwSwapBuffers(glfwWindow);
}
} The exception occurs in void RenderInterface_GL3::RenderCompiledGeometry(Rml::CompiledGeometryHandle handle, const Rml::Vector2f& translation)
{
//......
//The code of RmlUi is omitted here. I haven't changed anything
Gfx::CheckGLError("RenderCompiledGeometry"); //The exception occurred here
} The exception info is:
The program is processing the first window's events when this exception occurred. Can you tell me what's wrong with my code? Thanks very much. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
Each window has its own context = Rml::CreateContext(windowName, Rml::Vector2i(width, height),renderInterface);
|
Beta Was this translation helpful? Give feedback.
-
This seems to be a silly question. I'd better turn it off temporarily In glfwMakeContextCurrent(glfwWindow); |
Beta Was this translation helpful? Give feedback.
-
It seems like your applications is trying to read from a nullptr. It's a bit hard to help out in cases like this, it's really about debugging, figuring out which variable has the nullptr, and ensuring that everything is initialized in the correct order. |
Beta Was this translation helpful? Give feedback.
This seems to be a silly question. I'd better turn it off temporarily
In
ProcessEvents
method must switch window context.glfwMakeContextCurrent(glfwWindow);