-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add input to eglut backend cleanup backend seperation build xcb and qt viewers update readme remove flag make eglut optional
- Loading branch information
Showing
11 changed files
with
233 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,10 @@ | ||
cmake_minimum_required(VERSION 2.8) | ||
project(liblub) | ||
|
||
find_package(Qt4 REQUIRED) | ||
|
||
#build examples | ||
file(GLOB EXAMPLES *.cpp) | ||
|
||
include_directories( | ||
../demos | ||
) | ||
|
||
foreach(EXAMPLE_PATH ${EXAMPLES}) | ||
STRING(REGEX REPLACE "\\.cpp" "" EXAMPLE_NAME "${EXAMPLE_PATH}") | ||
STRING(REGEX REPLACE "^.*/([^/]*)\$" "\\1" EXAMPLE_NAME "${EXAMPLE_NAME}") | ||
|
||
set(EXAMPLE_SOURCES ${EXAMPLE_PATH}) | ||
|
||
add_executable("${EXAMPLE_NAME}" ${EXAMPLE_SOURCES}) | ||
target_link_libraries(${EXAMPLE_NAME} lubApp lubDemos) | ||
install(TARGETS ${EXAMPLE_NAME} DESTINATION "${CMAKE_INSTALL_BINDIR}") | ||
endforeach(EXAMPLE_PATH) | ||
|
||
ADD_SUBDIRECTORY(editor) | ||
ADD_SUBDIRECTORY(planet-editor) | ||
ADD_SUBDIRECTORY(viewer) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
find_package(Qt4 REQUIRED) | ||
|
||
#build examples | ||
file(GLOB EXAMPLES *.cpp) | ||
|
||
set(EGL_BACKENDS | ||
x11 wayland drm | ||
) | ||
|
||
foreach(BACKEND ${EGL_BACKENDS}) | ||
|
||
string(TOUPPER ${BACKEND} UP) | ||
|
||
if(EGLUT_${UP}_FOUND) | ||
add_executable(liblub-view-${BACKEND} egl.cpp) | ||
target_link_libraries(liblub-view-${BACKEND} eglut_screen lubDemos) | ||
install(TARGETS liblub-view-${BACKEND} DESTINATION "${CMAKE_INSTALL_BINDIR}") | ||
else () | ||
message("Will not build ${BACKEND} backend") | ||
endif() | ||
endforeach(BACKEND) | ||
|
||
add_executable(liblub-view-xcb xcb.cpp) | ||
target_link_libraries(liblub-view-xcb lubDemos lubApp) | ||
install(TARGETS liblub-view-xcb DESTINATION "${CMAKE_INSTALL_BINDIR}") | ||
|
||
add_executable(liblub-view-qt qt.cpp) | ||
target_link_libraries(liblub-view-qt lubDemos lubApp) | ||
install(TARGETS liblub-view-qt DESTINATION "${CMAKE_INSTALL_BINDIR}") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
//#include <GL/gl.h> | ||
#include <EGL/eglut.h> | ||
|
||
#include <math.h> | ||
#include <stdlib.h> | ||
#include <string.h> | ||
|
||
#include "DemoLauncher.h" | ||
#include "Renderer/OpenGL.h" | ||
#include "Scene/Scene.h" | ||
|
||
DemoLauncher * launcher; | ||
|
||
static void draw(void) { | ||
launcher->draw(); | ||
eglutPostRedisplay(); | ||
} | ||
|
||
/* new window size or exposure */ | ||
static void reshape(GLint width, GLint height) { | ||
// GLfloat ar = static_cast<GLfloat> (width) / static_cast<GLfloat> (height); | ||
|
||
glViewport(0, 0, width, height); | ||
|
||
// glMatrixMode(GL_PROJECTION); | ||
// glLoadIdentity(); | ||
// glFrustum(-ar, ar, -1, 1, 5.0, 60.0); | ||
|
||
// glMatrixMode(GL_MODELVIEW); | ||
// glLoadIdentity(); | ||
// glTranslatef(0.0, 0.0, -10.0); | ||
} | ||
|
||
static void special_key(int special) { | ||
switch (special) { | ||
case EGLUT_KEY_LEFT: | ||
Scene::Instance().getCurrentCamera()->leftDirection(0.1); | ||
break; | ||
case EGLUT_KEY_RIGHT: | ||
Scene::Instance().getCurrentCamera()->rightDirection(0.1); | ||
break; | ||
case EGLUT_KEY_UP: | ||
Scene::Instance().getCurrentCamera()->forwardDirection(0.1); | ||
break; | ||
case EGLUT_KEY_DOWN: | ||
Scene::Instance().getCurrentCamera()->backwardDirection(0.1); | ||
break; | ||
default: | ||
break; | ||
} | ||
} | ||
|
||
int main(int argc, char *argv[]) { | ||
eglutInitWindowSize(1920, 1200); | ||
eglutInitAPIMask(EGLUT_OPENGL_BIT); | ||
eglutInit(argc, argv); | ||
|
||
eglutCreateWindow("liblub-egl"); | ||
|
||
OpenGL::Instance().setContextCreated(true); | ||
|
||
launcher = new DemoLauncher(argc, argv); | ||
launcher->init(); | ||
|
||
eglutReshapeFunc(reshape); | ||
eglutDisplayFunc(draw); | ||
eglutSpecialFunc(special_key); | ||
eglutMainLoop(); | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/* | ||
Copyright © 2010 Lubosz Sarnecki | ||
This file is part of liblub. | ||
liblub is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
liblub is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
You should have received a copy of the GNU General Public License | ||
along with liblub. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
#include "Application/XCB/XCBApplication.h" | ||
|
||
#include "DemoLauncher.h" | ||
|
||
class LoadApp: public XCBApplication { | ||
public: | ||
|
||
DemoLauncher * launcher; | ||
|
||
LoadApp(int &argc, char **argv) : XCBApplication(argc, argv) { | ||
launcher = new DemoLauncher(argc, argv); | ||
} | ||
|
||
void scene() { | ||
launcher->init(); | ||
} | ||
|
||
void renderFrame() { | ||
launcher->draw(); | ||
} | ||
|
||
}; | ||
|
||
int main(int argc, char **argv) { | ||
LoadApp(argc,argv).run(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
# Try to find eglut library and include path. | ||
# Once done this will define | ||
# | ||
# EGLUT_FOUND | ||
# EGLUT_INCLUDE_DIR | ||
# EGLUT_LIBRARIES | ||
# | ||
|
||
|
||
find_path(EGLUT_INCLUDE_DIR EGL/eglut.h | ||
/usr/include | ||
/usr/local/include | ||
/sw/include | ||
/opt/local/include | ||
DOC "The directory where EGL/eglut.h resides") | ||
|
||
mark_as_advanced(EGLUT_INCLUDE_DIR) | ||
|
||
|
||
set(EGL_BACKENDS | ||
x11 wayland screen | ||
) | ||
|
||
foreach(BACKEND ${EGL_BACKENDS}) | ||
|
||
find_library(EGLUT_${BACKEND}_LIBRARY | ||
NAMES eglut_${BACKEND} | ||
PATHS | ||
/usr/lib64 | ||
/usr/lib | ||
/usr/local/lib64 | ||
/usr/local/lib | ||
/sw/lib | ||
/opt/local/lib | ||
DOC "The eglut ${BACKEND} library") | ||
|
||
mark_as_advanced(EGLUT_${BACKEND}_LIBRARY) | ||
endforeach(BACKEND) | ||
|
||
# handle the QUIETLY and REQUIRED arguments and set EGLUT_FOUND to TRUE if | ||
# all listed variables are TRUE | ||
include(FindPackageHandleStandardArgs) | ||
find_package_handle_standard_args(EGLUT_X11 DEFAULT_MSG EGLUT_x11_LIBRARY EGLUT_INCLUDE_DIR) | ||
find_package_handle_standard_args(EGLUT_WAYLAND DEFAULT_MSG EGLUT_wayland_LIBRARY EGLUT_INCLUDE_DIR) | ||
find_package_handle_standard_args(EGLUT_DRM DEFAULT_MSG EGLUT_screen_LIBRARY EGLUT_INCLUDE_DIR) | ||
|
||
if(EGLUT_X11_FOUND) | ||
set(EGLUT_X11_LIBRARIES ${EGLUT_x11_LIBRARY}) | ||
endif() | ||
|
||
if(EGLUT_DRM_FOUND) | ||
set(EGLUT_X11_LIBRARIES ${EGLUT_x11_LIBRARY}) | ||
endif() | ||
|
||
if(EGLUT_WAYLAND_FOUND) | ||
set(EGLUT_X11_LIBRARIES ${EGLUT_x11_LIBRARY}) | ||
endif() | ||
|
||
|
||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters