RTT Problems in OSX

Discussion area about developing or extending OGRE, adding plugins for it or building applications on it. No newbie questions please, use the Help forum for that.
hagenkaiser
Kobold
Posts: 33
Joined: Tue May 01, 2007 11:21 am

RTT Problems in OSX

Post by hagenkaiser »

I watched this problem the first time i tried to use the pagedgeomtry source on OSX. But I think this problem is a general OSX-Problem.

In this source there a parts of scene rendered to a texture. The texure is then written to an image - file.
The problem is. Those files appear to be corrupted by total noise.
I insprected the code and I couldnt find an error. The renderTarget should get cleared (by autocleareveryframe) and then the scen is rendered (by update)

I know there are working examples of rendering to a texture on OSX. And they work for me as well. But they are all using a projective camera.

maybe somone knows a hint?
User avatar
sinbad
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 19269
Joined: Sun Oct 06, 2002 11:19 pm
Location: Guernsey, Channel Islands
x 66

Post by sinbad »

Whether the RTT is used by a projective camera later or not doesn't affect the actual rendering of them. So if you have examples that work there must be some difference.

Check what RTT mode you're using. 'Copy' mode for example can't render to RTTs that are bigger than the main render window in any dimension, only PBO or FBO can.
hagenkaiser
Kobold
Posts: 33
Joined: Tue May 01, 2007 11:21 am

Post by hagenkaiser »

Well johnj who is devloping pagedgeometry told me he thinks that this must be an osx problem. As hes not supporting OSX directly anymore, I wanted to find the possible bug myself.
will work a little bit with it and tell if i find something
User avatar
JohnJ
OGRE Expert User
OGRE Expert User
Posts: 975
Joined: Thu Aug 04, 2005 4:14 am
Location: Santa Clara, California
x 4

Post by JohnJ »

I'm not sure what's going on, but since the PagedGeometry impostor renderer works fine in all DX9 and OpenGL (all RTT modes), I assumed it's either a driver or an OS issue.

The problem could be related to the fact that PagedGeometry renders about 32 different times to the same render texture, using different viewport coordinates (to produce several rows and columns of images, all rendered from various angles).
starbug
Halfling
Posts: 56
Joined: Wed Jan 24, 2007 7:06 pm
Location: Germany

Post by starbug »

When I tried PagedGeometry about two months ago everything worked fine, so it must be something with the changes made since then, or maybe the latest OSX update (10.4.10).

Don't know if this information is worth anything though :wink:
hagenkaiser
Kobold
Posts: 33
Joined: Tue May 01, 2007 11:21 am

Post by hagenkaiser »

could anyone else reproduce this problem now?
Paladi
Kobold
Posts: 32
Joined: Mon Nov 19, 2007 6:24 pm
x 1

Post by Paladi »

I'm trying a simple RTT on OSX 10.5.1 and always when I run the rendertarget->update() the program crashes.

It could be that problem?
User avatar
Falagard
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 2060
Joined: Thu Feb 26, 2004 12:11 am
Location: Toronto, Canada
x 3

Post by Falagard »

Paladi, does it work in the Ogre examples?
Paladi
Kobold
Posts: 32
Joined: Mon Nov 19, 2007 6:24 pm
x 1

Post by Paladi »

The render to texture demo on the samples works fine.

But, that samples doesn't update the target manually, they load the texture on a material.
User avatar
sinbad
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 19269
Joined: Sun Oct 06, 2002 11:19 pm
Location: Guernsey, Channel Islands
x 66

Post by sinbad »

The RTT is still updated with the update() method, it's just done automatically. At what point are you calling this update() method?
Paladi
Kobold
Posts: 32
Joined: Mon Nov 19, 2007 6:24 pm
x 1

Post by Paladi »

I'm calling the update() method when the user click on a window (Those RTT is used for knowing the world coordinate of the point that the user mades the click, using a simple shader that writes the x,y,z coords on each texel).

I must have to call the update() method on the framestarted method?

Thanks
User avatar
sinbad
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 19269
Joined: Sun Oct 06, 2002 11:19 pm
Location: Guernsey, Channel Islands
x 66

Post by sinbad »

You need to make sure it's not happening in parallel with some other render, if this is a threaded system.
Paladi
Kobold
Posts: 32
Joined: Mon Nov 19, 2007 6:24 pm
x 1

Post by Paladi »

This is not a threaded system.

I will try the code in a linux or wndows system.
Paladi
Kobold
Posts: 32
Joined: Mon Nov 19, 2007 6:24 pm
x 1

Post by Paladi »

I have tried the same program (except the Qt GUI) in windows and it works!

is possible that the Qt interface produces problems on the RTT function? or... it's a OSX problem?

Thanks,
Adrià
User avatar
sinbad
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 19269
Joined: Sun Oct 06, 2002 11:19 pm
Location: Guernsey, Channel Islands
x 66

Post by sinbad »

I'm involved in a project which uses Qt right now and makes extensive use of render textures, and we don't have this problem, but this is on Windows right now. So it sounds like it's the combination of Qt and OSX?
Paladi
Kobold
Posts: 32
Joined: Mon Nov 19, 2007 6:24 pm
x 1

Post by Paladi »

I have tried the code witouth the Qt GUI on OSX and it also crashes. But, the Render To Texture Ogre Demo works fine for me.

Here I have modified the CameraTrack demo, after the scene creation I create the texture :

Code: Select all

	PixelFormat pixfmt = PF_FLOAT32_RGB;
			
			TexturePtr depthTexture = TextureManager::getSingleton().createManual("coord", ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,TEX_TYPE_2D,mWindow->getViewport(0)->getActualWidth(), mWindow->getViewport(0)->getActualHeight(),0, pixfmt, TU_RENDERTARGET);
			
			RenderTarget *rrTex = depthTexture->getBuffer()->getRenderTarget();
			
			
			rrTex->setAutoUpdated(false);   
			
			Camera* massDropletCam = mSceneMgr->createCamera("debugMassDropletCam");
			massDropletCam->setNearClipDistance(mCamera->getNearClipDistance());
			massDropletCam->setFarClipDistance(mCamera->getFarClipDistance());			
			massDropletCam->setAspectRatio((Real)mWindow->getViewport(0)->getActualWidth()/(Real)mWindow->getViewport(0)->getActualHeight());
			massDropletCam->setNearClipDistance(mCamera->getNearClipDistance());
			massDropletCam->setOrientation(mCamera->getOrientation());
			massDropletCam->setPosition(mCamera->getPosition()); 
			
			Viewport *v = rrTex->addViewport(massDropletCam);
			v->setClearEveryFrame(true);
			v->setBackgroundColour(Ogre::ColourValue::Black);
			v->setOverlaysEnabled (false); 
And .. When I want to update the texture I execute :

Code: Select all

rrTex -> update();
And in the update method it crashes.

In windows the same code works. There are something wrong in the code?

I think it would be a OSX problem... Probably this week I will try on Linux.

Thanks,
Adrià
starbug
Halfling
Posts: 56
Joined: Wed Jan 24, 2007 7:06 pm
Location: Germany

Post by starbug »

Code: Select all

TexturePtr depthTexture = TextureManager::getSingleton().createManual("coord", ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,TEX_TYPE_2D,mWindow->getViewport(0)->getActualWidth(), mWindow->getViewport(0)->getActualHeight(),0, pixfmt, TU_RENDERTARGET); 
You can't use screen-size textures in OSX, or at least I have never seen it work. Dimensions always have to be 2^x.

As far as I know Ogre should convert texture sizes to 2^x if non-power-of-two textures are not supported, but somehow it doesn't do this on OSX.
golgobot
Gnoblar
Posts: 18
Joined: Tue Oct 03, 2017 11:26 pm

Re: RTT Problems in OSX

Post by golgobot »

Hey, I'm still able to reproduce this crash on OSX. Has anyone solved this issue or is it still a bug?

Thanks