Re: Some pre beginning questions
Posted: 23 Jan 2020, 11:32
Well your example isn't trying to use a Qt5 QOpenGLWindow. As my luck goes renderdoc refuses to start.
If you don't mind I could create a VS solution with a minimal example but you'd need Qt installed so that's probably not an option.
Not really sure how to go from here because it actually seemed to work correctly and renders all stuff without the glBindFramebuffer(GL_FRAMEBUFFER, 0); which is not the correct way apparently and may lead to the lock up with TextBox.
With your recommended correct way using the glBindFramebuffer it's not rendering anything even if I remove all other stuff and just use the minimum calls required to render the gui.
And it was going so well :)
Edit: Renderdoc is running now, there was a conflict with installed Qt versions. Though I have no idea what I'm looking at. The errors and warnings tab at least is empty.
Edit2: Changed the QOpenGLWidget to a QOpenGLWindow now the render function looks like that
and it renders both the menu and my background. It still locks up when I click into a TextBox and when I uncomment I won't see my background.
Edit3: turns out is the culprit for the lock up, what exactly is expected there? milliseconds since last frame or just a rising counter?
If you don't mind I could create a VS solution with a minimal example but you'd need Qt installed so that's probably not an option.
Not really sure how to go from here because it actually seemed to work correctly and renders all stuff without the glBindFramebuffer(GL_FRAMEBUFFER, 0); which is not the correct way apparently and may lead to the lock up with TextBox.
With your recommended correct way using the glBindFramebuffer it's not rendering anything even if I remove all other stuff and just use the minimum calls required to render the gui.
And it was going so well :)
Edit: Renderdoc is running now, there was a conflict with installed Qt versions. Though I have no idea what I'm looking at. The errors and warnings tab at least is empty.
Edit2: Changed the QOpenGLWidget to a QOpenGLWindow now the render function looks like that
Code: Select all
// Update view (layout, animations, ...)
double time = std::chrono::system_clock::now().time_since_epoch().count();
m_view->Update( time );
// Offscreen rendering phase populates textures needed by the on-screen rendering
m_view->GetRenderer()->UpdateRenderTree();
m_view->GetRenderer()->RenderOffscreen();
// If you are going to render here with your own engine you need to restore the GPU state
// because noesis changes it. In this case only framebuffer and viewport need to be restored
glBindFramebuffer(GL_FRAMEBUFFER, 0);
glViewport(0, 0, this->width(), this->height() );
{
QOpenGLVertexArrayObject::Binder vaoBinder( &m_vao );
glViewport(0, 0, this->width(), this->height() );
glClearColor( 0.0, 0.0, 0.0, 0.0 );
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
glEnable( GL_BLEND );
glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
//glEnable( GL_DEPTH_TEST );
glDepthFunc( GL_LEQUAL );
if( m_shader )
{
m_shader->bind();
m_shader->setUniformValue( "transform", m_projectionMatrix );
glDrawArraysInstancedBaseInstance( GL_TRIANGLES, 0, 18, 1, 0 );
m_shader->release();
}
}
// Rendering is done in the active framebuffer
m_view->GetRenderer()->Render();
}
Code: Select all
//glEnable( GL_DEPTH_TEST );
Edit3: turns out
Code: Select all
double time = std::chrono::system_clock::now().time_since_epoch().count();