[Mac] Ogre Framework 64 bit issue on SnowLeopard

A place for users of OGRE to discuss ideas and experiences of utilitising OGRE in their games / demos / applications.
Post Reply
viny
Gnoblar
Posts: 2
Joined: Wed Jul 28, 2010 1:21 pm

[Mac] Ogre Framework 64 bit issue on SnowLeopard

Post by viny »

Hi,

I have built Ogre as 64 bit Framework with help of the thread below
http://89.151.96.106/forums/viewtopic.php?f=4&t=52494
I am also facing the same problem while using it in an App , getting window full of noisy pixels .
I started debugging and didn't find any thing wrong with the Pixel format or OpenGL context for View .
Where it is going wrong I have no clue. :(
Any help will be appreciated .....thanks in advance.

11011001
Gnoblar
Posts: 12
Joined: Thu May 21, 2009 12:40 pm
Contact:

Re: [Mac] Ogre Framework 64 bit issue on SnowLeopard

Post by 11011001 »

I also managed to get everything to compile. I had to add lots of #ifndef __LP64__ macros to OgreOSXRenderTexture.cpp though. However, I also get a screen full of garbage pixels. Things work fine in 32-bit mode.

I am running 1.7.1

Any thoughts anyone?

Image

User avatar
masterfalcon
OGRE Team Member
OGRE Team Member
Posts: 4270
Joined: Sun Feb 25, 2007 4:56 am
Location: Bloomington, MN
x 126
Contact:

Re: [Mac] Ogre Framework 64 bit issue on SnowLeopard

Post by masterfalcon »

Do you get any errors in the log?

11011001
Gnoblar
Posts: 12
Joined: Thu May 21, 2009 12:40 pm
Contact:

Re: [Mac] Ogre Framework 64 bit issue on SnowLeopard

Post by 11011001 »

No errors that I can see. I have attached the log.

This is pure speculation perhaps this works on 32-bit, but not 64-bit? This is inside of my initializeOgre method.

Code: Select all

	// Build the param list for a embedded cocoa window...
	NameValuePairList misc;
	misc["macAPI"] = "cocoa";
	misc["externalWindowHandle"] = StringConverter::toString((size_t)ogreView);
Btw, the program does not crash. It just doesn't render anything.

Attached is my log.
Attachments
OgreLog.log.zip
OgreLog for the strange rendering.
(4.5 KiB) Downloaded 50 times

User avatar
masterfalcon
OGRE Team Member
OGRE Team Member
Posts: 4270
Joined: Sun Feb 25, 2007 4:56 am
Location: Bloomington, MN
x 126
Contact:

Re: [Mac] Ogre Framework 64 bit issue on SnowLeopard

Post by masterfalcon »

This line looks a bit suspicious. Maybe check the dimensions and depth of your view.

Code: Select all

16:22:11: GLRenderSystem::_createRenderWindow "OgreWindow6392960", 0x0 windowed  miscParams: externalWindowHandle=8596314752 macAPI=cocoa 

11011001
Gnoblar
Posts: 12
Joined: Thu May 21, 2009 12:40 pm
Contact:

Re: [Mac] Ogre Framework 64 bit issue on SnowLeopard

Post by 11011001 »

Ogre is not creating the window for me. Instead I am passing it an instance of OgreView from OgreOSXCocoaView.h. I create that instance myself. Looking at the code, the window size should be 0x0 in this case. I verified that the pointer Ogre got for the window is in fact an instance of OgreView. Everything there seems fine.

So, maybe the error arises somewhere in createRenderSystemCapabilities or initializeFromRenderSystemCapabilities in GLRenderSystem. Perhaps the patch applied from the thread starters link introduced a problem, or my own patches to OgreOSXRenderTexture.cpp (in order to get it to compile without Carbon).

Am I right in assuming OgreOSXRenderTexture shouldn't be used in a simple setup (light, camera, box)?

11011001
Gnoblar
Posts: 12
Joined: Thu May 21, 2009 12:40 pm
Contact:

Re: [Mac] Ogre Framework 64 bit issue on SnowLeopard

Post by 11011001 »

I tried passing the view size as follows:

Code: Select all

	
mRoot->createRenderWindow(windowName, frame.size.width, frame.size.height, false, &misc);
The Log now looks like this:

Code: Select all

GLRenderSystem::_createRenderWindow "OgreWindow6190048", 203x646 windowed  miscParams: externalWindowHandle=8595977184 macAPI=cocoa 
Creating a Cocoa Compatible Render System
It still does not work. It is the same as in my first screenshot. Has anyone got 1.7.1 working on 64-bit Snow Leopard?

jbendig
Gnoblar
Posts: 2
Joined: Sat Aug 28, 2010 8:19 pm

Re: [Mac] Ogre Framework 64 bit issue on SnowLeopard

Post by jbendig »

It still does not work. It is the same as in my first screenshot. Has anyone got 1.7.1 working on 64-bit Snow Leopard?
I got it working earlier today. What happens is the scissor box improperly cuts out everything at the beginning of each frame. I narrowed it down to the glGetIntegerv(GL_VIEWPORT,...) and glGetIntegerv(GL_SCISSOR_BOX,...) calls in GLRenderSystem::clearFrameBuffer() which were returning junk values. My hackish fix is to manually manage the viewport and scissor regions instead of querying OpenGL.

I only tested enough to draw an Ogre head mesh over a black background. Some other things may still be broken.
I setup the window by passing an OgreView, that was created with a nib, to root->createRenderWindow(...).

Code: Select all

OgreView* ogreView = ...;
Ogre::NameValuePairList misc;
misc["macAPI"] = Ogre::String("cocoa");
misc["externalWindowHandle"] = Ogre::StringConverter::toString((unsigned long)ogreView);
Ogre::RenderWindow* renderWindow = root->createRenderWindow("MainRenderWindow",WINDOW_WIDTH,WINDOW_HEIGHT,false,&misc);
Attached is my patch (modified from guyver6's originally posted in this thread.) that applies over Ogre 1.7.1. Apply the patch with "patch -p0 < ogre-1-7-1-cocoa64.patch"
Attachments
ogre-1-7-1-cocoa64.patch.zip
(2.8 KiB) Downloaded 89 times

User avatar
masterfalcon
OGRE Team Member
OGRE Team Member
Posts: 4270
Joined: Sun Feb 25, 2007 4:56 am
Location: Bloomington, MN
x 126
Contact:

Re: [Mac] Ogre Framework 64 bit issue on SnowLeopard

Post by masterfalcon »

Patches can get lost in the forums sometimes, could you post this to the patch tracker so it can be reviewed?

11011001
Gnoblar
Posts: 12
Joined: Thu May 21, 2009 12:40 pm
Contact:

Re: [Mac] Ogre Framework 64 bit issue on SnowLeopard

Post by 11011001 »

jbendig wrote: Attached is my patch (modified from guyver6's originally posted in this thread.) that applies over Ogre 1.7.1. Apply the patch with "patch -p0 < ogre-1-7-1-cocoa64.patch"
Wonderful! It's totally working. I applied your patch, tried it with a few different meshes, and everything seems happy! Excellent.

Thanks for the help!

I'll make sure to repay the community with a few Cocoa specific patches that I had not got around to submitting.

jbendig
Gnoblar
Posts: 2
Joined: Sat Aug 28, 2010 8:19 pm

Re: [Mac] Ogre Framework 64 bit issue on SnowLeopard

Post by jbendig »

11011001 wrote: Wonderful! It's totally working. I applied your patch, tried it with a few different meshes, and everything seems happy! Excellent.

Thanks for the help!

I'll make sure to repay the community with a few Cocoa specific patches that I had not got around to submitting.
I'm glad the patch was useful for someone else!

I'm putting off submitting the patch to the patch tracker for now. I was cleaning it up and found some more show stopping problems. Creating font textures from TTFs causes a texture to be created internally of size ~UINT_MAX by ~UINT_MAX. Snow Leopard is, of course, happy to allocate that using swap. :roll: It seems like the OpenGL context is not properly being set before drawing each frame. I hope to work on it more this weekend.

Post Reply