find_package (DirectX)
endif (NOT WIN32)
-find_package (GLUT)
-
if (WIN32)
# MSVC & MinGW only define & use APIENTRY
add_definitions (-DGLAPIENTRY=__stdcall)
)
add_library (glxtrace SHARED glxtrace.cpp trace_write.cpp os_posix.cpp ${CMAKE_CURRENT_BINARY_DIR}/glproc.hpp)
- set_target_properties (glxtrace PROPERTIES
- COMPILER_DEFINITIONS "-DRETRACE"
- PREFIX ""
- )
target_link_libraries (glxtrace dl)
endif ()
if (WIN32)
set (os os_win32.cpp)
+ set (glws glws_wgl.cpp)
else (WIN32)
set (os os_posix.cpp)
+ set (glws glws_glx.cpp)
endif (WIN32)
add_library (trace trace_model.cpp trace_parser.cpp ${os})
add_executable (dump dump.cpp)
target_link_libraries (dump trace)
-if (GLUT_INCLUDE_DIR)
- add_custom_command (
- OUTPUT glretrace.cpp
- COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/glretrace.py > ${CMAKE_CURRENT_BINARY_DIR}/glretrace.cpp
- DEPENDS glretrace.py retrace.py codegen.py glapi.py glenum.py stdapi.py
- )
+add_custom_command (
+ OUTPUT glretrace.cpp
+ COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/glretrace.py > ${CMAKE_CURRENT_BINARY_DIR}/glretrace.cpp
+ DEPENDS glretrace.py retrace.py codegen.py glapi.py glenum.py stdapi.py
+)
- add_custom_command (
- OUTPUT glstate.cpp
- COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/glstate.py > ${CMAKE_CURRENT_BINARY_DIR}/glstate.cpp
- DEPENDS glstate.py glenum.py stdapi.py
- )
+add_custom_command (
+ OUTPUT glstate.cpp
+ COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/glstate.py > ${CMAKE_CURRENT_BINARY_DIR}/glstate.cpp
+ DEPENDS glstate.py glenum.py stdapi.py
+)
- include_directories (
- ${CMAKE_CURRENT_BINARY_DIR}
- ${OPENGL_INCLUDE_PATH}
- ${GLUT_INCLUDE_DIR}
- )
+include_directories (
+ ${CMAKE_CURRENT_BINARY_DIR}
+ ${OPENGL_INCLUDE_PATH}
+)
- add_executable (glretrace
- glretrace.cpp
- glstate.cpp
- image.cpp
- ${CMAKE_CURRENT_BINARY_DIR}/glproc.hpp
- )
+add_executable (glretrace
+ glretrace.cpp
+ glstate.cpp
+ ${glws}
+ image.cpp
+ ${CMAKE_CURRENT_BINARY_DIR}/glproc.hpp
+)
- set_property (
- TARGET glretrace
- APPEND
- PROPERTY COMPILE_DEFINITIONS "RETRACE"
- )
++set_property (
++ TARGET glretrace
++ APPEND
++ PROPERTY COMPILE_DEFINITIONS "RETRACE"
++)
+
- target_link_libraries (glretrace
- trace
- ${OPENGL_gl_LIBRARY}
- ${OPENGL_glu_LIBRARY}
- ${GLUT_glut_LIBRARY}
- )
-
-endif (GLUT_INCLUDE_DIR)
+target_link_libraries (glretrace
+ trace
+ ${OPENGL_gl_LIBRARY}
+ ${OPENGL_glu_LIBRARY}
+)
if (QT4_FOUND AND QJSON_FOUND)
- # Include the cmake file needed to use qt4
- include( ${QT_USE_FILE} )
add_subdirectory(gui)
endif (QT4_FOUND AND QJSON_FOUND)
#include <stdio.h>
#include <iostream>
- #define RETRACE
-
#include "glproc.hpp"
#include "glstate.hpp"
-
-#include <GL/glut.h>
+#include "glws.hpp"
static bool double_buffer = false;
static bool insideGlBeginEnd = false;
print r'''
static Trace::Parser parser;
-
-static void display_noop(void) {
-}
+static glws::WindowSystem *__ws = NULL;
+static glws::Visual *__visual = NULL;
+static glws::Drawable *__drawable = NULL;
+static glws::Context *__context = NULL;
#include "image.hpp"
delete ref;
}
}
+
+ if (__reshape_window) {
+ // XXX: doesn't quite work
+ __drawable->resize(__window_width, __window_height);
+ __reshape_window = false;
+ }
+ __ws->processEvents();
}
static void display(void) {
};
frame_complete();
if (double_buffer)
- glutSwapBuffers();
+ __drawable->swapBuffers();
else
glFlush();
-
- // Return now to allow GLUT to resize the window.
- delete call;
- return;
} else if (name == "glXMakeCurrent" ||
name == "wglMakeCurrent") {
glFlush();
if (!double_buffer) {
frame_complete();
- // Return now to allow GLUT to resize window.
- delete call;
- return;
}
} else {
continue;
}
if (__wait) {
- glutDisplayFunc(&display_noop);
- glutIdleFunc(NULL);
+ while (__ws->processEvents()) {}
} else {
exit(0);
}
}
-static void idle(void) {
- if (__reshape_window) {
- // XXX: doesn't quite work
- glutReshapeWindow(__window_width, __window_height);
- __reshape_window = false;
- }
- glutPostRedisplay();
-}
-
static void usage(void) {
std::cout <<
"Usage: glretrace [OPTION] TRACE\n"
}
}
- glutInit(&argc, argv);
- glutInitWindowPosition(0, 0);
- glutInitWindowSize(__window_width, __window_height);
- glutInitDisplayMode(GLUT_DEPTH | GLUT_RGB | (double_buffer ? GLUT_DOUBLE : GLUT_SINGLE));
- glutCreateWindow(argv[0]);
-
- glutDisplayFunc(&display);
- glutIdleFunc(&idle);
+ __ws = glws::createNativeWindowSystem();
+ __visual = __ws->createVisual(double_buffer);
+ __drawable = __ws->createDrawable(__visual);
+ __drawable->resize(__window_width, __window_height);
+ __context = __ws->createContext(__visual);
+ __ws->makeCurrent(__drawable, __context);
- for (GLuint h = 0; h < 1024; ++h) {
- __list_map[h] = h;
- }
-
for ( ; i < argc; ++i) {
if (parser.open(argv[i])) {
__startTime = OS::GetTime();
- glutMainLoop();
+ display();
parser.close();
}
}