]> git.cworth.org Git - apitrace/commitdiff
Merge branch 'master' into noglut
authorJosé Fonseca <jose.r.fonseca@gmail.com>
Sat, 9 Apr 2011 15:06:05 +0000 (16:06 +0100)
committerJosé Fonseca <jose.r.fonseca@gmail.com>
Sat, 9 Apr 2011 15:06:05 +0000 (16:06 +0100)
Conflicts:
CMakeLists.txt

1  2 
CMakeLists.txt
glretrace.py

diff --combined CMakeLists.txt
index f6802e39be791adb04b018a2155253f95c71087d,868bc9033fd2b45a95a2a8eef229033cdf1fc9bd..506325e0a8956ffb5d1388252f3ae0b6986ab900
@@@ -28,6 -28,8 +28,6 @@@ else (NOT WIN32
      find_package (DirectX)
  endif (NOT WIN32)
  
 -find_package (GLUT)
 -
  if (WIN32)
      # MSVC & MinGW only define & use APIENTRY
      add_definitions (-DGLAPIENTRY=__stdcall)
@@@ -186,19 -188,13 +186,15 @@@ else (
      )
  
      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)
diff --combined glretrace.py
index 312c9a32c5ea868bc242d5756576f8c05f53d248,31058a2f2e0ce883287f9a53131234eac5407516..450ce7dd19d215648daddaf860321013455f8989
@@@ -167,11 -167,10 +167,9 @@@ if __name__ == '__main__'
  #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;
@@@ -240,10 -239,9 +238,10 @@@ checkGlError(void) 
      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"
  
@@@ -290,14 -288,7 +288,14 @@@ static void frame_complete(void) 
              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"
@@@ -421,21 -429,19 +419,17 @@@ int main(int argc, char **argv
          }
      }
  
 -    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();
          }
      }