Render to texture with 1 float x channel

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
mattneri
Posts: 3
Joined: Fri Sep 11, 2015 8:24 am

Render to texture with 1 float x channel

Post by mattneri »

Since we need to save some additional information we would like to render to a texture using the ECF_A32B32G32R32F color format. In this way we should have a float available for each channel.
I've created the render texture in this way:

Code: Select all

_renderTexture = _videoDriver->addRenderTargetTexture(irr::core::dimension2d<irr::u32>(dimension, dimension),"RTT", irr::video::ECF_A32B32G32R32F); 
My problem is the following: when I try to retrieve the floats by calling _renderTexture.lock() the texture data is using a ECF_A8R8G8B8 color format instead of the A32B32G32R32F
I'm using the OpenGl Driver.
The problem seems to be in the lock method of the class COpenGLTexture that creates an image using the A8R8G8B8 format and returns a pointer to it.

Is this functionality not supported at the moment by the opengl implementation or am I doing something wrong?
Is it supported by the D9x implementation?
hendu
Posts: 2600
Joined: Sat Dec 18, 2010 12:53 pm

Re: Render to texture with 1 float x channel

Post by hendu »

Not implemented.
mattneri
Posts: 3
Joined: Fri Sep 11, 2015 8:24 am

Re: Render to texture with 1 float x channel

Post by mattneri »

even by the directx implementation?
hendu
Posts: 2600
Joined: Sat Dec 18, 2010 12:53 pm

Re: Render to texture with 1 float x channel

Post by hendu »

I don't know, I only use GL. Code looks like it may work.
mattneri
Posts: 3
Joined: Fri Sep 11, 2015 8:24 am

Re: Render to texture with 1 float x channel

Post by mattneri »

Thanks hendu.
Yes with directx seems working fine.
CuteAlien
Admin
Posts: 9847
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Render to texture with 1 float x channel

Post by CuteAlien »

Yeah, I also just took a quick look and CD3D9Texture doesn't hardcode A8R8G8B8. Unfortunately no idea why OpenGL implementation does.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Nadro
Posts: 1648
Joined: Sun Feb 19, 2006 9:08 am
Location: Warsaw, Poland

Re: Render to texture with 1 float x channel

Post by Nadro »

Sorry, but I also don't know why we force ARGB8. Even in OGL ES2 we don't force this format.
Library helping with network requests, tasks management, logger etc in desktop and mobile apps: https://github.com/GrupaPracuj/hermes
REDDemon
Developer
Posts: 1044
Joined: Tue Aug 31, 2010 8:06 pm
Location: Genova (Italy)

Re: Render to texture with 1 float x channel

Post by REDDemon »

Do CImage allow reading writing "float" pixel values?
Junior Irrlicht Developer.
Real value in social networks is not about "increasing" number of followers, but about getting in touch with Amazing people.
- by Me
Post Reply