Hi, sorry for the delayed reply.
I downloaded and applied the patch, using the minGW patch tool. There were no Problems except for one file, ./RenderSystems/GL/src/GLX/OgreGLXWindow.cpp.
The output of the patching process you might be interessted in:
Code: Select all
Hunk #1 succeeded at 66 with fuzz 2 (offset -5 lines).
Hunk #2 succeeded at 621 (offset -26 lines).
Hunk #7 FAILED at 374.
Hunk #8 succeeded at 402 (offset 7 lines).
Hunk #9 FAILED at 455.
2 out of 9 hunks FAILED -- saving rejects to ./RenderSystems/GL/src/GLX/OgreGLXWindow.cpp.rej
Anyway, here is the output of the OgreGLXWindows.cpp.rej:
Code: Select all
***************
*** 363,378 ****
mContext = new GLXContext(mDisplay, mWindow, mGlxContext);
}
void GLXWindow::destroy(void)
{
- // Unregister and destroy OGRE GLContext
- delete mContext;
- // Destroy GL context
if(mGlxContext)
glXDestroyContext(mDisplay, mGlxContext);
if(mWindow)
XDestroyWindow(mDisplay, mWindow);
mWindow = 0;
mGlxContext = 0;
mActive = false;
--- 374,393 ----
mContext = new GLXContext(mDisplay, mWindow, mGlxContext);
}
+ //-------------------------------------------------------------------------------------------------//
void GLXWindow::destroy(void)
{
+ // Unregister and destroy OGRE GLContext
+ delete mContext;
+ // Destroy GL context
if(mGlxContext)
glXDestroyContext(mDisplay, mGlxContext);
+
if(mWindow)
XDestroyWindow(mDisplay, mWindow);
+
+ mContext = 0;
mWindow = 0;
mGlxContext = 0;
mActive = false;
***************
*** 434,546 ****
break;
case ConfigureNotify:
if(event.xconfigure.display != mDisplay || event.xconfigure.window != mWindow)
- // Not for me
break;
- resized(event.xconfigure.width, event.xconfigure.height);
break;
case MapNotify:
if(event.xconfigure.display != mDisplay || event.xconfigure.window != mWindow)
- // Not for me
break;
// Window was mapped to the screen
- exposed(true);
break;
case UnmapNotify:
if(event.xconfigure.display != mDisplay || event.xconfigure.window != mWindow)
- // Not for me
break;
// Window was unmapped from the screen (user switched
// to another workspace, for example)
- exposed(false);
break;
}
}
- void GLXWindow::exposed(bool active)
- {
- mActive = active;
- }
void GLXWindow::resized(size_t width, size_t height)
{
- // Check if the window size really changed
- if(mWidth == width && mHeight == height)
- return;
- mWidth = width;
- mHeight = height;
-
- for (ViewportList::iterator it = mViewportList.begin();
- it != mViewportList.end(); ++it) {
- (*it).second->_updateDimensions();
- }
- }
- /// Pure virtual destructor must be defined
- GLXWindowInterface::~GLXWindowInterface()
- {
}
void GLXWindow::getCustomAttribute( const String& name, void* pData )
{
- if( name == "GLCONTEXT" ) {
- *static_cast<GLXContext**>(pData) = mContext;
- return;
- } else if( name == "GLXWINDOW" ) {
*static_cast<Window*>(pData) = mWindow;
return;
- } else if( name == "GLXDISPLAY" ) {
*static_cast<Display**>(pData) = mDisplay;
return;
- } else if( name == "GLXWINDOWINTERFACE" ) {
- *static_cast<GLXWindowInterface**>(pData) = this;
- return;
}
}
-
-
void GLXWindow::writeContentsToFile(const String& filename)
{
- ImageCodec::ImageData* imgData = new ImageCodec::ImageData;
- imgData->width = mWidth;
- imgData->height = mHeight;
- imgData->format = PF_BYTE_RGB;
-
- // Allocate buffer
- uchar* pBuffer = new uchar[mWidth * mHeight * 3];
-
- // Read pixels
- // I love GL: it does all the locking & colour conversion for us
- glReadPixels(0,0, mWidth-1, mHeight-1, GL_RGB, GL_UNSIGNED_BYTE, pBuffer);
-
- // Wrap buffer in a memory stream
- DataStreamPtr stream(new MemoryDataStream(pBuffer, mWidth * mHeight * 3, false));
-
- // Need to flip the read data over in Y though
- Image img;
- img.loadRawData(stream, mWidth, mHeight, PF_BYTE_RGB );
- img.flipAroundX();
-
- MemoryDataStreamPtr streamFlipped(new MemoryDataStream(img.getData(), stream->size(), false));
-
- // Get codec
- size_t pos = filename.find_last_of(".");
- String extension;
- if( pos == String::npos )
- OGRE_EXCEPT(
- Exception::ERR_INVALIDPARAMS,
- "Unable to determine image type for '" + filename + "' - invalid extension.",
- "SDLWindow::writeContentsToFile" );
-
- while( pos != filename.length() - 1 )
- extension += filename[++pos];
-
- // Get the codec
- Codec * pCodec = Codec::getCodec(extension);
-
- // Write out
- Codec::CodecDataPtr codecDataPtr(imgData);
- pCodec->codeToFile(streamFlipped, filename, codecDataPtr);
- delete [] pBuffer;
}
}
--- 455,560 ----
break;
case ConfigureNotify:
if(event.xconfigure.display != mDisplay || event.xconfigure.window != mWindow)
break;
+
+ resized(event.xconfigure.width, event.xconfigure.height);
break;
case MapNotify:
if(event.xconfigure.display != mDisplay || event.xconfigure.window != mWindow)
break;
+
// Window was mapped to the screen
+ mActive = true;
break;
case UnmapNotify:
if(event.xconfigure.display != mDisplay || event.xconfigure.window != mWindow)
break;
+
// Window was unmapped from the screen (user switched
// to another workspace, for example)
+ mActive = false;
break;
}
}
+ //-------------------------------------------------------------------------------------------------//
void GLXWindow::resized(size_t width, size_t height)
{
+ // Check if the window size really changed
+ if(mWidth == width && mHeight == height)
+ return;
+
+ mWidth = width;
+ mHeight = height;
+
+ for (ViewportList::iterator it = mViewportList.begin(); it != mViewportList.end(); ++it)
+ (*it).second->_updateDimensions();
}
+ //-------------------------------------------------------------------------------------------------//
void GLXWindow::getCustomAttribute( const String& name, void* pData )
{
+ if( name == "GLCONTEXT" )
+ {
+ *static_cast<GLXContext**>(pData) = mContext;
+ return;
+ }
+ else if( name == "GLXWINDOW" )
+ {
*static_cast<Window*>(pData) = mWindow;
return;
+ }
+ else if( name == "GLXDISPLAY" )
+ {
*static_cast<Display**>(pData) = mDisplay;
return;
}
}
+ //-------------------------------------------------------------------------------------------------//
void GLXWindow::writeContentsToFile(const String& filename)
{
+ ImageCodec::ImageData* imgData = new ImageCodec::ImageData;
+ imgData->width = mWidth;
+ imgData->height = mHeight;
+ imgData->format = PF_BYTE_RGB;
+
+ // Allocate buffer
+ uchar* pBuffer = new uchar[mWidth * mHeight * 3];
+
+ // Read pixels
+ // I love GL: it does all the locking & colour conversion for us
+ glReadPixels(0,0, mWidth-1, mHeight-1, GL_RGB, GL_UNSIGNED_BYTE, pBuffer);
+
+ // Wrap buffer in a memory stream
+ DataStreamPtr stream(new MemoryDataStream(pBuffer, mWidth * mHeight * 3, false));
+
+ // Need to flip the read data over in Y though
+ Image img;
+ img.loadRawData(stream, mWidth, mHeight, PF_BYTE_RGB );
+ img.flipAroundX();
+
+ MemoryDataStreamPtr streamFlipped(new MemoryDataStream(img.getData(), stream->size(), false));
+
+ // Get codec
+ size_t pos = filename.find_last_of(".");
+ String extension;
+ if( pos == String::npos )
+ OGRE_EXCEPT( Exception::ERR_INVALIDPARAMS, "Unable to determine image type for '"
+ + filename + "' - invalid extension.", "SDLWindow::writeContentsToFile" );
+
+ while( pos != filename.length() - 1 )
+ extension += filename[++pos];
+
+ // Get the codec
+ Codec * pCodec = Codec::getCodec(extension);
+
+ // Write out
+ Codec::CodecDataPtr codecDataPtr(imgData);
+ pCodec->codeToFile(streamFlipped, filename, codecDataPtr);
+ delete [] pBuffer;
}
}
+
I used the Ogre Build 1.0.6 to patch ageinst. And while I'm still stuck on a Windows machine right now, I recompiled the necessary files and as far as I can see everything runs fine, for a Win32 Platform.
Now, in my example above the run() method looks like:
Code: Select all
bool run()
{
Ogre::PlatformManager::getSingleton().messagePump(rWindow);
return !rWindow->isClosed();
}
Thanks a lot for that little piece of code.

This was quite was I was looking for.
Regards,
Baalzamon