Topic: Is there a way to send texture to uniform shader variable?

Hi, im trying to implement water and i'm looking for a way to render scene from camera for reflection. Maybe someone can help me with code sample c++ if any exists.
There is a function:

virtual void MRenderingContext::sendTextureImage(MImage *image, bool mipMap, bool filter, bool compress)=0;

But it takes a MImage as parameter. Is there a way to convert to MImage like

MTextureRef * colorTexture = camera->getRenderColorTexture();

Last edited by Skywriter (2014-07-20 07:49:45)

Re: Is there a way to send texture to uniform shader variable?

It's already a texture, you don't need to send it again to the rendering context.
You don't even need to send it manually to the shader :

- reserve a texture slot in blender for your reflection texture, link a dummy texture for example "water-reflexion-dummy.jpg"
http://www.maratis3d.com/wp-content/uploads/2011/01/06.jpg

- in script call "enableRenderToTexture" using the dummy texture name "water-reflexion-dummy.jpg"
http://wiki.maratis3d.org/index.php?tit … rToTexture

- in your shader use the texture slot using the dummy texture

Re: Is there a way to send texture to uniform shader variable?

Thanks for advice anael. I'l try to work with that.