Multiple Render Targets support

Post those lines of code you feel like sharing or find what you require for your project here; or simply use them as tutorials.
Nadro
Posts: 1648
Joined: Sun Feb 19, 2006 9:08 am
Location: Warsaw, Poland

Post by Nadro »

I updated MRTs code. You can download it from:
http://nadro.net46.net/Patches/irrlicht ... port.patch

Now You can release MRTs by:
Driver->setMultipleRenderTargets(0);
instead of:
Driver->setMultipleRenderTargets([array with textures = 0]); // it also work
Library helping with network requests, tasks management, logger etc in desktop and mobile apps: https://github.com/GrupaPracuj/hermes
devsh
Competition winner
Posts: 2049
Joined: Tue Dec 09, 2008 6:00 pm
Location: UK
Contact:

Post by devsh »

I love you!

Is a patch file for some editor or do I have to edit by hand?
Nadro
Posts: 1648
Joined: Sun Feb 19, 2006 9:08 am
Location: Warsaw, Poland

Post by Nadro »

You can apply this patch by SVN eg. Turtoise ;)
Library helping with network requests, tasks management, logger etc in desktop and mobile apps: https://github.com/GrupaPracuj/hermes
devsh
Competition winner
Posts: 2049
Joined: Tue Dec 09, 2008 6:00 pm
Location: UK
Contact:

Post by devsh »

i guess i better do by hand


BIG PROBLEM cant compile OpenGL in 1.5 is there a workaround?

Code: Select all

R6/include -DIRRLICHT_EXPORTS=1 -c -o COpenGLDriver.o COpenGLDriver.cpp
COpenGLDriver.cpp: In member function ‘virtual bool irr::video::COpenGLDriver::setMultipleRenderTargets(irr::core::array<irr::video::ITexture*, irr::core::irrAllocator<irr::video::ITexture*> >, bool, bool, irr::video::SColor)’:
COpenGLDriver.cpp:2966: error: ‘extGlDrawBuffers’ was not declared in this scope
COpenGLDriver.cpp:2968: error: ‘CurrentTarget’ was not declared in this scope
COpenGLDriver.cpp:2968: error: ‘ERT_RENDER_TEXTURE’ was not declared in this scope
COpenGLDriver.cpp:2974: error: no match for ‘operator=’ in ‘((irr::video::COpenGLDriver*)this)->irr::video::COpenGLDriver::CurrentRendertargetSize = irr::core::dimension2d<unsigned int>(((const unsigned int&)((const unsigned int*)(&0u))), ((const unsigned int&)((const unsigned int*)(&0u))))’
../../include/dimension2d.h:18: note: candidates are: irr::core::dimension2d<int>& irr::core::dimension2d<int>::operator=(const irr::core::dimension2d<int>&)
COpenGLDriver.cpp:2975: error: ‘CurrentTarget’ was not declared in this scope
COpenGLDriver.cpp:2975: error: ‘ERT_FRAME_BUFFER’ was not declared in this scope
COpenGLDriver.cpp:2978: error: ‘clearBuffers’ was not declared in this scope
make: *** [COpenGLDriver.o] Error 1

actually i managed to eliminate extGlDrawBuffers by modding the openglextensionhandler

but still problems

So where is CurrentTarget defined and used in SVN and where that weird enumeration is, and lastly where the gently caress is the function clearbuffers()


ok add this to IVideoDriver.h in namespace video

Code: Select all

enum E_RENDER_TARGET
{
//! Render target is the main color frame buffer
ERT_FRAME_BUFFER=0,
//! Render target is the main color frame buffer
ERT_STEREO_LEFT_BUFFER=0,
//! Render target is a render texture
ERT_RENDER_TEXTURE,
//! Render target is the right color buffer (left is the main buffer)
ERT_STEREO_RIGHT_BUFFER,
//! Render to both stereo buffers at once
ERT_STEREO_BOTH_BUFFERS,
//! Auxiliary buffer 0
ERT_AUX_BUFFER0,
//! Auxiliary buffer 1
ERT_AUX_BUFFER1,
//! Auxiliary buffer 2
ERT_AUX_BUFFER2,
//! Auxiliary buffer 3
ERT_AUX_BUFFER3,
//! Auxiliary buffer 4
ERT_AUX_BUFFER4
};
btw nadro this bit is WRONG

Code: Select all

else
{
glViewport(0,0,ScreenSize.Width,ScreenSize.Height);
RenderTargetTexture = 0;
CurrentRendertargetSize = core::dimension2d<u32>(0,0);
CurrentTarget=ERT_FRAME_BUFFER;
}

It cannot be CurrentRendertargetSize = core::dimension2d<u32>(0,0);
cause the int is unsigned, has to signed


compiles the lib, but no poop RENDERS


stuff it I go with SVN
Nadro
Posts: 1648
Joined: Sun Feb 19, 2006 9:08 am
Location: Warsaw, Poland

Post by Nadro »

All work good, I tested it ;) You use wrong Irrlicht version or You wrong patching Your file.

Why You don't use edit function on forum? Please don't double posts... You can edit Your privious post.
Library helping with network requests, tasks management, logger etc in desktop and mobile apps: https://github.com/GrupaPracuj/hermes
BlindSide
Admin
Posts: 2821
Joined: Thu Dec 08, 2005 9:09 am
Location: NZ!

Post by BlindSide »

Merged the 5 consecutive posts and added code tags :P
ShadowMapping for Irrlicht!: Get it here
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
Nadro
Posts: 1648
Joined: Sun Feb 19, 2006 9:08 am
Location: Warsaw, Poland

Post by Nadro »

FP RT textures are merged with Irrlicht core now, thanks for BlindSide :) I also updated MRTs code to rev2402 of Irrlicht. Link is avaiable in first post ;)
Library helping with network requests, tasks management, logger etc in desktop and mobile apps: https://github.com/GrupaPracuj/hermes
devsh
Competition winner
Posts: 2049
Joined: Tue Dec 09, 2008 6:00 pm
Location: UK
Contact:

Post by devsh »

it seems that if you set more than one MRT the ones after the first one arent freed . I.e. in my engine i do deffered shading and I use 4 MRTs and I cannot use more than 1 texture on any material and it has to be set on the texture index no 0

EDIT: well the thing is that lets say I have a diffuse texture and I have a cube scene node... If the diffuse texture is at index 1 of screenquad and normal map of the cube is at 1 as well and I try to render it all... The diffuse freezes whenever the cube is rendered.

I looked at the source and it looks to not unbindRTT of the MRTs after the first one... but I totally dont get how it works when no cubes are rendered. I am not competent enough to fix your code... please make a quick fix.

this is what happens only to the first tex
glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, getSize().Width, getSize().Height)

P.S. Or Is it my fault... what should I avoid doing with RTTs and MRTs???
Post Reply