|
From: <bru...@us...> - 2009-02-22 10:56:24
|
Revision: 155
http://freepv.svn.sourceforge.net/freepv/?rev=155&view=rev
Author: brunopostle
Date: 2009-02-22 10:56:20 +0000 (Sun, 22 Feb 2009)
Log Message:
-----------
re-apply svn116 & svn117 (Pablo d'Angelo):
fixed include problems with GL/glut.h, do not require header files
for video mode switching, currently unused anyway.
abort compilation if no glut has been found
Modified Paths:
--------------
freepv/trunk/CMakeLists.txt
freepv/trunk/src/config.h.in.cmake
freepv/trunk/src/freepv-glut/freepv-glut.cpp
freepv/trunk/src/freepv-glut/glut_platform.cpp
freepv/trunk/src/freepv-glx/glx_platform.cpp
freepv/trunk/src/freepv-glx/glx_platform.h
Modified: freepv/trunk/CMakeLists.txt
===================================================================
--- freepv/trunk/CMakeLists.txt 2009-01-02 17:43:54 UTC (rev 154)
+++ freepv/trunk/CMakeLists.txt 2009-02-22 10:56:20 UTC (rev 155)
@@ -24,6 +24,7 @@
project (FreePV)
include(CheckFunctionExists)
+if(WIN32)
IF(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
MESSAGE(FATAL_ERROR "CMake generation for freepv is not allowed within the source directory!
Remove the CMakeCache.txt file and try again from another folder, e.g.:
@@ -35,6 +36,7 @@
cmake ../branch_leonox
")
ENDIF(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
+endif(WIN32)
#Check requiered cmake version
cmake_minimum_required(VERSION 2.4.0)
@@ -133,6 +135,7 @@
CHECK_INCLUDE_FILE(GL/freeglut.h HAVE_FREEGLUT_H)
CHECK_INCLUDE_FILE(GL/glut.h HAVE_GLUT_H)
CHECK_INCLUDE_FILE(GLUT/glut.h HAVE_OSXGLUT_H)
+ CHECK_INCLUDE_FILE(X11/extensions/xf86vmode.h HAVE_XF86VMODE_H)
endif(WIN32)
# create config.h file
@@ -154,6 +157,9 @@
"/testcases/"
"/cmake_install\\\\.cmake"
"/CMakeCache.txt$"
+"/CMakeOutput.log$"
+"/CPackConfig.cmake$"
+"/CPackSourceConfig.cmake$"
"\\\\.dir/"
"\\\\.tar\\\\.gz$"
"\\\\.tar\\\\.Z$"
Modified: freepv/trunk/src/config.h.in.cmake
===================================================================
--- freepv/trunk/src/config.h.in.cmake 2009-01-02 17:43:54 UTC (rev 154)
+++ freepv/trunk/src/config.h.in.cmake 2009-02-22 10:56:20 UTC (rev 155)
@@ -15,6 +15,9 @@
/* Define to 1 if X11 was found */
#cmakedefine MOZ_X11 1
+/* Define to 1 if XF86vmode.h include was found */
+#cmakedefine HAVE_XF86VMODE_H 1
+
/* Define to 1 if you have are under Unix */
#cmakedefine XP_UNIX 1
Modified: freepv/trunk/src/freepv-glut/freepv-glut.cpp
===================================================================
--- freepv/trunk/src/freepv-glut/freepv-glut.cpp 2009-01-02 17:43:54 UTC (rev 154)
+++ freepv/trunk/src/freepv-glut/freepv-glut.cpp 2009-02-22 10:56:20 UTC (rev 155)
@@ -33,8 +33,10 @@
#include <GLUT/glut.h>
#elif defined HAVE_FREEGLUT_H
#include <GL/freeglut.h>
+#elif defined HAVE_GLUT_H
+#include <GL/glut.h>
#else
-#include <GL/glut.h>
+#error "GLUT or freeglut not found, and configure (or cmake) checks failed"
#endif
#include <vector>
Modified: freepv/trunk/src/freepv-glut/glut_platform.cpp
===================================================================
--- freepv/trunk/src/freepv-glut/glut_platform.cpp 2009-01-02 17:43:54 UTC (rev 154)
+++ freepv/trunk/src/freepv-glut/glut_platform.cpp 2009-02-22 10:56:20 UTC (rev 155)
@@ -30,10 +30,15 @@
#ifdef _WIN32
#define FREEGLUT_STATIC
#endif
+
#ifdef HAVE_OSXGLUT_H
#include <GLUT/glut.h>
+#elif defined HAVE_FREEGLUT_H
+#include <GL/freeglut.h>
+#elif defined HAVE_GLUT_H
+#include <GL/glut.h>
#else
-#include <GL/freeglut.h>
+#error "GLUT automake/cmake check failed"
#endif
#ifdef HAVE_GETTIMEOFDAY
Modified: freepv/trunk/src/freepv-glx/glx_platform.cpp
===================================================================
--- freepv/trunk/src/freepv-glx/glx_platform.cpp 2009-01-02 17:43:54 UTC (rev 154)
+++ freepv/trunk/src/freepv-glx/glx_platform.cpp 2009-02-22 10:56:20 UTC (rev 155)
@@ -224,8 +224,10 @@
int dpyWidth, dpyHeight;
int i;
int glxMajorVersion, glxMinorVersion;
+#ifdef HAVE_XF86VMODE_H
int vidModeMajorVersion, vidModeMinorVersion;
XF86VidModeModeInfo **modes;
+#endif
int modeNum;
int bestMode;
Atom wmDelete;
@@ -238,6 +240,7 @@
/* get a connection */
m_glwin.dpy = XOpenDisplay(0);
m_glwin.screen = DefaultScreen(m_glwin.dpy);
+#ifdef HAVE_XF86VMODE_H
XF86VidModeQueryVersion(m_glwin.dpy, &vidModeMajorVersion,
&vidModeMinorVersion);
printf("XF86VidModeExtension-Version %d.%d\n", vidModeMajorVersion,
@@ -253,6 +256,7 @@
bestMode = i;
}
}
+#endif
/* get an appropriate visual */
vi = glXChooseVisual(m_glwin.dpy, m_glwin.screen, attrListDbl);
if (vi == NULL)
@@ -274,6 +278,7 @@
m_glwin.attr.colormap = cmap;
m_glwin.attr.border_pixel = 0;
+#ifdef HAVE_XF86VMODE_H
if (m_glwin.fs)
{
XF86VidModeSwitchToMode(m_glwin.dpy, m_glwin.screen, modes[bestMode]);
@@ -300,6 +305,7 @@
}
else
{
+#endif
/* create a window in window mode*/
m_glwin.attr.event_mask = ExposureMask | KeyPressMask | KeyReleaseMask | ButtonPressMask |
ButtonReleaseMask | ButtonMotionMask | StructureNotifyMask | PointerMotionMask;
@@ -312,7 +318,10 @@
XSetStandardProperties(m_glwin.dpy, m_glwin.win, title,
title, None, NULL, 0, NULL);
XMapRaised(m_glwin.dpy, m_glwin.win);
+#ifdef HAVE_XF86VMODE_H
}
+#endif
+
/* connect the glx-context to the window */
glXMakeCurrent(m_glwin.dpy, m_glwin.win, m_glwin.ctx);
XGetGeometry(m_glwin.dpy, m_glwin.win, &winDummy, &m_glwin.x, &m_glwin.y,
@@ -364,11 +373,13 @@
m_glwin.ctx = NULL;
}
/* switch back to original desktop resolution if we were in fs */
+#ifdef HAVE_XF86VMODE_H
if (m_glwin.fs)
{
XF86VidModeSwitchToMode(m_glwin.dpy, m_glwin.screen, &m_glwin.deskMode);
XF86VidModeSetViewPort(m_glwin.dpy, m_glwin.screen, 0, 0);
}
+#endif
XCloseDisplay(m_glwin.dpy);
}
Modified: freepv/trunk/src/freepv-glx/glx_platform.h
===================================================================
--- freepv/trunk/src/freepv-glx/glx_platform.h 2009-01-02 17:43:54 UTC (rev 154)
+++ freepv/trunk/src/freepv-glx/glx_platform.h 2009-02-22 10:56:20 UTC (rev 155)
@@ -32,7 +32,9 @@
#include <GL/glx.h>
#include <GL/gl.h>
#include <GL/glu.h>
+#ifdef HAVE_XF86VMODE_H
#include <X11/extensions/xf86vmode.h>
+#endif
#include <X11/keysym.h>
@@ -71,7 +73,9 @@
GLXContext ctx;
XSetWindowAttributes attr;
bool fs;
+#ifdef HAVE_XF86VMODE_H
XF86VidModeModeInfo deskMode;
+#endif
int x, y;
unsigned int width, height;
unsigned int depth;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|