Page 1 of 1

RTT Problems in OSX

Posted: Sun Oct 14, 2007 11:51 am
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?

Posted: Sun Oct 14, 2007 5:10 pm
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.

Posted: Sun Oct 14, 2007 7:01 pm
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

Posted: Sun Oct 14, 2007 10:11 pm
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).

Posted: Fri Oct 19, 2007 8:47 am
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:

Posted: Fri Oct 19, 2007 4:32 pm
by hagenkaiser
could anyone else reproduce this problem now?

Posted: Wed Dec 12, 2007 8:01 pm
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?

Posted: Wed Dec 12, 2007 8:06 pm
by Falagard
Paladi, does it work in the Ogre examples?

Posted: Wed Dec 12, 2007 8:11 pm
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.

Posted: Wed Dec 12, 2007 8:29 pm
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?

Posted: Thu Dec 13, 2007 11:37 am
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

Posted: Thu Dec 13, 2007 10:56 pm
by sinbad
You need to make sure it's not happening in parallel with some other render, if this is a threaded system.

Posted: Fri Dec 14, 2007 6:52 pm
by Paladi
This is not a threaded system.

I will try the code in a linux or wndows system.

Posted: Sat Dec 15, 2007 12:01 am
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à

Posted: Sun Dec 16, 2007 7:04 pm
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?

Posted: Sun Dec 16, 2007 7:29 pm
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à

Posted: Sun Dec 30, 2007 3:08 pm
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.

Re: RTT Problems in OSX

Posted: Thu Oct 19, 2017 9:33 pm
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