Revision: 7789
http://playerstage.svn.sourceforge.net/playerstage/?rev=7789&view=rev
Author: natepak
Date: 2009-06-05 14:49:07 +0000 (Fri, 05 Jun 2009)
Log Message:
-----------
Update CMake to check for correct FreeImage version. Cleaned up Ogre Create
Window code
Modified Paths:
--------------
code/gazebo/trunk/CMakeLists.txt
code/gazebo/trunk/cmake/SearchForStuff.cmake
code/gazebo/trunk/server/rendering/OgreCamera.cc
code/gazebo/trunk/server/rendering/OgreCreator.cc
code/gazebo/trunk/server/rendering/OgreCreator.hh
Modified: code/gazebo/trunk/CMakeLists.txt
===================================================================
--- code/gazebo/trunk/CMakeLists.txt 2009-06-05 07:35:19 UTC (rev 7788)
+++ code/gazebo/trunk/CMakeLists.txt 2009-06-05 14:49:07 UTC (rev 7789)
@@ -30,7 +30,10 @@
CACHE INTERNAL "Gazebo controller sources list description" FORCE)
SET (OGRE_VERSION 1.6.1 CACHE INTERNAL "Ogre version requirement" FORCE)
-SET (FREEIMAGE_VERSION 3.11.0 CACHE INTERNAL "FreeImage version requirement"
FORCE)
+
+SET (FREEIMAGE_MAJOR_VERSION 3 CACHE INTERNAL "FreeImage major version
requirement" FORCE)
+SET (FREEIMAGE_MINOR_VERSION 10 CACHE INTERNAL "FreeImage minor version
requirement" FORCE)
+SET (FREEIMAGE_VERSION ${FREEIMAGE_MAJOR_VERSION}.${FREEIMAGE_MINOR_VERSION}.0
CACHE INTERNAL "FreeImage version requirement" FORCE)
SET (ODE_VERSION 0.10.1 CACHE INTERNAL "ODE version requirement" FORCE)
SET (MIN_BOOST_VERSION 1.35.0 CACHE INTERNAL "Boost min version requirement"
FORCE)
Modified: code/gazebo/trunk/cmake/SearchForStuff.cmake
===================================================================
--- code/gazebo/trunk/cmake/SearchForStuff.cmake 2009-06-05 07:35:19 UTC
(rev 7788)
+++ code/gazebo/trunk/cmake/SearchForStuff.cmake 2009-06-05 14:49:07 UTC
(rev 7789)
@@ -65,13 +65,28 @@
pkg_check_modules(FI freeimage>=${FREEIMAGE_VERSION})
IF (NOT FI_FOUND)
MESSAGE (STATUS "freeimage.pc not found, trying freeimage_include_dir and
freeimage_library_dir flags.")
+
FIND_PATH(freeimage_include_dir FreeImage.h ${freeimage_include_dir})
IF (NOT freeimage_include_dir)
MESSAGE (STATUS "Looking for FreeImage.h - not found")
MESSAGE (FATAL_ERROR "Unable to find FreeImage.h")
ELSE (NOT freeimage_include_dir)
- MESSAGE (STATUS "Looking for FreeImage.h - found")
+
+ # Check the FreeImage header for the right version
+ SET (testFreeImageSource
${CMAKE_CURRENT_BINARY_DIR}/CMakeTmp/test_freeimage.cc)
+ FILE (WRITE ${testFreeImageSource}
+ "#include <FreeImage.h>\nint main () { if (FREEIMAGE_MAJOR_VERSION
>= ${FREEIMAGE_MAJOR_VERSION} && FREEIMAGE_MINOR_VERSION >=
${FREEIMAGE_MINOR_VERSION}) return 1; else return 0;} \n")
+ TRY_RUN(FREEIMAGE_RUNS FREEIMAGE_COMPILES ${CMAKE_CURRENT_BINARY_DIR}
+ ${testFreeImageSource})
+ IF (NOT FREEIMAGE_RUNS)
+ MESSAGE (FATAL_ERROR "Invalid FreeImage Version. Requires
+ ${FREEIMAGE_VERSION}")
+ ELSE (NOT FREEIMAGE_RUNS)
+ MESSAGE (STATUS "Looking for FreeImage.h - found")
+ ENDIF (NOT FREEIMAGE_RUNS)
+
ENDIF (NOT freeimage_include_dir)
+
FIND_LIBRARY(freeimage_library freeimage ${freeimage_library_dir})
IF (NOT freeimage_library)
MESSAGE (STATUS "Looking for libfreeimage - not found")
@@ -79,6 +94,7 @@
ELSE (NOT freeimage_library)
MESSAGE (STATUS "Looking for libfreeimage - found")
ENDIF (NOT freeimage_library)
+
ELSE (NOT FI_FOUND)
APPEND_TO_CACHED_LIST(gazeboserver_include_dirs
${gazeboserver_include_dirs_desc}
Modified: code/gazebo/trunk/server/rendering/OgreCamera.cc
===================================================================
--- code/gazebo/trunk/server/rendering/OgreCamera.cc 2009-06-05 07:35:19 UTC
(rev 7788)
+++ code/gazebo/trunk/server/rendering/OgreCamera.cc 2009-06-05 14:49:07 UTC
(rev 7789)
@@ -255,46 +255,17 @@
Ogre::PixelFormat format = pixelBuffer->getFormat();
renderViewport = rTexture->getViewport(0);
- // std::cout << "Render viewport["
- // << renderViewport->getActualWidth() << " "
- // << renderViewport->getActualHeight() << "]\n";
-
size = Ogre::PixelUtil::getMemorySize((**this->imageSizeP).x,
(**this->imageSizeP).y,
1,
format);
- //size = this->imageSizeP->GetValue().x * this->imageSizeP->GetValue().y *
this->GetImageDepth();
- //printf("Size[%d] [%d]\n",size, this->imageSizeP->GetValue().x *
this->imageSizeP->GetValue().y * this->GetImageDepth());
-
// Allocate buffer
if (!this->saveFrameBuffer)
this->saveFrameBuffer = new unsigned char[size];
memset(this->saveFrameBuffer,128,size);
- /*pixelBuffer->lock(Ogre::HardwarePixelBuffer::HBL_READ_ONLY);
-
- int top = (int)((mBuffer->getHeight() - this->imageSizeP->GetValue().y) /
2.0);
- int left = (int)((mBuffer->getWidth() - this->imageSizeP->GetValue().x) /
2.0);
- int right = left + this->imageSizeP->GetValue().x;
- int bottom = top + this->imageSizeP->GetValue().y;
-
- // Get the center of the texture in RGB 24 bit format
- pixelBuffer->blitToMemory(
- Ogre::Box(left, top, right, bottom),
-
- Ogre::PixelBox(
- this->imageSizeP->GetValue().x,
- this->imageSizeP->GetValue().y,
- 1,
- this->imageFormat,
- this->saveFrameBuffer)
- );
-
- pixelBuffer->unlock();
- */
-
Ogre::PixelBox box((**this->imageSizeP).x, (**this->imageSizeP).y,
1, this->imageFormat, this->saveFrameBuffer);
Modified: code/gazebo/trunk/server/rendering/OgreCreator.cc
===================================================================
--- code/gazebo/trunk/server/rendering/OgreCreator.cc 2009-06-05 07:35:19 UTC
(rev 7788)
+++ code/gazebo/trunk/server/rendering/OgreCreator.cc 2009-06-05 14:49:07 UTC
(rev 7789)
@@ -607,7 +607,7 @@
if (flWindow)
{
- win = OgreCreator::CreateWindow( (long)fl_display, fl_visual->screen,
+ win = OgreCreator::CreateWindow( fl_display, fl_visual->screen,
(long)(Fl_X::i(flWindow)->xid), width, height);
if (win)
this->windows.push_back(win);
@@ -618,7 +618,7 @@
////////////////////////////////////////////////////////////////////////////////
// Create a window for Ogre
-Ogre::RenderWindow *OgreCreator::CreateWindow(long display, int screen,
+Ogre::RenderWindow *OgreCreator::CreateWindow(Display *display, int screen,
long winId, unsigned int width,
unsigned int height)
{
@@ -631,30 +631,21 @@
Ogre::NameValuePairList params;
Ogre::RenderWindow *window = NULL;
- std::string screenStr = DisplayString(display);
+ std::string screenStr = DisplayString((long)display);
std::string::size_type dotPos = screenStr.find(".");
screenStr = screenStr.substr(dotPos+1, screenStr.size());
int attrList[] = {GLX_RGBA, GLX_DOUBLEBUFFER, GLX_DEPTH_SIZE, 16,
GLX_STENCIL_SIZE, 8, None };
- XVisualInfo *vi = glXChooseVisual(fl_display, DefaultScreen(display),
+ XVisualInfo *vi = glXChooseVisual(display, DefaultScreen((long)display),
attrList);
XSync(fl_display, false);
- ogreHandle << (unsigned long)fl_display
+ ogreHandle << (unsigned long)display
<< ":" << screenStr
<< ":" << (unsigned long)winId
<< ":" << (unsigned long)vi;
- std::cout << "Ogre Handle[" << ogreHandle.str() << "]\n";
-
- /// As of Ogre 1.6 this is the params method that makes a resizable window
- /*params["externalWindowHandle"] = Ogre::StringConverter::toString(display)
+
- ":" + Ogre::StringConverter::toString(screen) +
- ":" + Ogre::StringConverter::toString(winId) +
- ":" + Ogre::StringConverter::toString(fl_visual);
- */
-
params["externalWindowHandle"] = ogreHandle.str();
params["FSAA"] = "2";
Modified: code/gazebo/trunk/server/rendering/OgreCreator.hh
===================================================================
--- code/gazebo/trunk/server/rendering/OgreCreator.hh 2009-06-05 07:35:19 UTC
(rev 7788)
+++ code/gazebo/trunk/server/rendering/OgreCreator.hh 2009-06-05 14:49:07 UTC
(rev 7789)
@@ -106,7 +106,7 @@
/// \brief Create a window for Ogre
- public: Ogre::RenderWindow *CreateWindow(long display,
+ public: Ogre::RenderWindow *CreateWindow(Display *display,
int screen,
long winId,
unsigned int width,
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
OpenSolaris 2009.06 is a cutting edge operating system for enterprises
looking to deploy the next generation of Solaris that includes the latest
innovations from Sun and the OpenSource community. Download a copy and
enjoy capabilities such as Networking, Storage and Virtualization.
Go to: http://p.sf.net/sfu/opensolaris-get
_______________________________________________
Playerstage-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-commit