Page 1 of 1

Noesis 2.1.0.b14 C++ with GLFW problem with ComboBox

Posted: 03 Jan 2018, 12:09
by Wanderer
I am porting my unfinished program in to 2.1.0b14 and I have problem with ComboBox. If I click on it, GUI rendering freeze, but looks like "logic" is still working because I can close program or do something, but I don't see it visually because GUI is not updated.
Another problem, and I think this produce the problem, is SelectedIndex. When I open option window(from my program) in codebehind it take value from SelectedIndex and when this is called, program crash.
int32_t ContainerItem::m_func_GetSelectedIndex() const // int32_t was previously NsInt32 which is non existent in Noesis 2.1.0.b14
{
	return m_i32_SelectedIndex;
}
/// -------------------------------------------------------------------------------------------------------------------
void ContainerItem::m_func_SetSelectedIndex(const int32_t index) 
{
	m_i32_SelectedIndex = index;
	switch (m_i32_SelectedIndex)
	{
	// ...
	}
	Changed(NSS(ContainerItem_SelectedIndex));
}
I use GLFW (OpenGL) and I followed IntegrationGLUT sample for my program. Btw. program run ok, except ComboBox.

Re: Noesis 2.1.0.b14 C++ with GLFW problem with ComboBox

Posted: 04 Jan 2018, 02:40
by sfernandez
This seems like a problem with offscreens. You have to make sure that your main frame buffer is restored after IRenderer::RenderOffscreen is called as you can see in our basic integration sample:
void DisplayFunc(void)
{
#ifdef NOESIS_GUI
    // Update view (layout, animations, ...)
    _view->Update(glutGet(GLUT_ELAPSED_TIME) / 1000.0);

    // Offscreen rendering phase populates textures needed by the on-screen rendering
    _view->GetRenderer()->UpdateRenderTree();
    _view->GetRenderer()->RenderOffscreen();
#endif

    // If you are going to render here with your own engine you need to restore the GPU state
    // because noesis changes it. The framebuffer and viewport are restored here
    glBindFramebuffer(GL_FRAMEBUFFER, 0);
    glViewport(0, 0, glutGet(GLUT_WINDOW_WIDTH), glutGet(GLUT_WINDOW_HEIGHT));

    glClearColor(0.0f, 0.0f, 0.25f, 0.0f);
    glClearStencil(0);
    glClear(GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);

#ifdef NOESIS_GUI
    // Rendering is done in the active framebuffer
    _view->GetRenderer()->Render();
#endif

    glutSwapBuffers();
    glutPostRedisplay();
}

Re: Noesis 2.1.0.b14 C++ with GLFW problem with ComboBox

Posted: 04 Jan 2018, 13:41
by Wanderer
Aha, I didn't have this: glBindFramebuffer(GL_FRAMEBUFFER, 0); after that no problems, but I need use glew, which is now working with Noesis.