Linux, CMake, wxWidgets, OpenGL - Can't see the Penguin :(

Do you have a question about makefiles, a compiler or IDE you are using and need to know how to set it up for wxWidgets or why it doesn't compile but other IDE's do ? Post your questions here.
Post Reply
Gaunt82
Earned a small fee
Earned a small fee
Posts: 16
Joined: Mon Jun 22, 2015 4:49 pm

Linux, CMake, wxWidgets, OpenGL - Can't see the Penguin :(

Post by Gaunt82 »

Hi everybody!

A year ago, I stopped programming my private Graphic Engine hobby project because of some issues when trying to compile it in Linux. Now I am motivated again and want to get it fixed finally.

Here is the Problem:
I started my projekt in Windows, using CMake, wxWidgets and OpenGl to be capable of switching platforms as I like. I used a wxglcanvas to render my scene in wxWidgets. While everything works fine with Windows, the Linux version only renders the clear color, but no Objects.

To exclude some possible error sources from my list, I just tried to build the Penguin example from wxWidgets. Everthing works as expected, when using the original makefile. Next step was to build the same example using CMake. Everything compiles and the program runs, BUT I get the same problem now. I can see the blue background color in the canvas, but the penguin is gone!

I am not totally sure if it is related to my graphics drivers or to my CMake-script. When using Windows, I had to use the nvidia settings in order to tell my Graphics driver it should use my GeForce card instead of the onboard card. Otherwise the FPS dropped significantly and there were some artifacts. So maybe I have do the same thing in Linux, but I have no clue how.
The other possibility is, that I am doing something wrong in my CMakeScript. Here is the code:

Code: Select all

PROJECT(Penguin)
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
SET(CMAKE_VERBOSE_MAKEFILE ON)


find_package(wxWidgets COMPONENTS gl core base REQUIRED)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${wxWidgets_CXX_FLAGS} -std=gnu++14 -Wall  -Wno-long-long -pedantic")
include(${wxWidgets_USE_FILE})



FIND_PACKAGE(OpenGL)
include_directories( ${OPENGL_INCLUDE_DIRS})

add_executable(Penguin
   opengl/penguin/penguin.cpp
   opengl/penguin/dxfrenderer.cpp
   opengl/penguin/trackball.c
   )

target_link_libraries(Penguin
    ${OPENGL_LIBRARIES}
    ${wxWidgets_LIBRARIES}
    )


Maybe somebody can copy the necessary files from the wxWidgets example, adjust the filepaths in the add_executable and try to build the program with CMake. If this somebody gets the penguin rendered, I know that the drivers are the problem. Otherwise it might still be the CMake-script.

I would also appreciate if somebody has other suggestions what might be the error.

Thanks in advance
Post Reply