Screen Garbage on OSX Cocoa Build

Anything and everything that's related to OGRE or the wider graphics field that doesn't fit into the other forums.
Post Reply
jdiogo
Gnoblar
Posts: 17
Joined: Wed Nov 10, 2010 6:08 pm

Screen Garbage on OSX Cocoa Build

Post by jdiogo »

Hi!

When launching a Cocoa (32 and 64 bits) application that uses the latest Ogre 1.7.3 the Ogre window displays garbage for a while with the GPU buffer contents as in the screenshot attached. Tried calling Viewport->clear and RenderSystem->clearFrameBuffer without effect.
Since this doesn't happen with the Windows build, it doesn't seem "by design" and maybe it could be fixed in the future?
Best regards,

Jorge
Attachments
Untitled 2.jpg
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: Screen Garbage on OSX Cocoa Build

Post by masterfalcon »

Would you be able to try with the latest code in the 1.7 branch to see if the issue still exists? I suspect that it does, but I just want to be sure.
jdiogo
Gnoblar
Posts: 17
Joined: Wed Nov 10, 2010 6:08 pm

Re: Screen Garbage on OSX Cocoa Build

Post by jdiogo »

It's been a while now - I've compiled 1.7.3 from source and the screen garbage magically went away.
Later on, updating to the 1.7.4 and 1.8.0 SDKs, garbage is back again. Just recently I learned that the 1.7.3 build I though was fine is also displaying garbage on other GPUs.

This is what I've been able to find:
1) It happens on renderOneFrame-style rendering to an external window in Cocoa.
2) A call to RenderWindow->windowMovedOrResized() is issued before rendering starts.
3) Garbage is displayed in the first call to root->renderOneFrame(), the next calls all render fine.

For now I'm calling renderOneFrame twice on the initial frame, in order for the garbage to show far as little time as possible but of course it's still somewhat noticeable.

Any suggestions on things I could try to make this go away?

Thanks and Best Regards,

Jorge
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: Screen Garbage on OSX Cocoa Build

Post by masterfalcon »

A sample project to demonstrate the issue might be best.
jdiogo
Gnoblar
Posts: 17
Joined: Wed Nov 10, 2010 6:08 pm

Re: Screen Garbage on OSX Cocoa Build

Post by jdiogo »

Hi!

I prepared an Xcode 4.3 sample project showing the problem, it's available here:
http://pixplant.com/lab/wxWidgetsAndOgre-local.zip

It uses wxWidgets - all the necessary libs and headers are inside the external/ sub-folder and set in the project.
You'll need however to add your Ogre.framework and the RenderSystem_GL.dylib to the project, and change the "Header Search Paths" in the Build Settings to your Ogre SDK.

Build and run it and press the button at the bottom to see the garbage displayed on the first call to renderOneFrame(). Press more times and it renders fine thereafter.

Thanks for looking into this - best regards,

Jorge
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: Screen Garbage on OSX Cocoa Build

Post by masterfalcon »

Thanks for your test program. It made testing this very easy. I've found a fix and I'll commit it to the 1.8 branch soon. This is actually a bug that I've been chasing for a while.
jdiogo
Gnoblar
Posts: 17
Joined: Wed Nov 10, 2010 6:08 pm

Re: Screen Garbage on OSX Cocoa Build

Post by jdiogo »

Great to know that! Could you kindly post here when you submit the fix?

Hopefully this bug is the same as another one which I haven't been able to reproduce so far and have only learned from user reports: visually-similar garbage randomly appears on the 3D rendering area and in one case it even appears outside the rendering area in the surrounding UI. But I could never reproduce this problem in the hardware I have access to - fingers crossed that it could be the one you are now fixing!

Best Regards,

Jorge
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: Screen Garbage on OSX Cocoa Build

Post by masterfalcon »

Sure thing! I pushed the change last night.
jdiogo
Gnoblar
Posts: 17
Joined: Wed Nov 10, 2010 6:08 pm

Re: Screen Garbage on OSX Cocoa Build

Post by jdiogo »

Hi!

I pulled the 1.8 branch after your submission ( https://bitbucket.org/sinbad/ogre/chang ... 9ac107878a ) and built from there, however the problem still occurs as before in the project I've sent.
I've double-checked that the downloaded OgreOSXCocoaWindow.mm contains your changes and that there no confusions with old libs being linked and did a clean build - but garbage is still displayed...
Best Regards,

Jorge
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: Screen Garbage on OSX Cocoa Build

Post by masterfalcon »

Hmm, it worked for me. I'll have to check it out again.
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: Screen Garbage on OSX Cocoa Build

Post by masterfalcon »

Ok, I think I've got it for real this time.
jdiogo
Gnoblar
Posts: 17
Joined: Wed Nov 10, 2010 6:08 pm

Re: Screen Garbage on OSX Cocoa Build

Post by jdiogo »

Hi masterfalcon,

I'm sorry for bringing bad news but after downloading the v1-8 branch with your latest changes, it's still displaying garbage in the first frame, tested in a GeForce 9400M.
I compiled the above example project with this latest v1-8 branch, maybe it helps:
http://www.pixplant.com/lab/App.app.zip

Regards,

Jorge
marchingcubes
Kobold
Posts: 35
Joined: Sun Jul 26, 2009 10:19 am

Re: Screen Garbage on OSX Cocoa Build

Post by marchingcubes »

i get around this issue by issuing a call to 'windowMovedOrResized' on the window the cocoa setup code creates - here ov is my OgreView subclass that I have setup in a NIB file. Possibly this will help?

Code: Select all

    // Ask for a new window passing in the ogreView in our nib file
    Ogre::NameValuePairList misc;
    misc["macAPI"]="cocoa";
    Ogre::String windowHandle=Ogre::StringConverter::toString((size_t)ov);
    misc["externalWindowHandle"]=windowHandle;
    ogreRoot->createRenderWindow("3D View", 0, 0, false, &misc);
    mWindow = [ov ogreWindow];

    mWindow->windowMovedOrResized();

jdiogo
Gnoblar
Posts: 17
Joined: Wed Nov 10, 2010 6:08 pm

Re: Screen Garbage on OSX Cocoa Build

Post by jdiogo »

Thanks for the suggestion. I tried in the example above, adding the call to windowMovedOrResized() immediately after calling createRenderWindow() but the behavior is the same: garbage is always displayed in the first frame. Possibly it doesn't work here because the context is different: the external window is not created via a NIB but by wxWidgets...

Best regards,

Jorge
User avatar
Wolfmanfx
OGRE Team Member
OGRE Team Member
Posts: 1525
Joined: Fri Feb 03, 2006 10:37 pm
Location: Austria - Leoben
x 99
Contact:

Re: Screen Garbage on OSX Cocoa Build

Post by Wolfmanfx »

This is fixed now in 1.9 (latest)
Post Reply