Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace glut with glfw and imgui #718

Merged
merged 6 commits into from
Feb 18, 2019
Merged

Replace glut with glfw and imgui #718

merged 6 commits into from
Feb 18, 2019

Conversation

karjonas
Copy link
Contributor

No description provided.

@karjonas
Copy link
Contributor Author

ping

apps/BraynsViewer/main.cpp Outdated Show resolved Hide resolved
apps/BraynsViewer/main.cpp Outdated Show resolved Hide resolved
apps/BraynsViewer/main.cpp Outdated Show resolved Hide resolved
apps/ui/Application.h Outdated Show resolved Hide resolved
braynsIO
braynsParameters
braynsUI
${OPENGL_gl_LIBRARY}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a comment. I don't know since which version, but the recommended way of importing OpenGL is now different. See https://cmake.org/cmake/help/v3.10/module/FindOpenGL.html. This is going to be more future proof regarding platform independence as well.


#include <deps/glfw/include/GLFW/glfw3.h>

Application* appInstance;

void cleanup()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If run is a function that returns (at it looks like), you don't need atexit, neither this function


#include <deps/glfw/include/GLFW/glfw3.h>

Application* appInstance;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a necessity, but you can use a user pointer data attached to the GLFWindow to avoid the global variable: https://www.glfw.org/docs/latest/group__window.html#ga3d2fc6026e690ab31a13f78bc9fd3651

int run(brayns::Brayns& brayns)
{
int windowWidth = 800;
int windowHeight = 600;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've always found the default window size a bit small. @tribal-tec what's your opinion about increasing it?

"] ";

GLFWwindow* window = glfwCreateWindow(windowWidth, windowHeight,
windowTitle.c_str(), NULL, NULL);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where is this object destroyed?

brayns/common/Timer.h Outdated Show resolved Hide resolved
{
if (m_fbTexture)
{
glDeleteTextures(1, &m_fbTexture);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're deleting Application with an atexit callback. Calling glDeleteTextures at that time is more than late. This is not critical, but you should review how you're doing the cleanup because segfaults at exit always give a bad impression (at least it does to me).

if ((width != 0 &&
height != 0) && // Zero sized interop buffers are not allowed in OptiX.
(m_width != width || m_height != height))
{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Negate the condition for an early return.

glVertex3f(frameSize.x, frameSize.y, 0);
glTexCoord2f(1.f, 0.f);
glVertex3f(frameSize.x, 0, 0);
glEnd();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since you're modernizing this code, you could try replacing the immediate mode draw calls with VBOs.

${CMAKE_CURRENT_SOURCE_DIR}/imgui/examples/imgui_impl_glfw.cpp
${CMAKE_CURRENT_SOURCE_DIR}/imgui/examples/imgui_impl_opengl3.cpp
)
target_compile_definitions(imgui PRIVATE -DIMGUI_IMPL_OPENGL_LOADER_GLEW)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does ImGui really need GLEW? The way you initialize it makes me think that it relies on glfw instead, but I may be wrong. I've been reading about it and it seems that removing GLEW would be a good idea as well as it's becoming a bit obsolete and it has some unresolved issues.

hernando
hernando previously approved these changes Feb 18, 2019
@@ -47,6 +47,8 @@
#include <algorithm>
#include <cassert>

namespace
{
Application* appInstance = nullptr;

static void glfwKeyCallback(GLFWwindow* /*window*/, int key, int /*scancode*/,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The idea of the anonymous is that you don't need the static qualifiers anymore.

@karjonas karjonas merged commit 18fb7e3 into BlueBrain:master Feb 18, 2019
@karjonas karjonas deleted the glfw1 branch February 18, 2019 15:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants