[SOLVED] Clipplanes in opengl

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!
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: [SOLVED] Clipplanes in opengl

Post by CuteAlien »

@Sinsemilla: irr::core::string::empty is only available in svn trunk, that was not yet in Irrlicht 1.7. So I guess you will have to install svn trunk for that (often the better choice anyway).
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
Sinsemilla
Posts: 38
Joined: Mon Jan 09, 2012 5:07 pm

Re: [SOLVED] Clipplanes in opengl

Post by Sinsemilla »

@CuteAlien: Thanks for the advice, by using the trunk the irr::core::string::empty errors are gone. :D

Unfortunately i still need a little bit help. The are 3 errors left which i don't really know what to do about. The compiler tells me that basically that the assingment operator for the class map can't be used. This happens in void CPostProcessManager::SwapAuxBuffers(), on this line of code:

Code: Select all

RenderTargetMap["auxIn"] = RenderTargetMap["auxOut"];
 
||=== RMLWars, Release ===|
irrMap.h||In member function ‘irr::core::map<const irr::core::string<char>, irr::video::ITexture*>::AccessClass& irr::core::map<const irr::core::string<char>, irr::video::ITexture*>::AccessClass::operator=(const irr::core::map<const irr::core::string<char>, irr::video::ITexture*>::AccessClass&)’:|
irrMap.h|631|error: non-static reference member ‘irr::core::map<const irr::core::string<char>, irr::video::ITexture*>& irr::core::map<const irr::core::string<char>, irr::video::ITexture*>::AccessClass::Tree’, can’t use default assignment operator|
irrMap.h|631|error: non-static reference member ‘const irr::core::string<char>& irr::core::map<const irr::core::string<char>, irr::video::ITexture*>::AccessClass::Key’, can’t use default assignment operator|
PostProcessManager.cpp||In member function ‘void CPostProcessManager::SwapAuxBuffers()’:|
PostProcessManager.cpp|53|note: synthesized method ‘irr::core::map<const irr::core::string<char>, irr::video::ITexture*>::AccessClass& irr::core::map<const irr::core::string<char>, irr::video::ITexture*>::AccessClass::operator=(const irr::core::map<const irr::core::string<char>, irr::video::ITexture*>::AccessClass&)’ first required here |
||=== Build finished: 3 errors, 0 warnings ===|
||=== Build finished: 3 errors, 0 warnings ===|

Anyway, many thanks in advance.
Last edited by Sinsemilla on Tue Nov 18, 2014 12:45 am, edited 1 time in total.
Sinsemilla
Posts: 38
Joined: Mon Jan 09, 2012 5:07 pm

Re: [SOLVED] Clipplanes in opengl

Post by Sinsemilla »

I could solve the problem by rewriting the line in SwapAuxBuffers :D.

In the meantime i compiled the little demo code. But somehow i have a weird water effect where the normalmap seem to shine through the surface looking like this:

Image

Also the distortion seems to be too strong during the underwater view:
Image
Image

I compiled the example on Linux, so it all about GLSL :wink: .
Sinsemilla
Posts: 38
Joined: Mon Jan 09, 2012 5:07 pm

Re: [SOLVED] Clipplanes in opengl

Post by Sinsemilla »

And btw: as you can see the sky has changed. I am using a skydome. However, i first compiled the example with a skybox, which had the same effect as result. I could be also important to say that the windows example executed through wine is looking identical to the first screenshots posted in this thread (therefore it is looking as expected since the skybox error is visible):

Image
Sinsemilla
Posts: 38
Joined: Mon Jan 09, 2012 5:07 pm

Re: [SOLVED] Clipplanes in opengl

Post by Sinsemilla »

I have a little guess: The only thing which is really different is the revision of the svn trunk, mine is probably never. @tbw which Rev. did you use for the example? i used rev. 4113.
Sinsemilla
Posts: 38
Joined: Mon Jan 09, 2012 5:07 pm

Re: [SOLVED] Clipplanes in opengl

Post by Sinsemilla »

After a little bit of trying i found out that the changes from rev 4105 to 4106 are causing the weird effect. So using rev 4105 is fine for me :)
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: [SOLVED] Clipplanes in opengl

Post by CuteAlien »

I just checked the part that map's can't do the "mymap["foo"] = mymap["bar"]" thing. The reason is that core::map returns some AccessClass instead of just a reference to T. But I don't think that was ever different - so your code probably should use std::map instead (and maybe some day someone finds motiviation to dig into core::map and figure out if there is any reason for that...).
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: [SOLVED] Clipplanes in opengl

Post by Nadro »

Hi, in a rev4106 we added support for an int uniforms and now in Your shader callback, You must bind a textures by int instead of float parameter, so eg:

Code: Select all

int Tex0 = 0;
dervices->setPixelShaderConstant("tex0", &Tex0, 1)0;
int Tex2 = 2;
dervices->setPixelShaderConstant("tex2", &Tex2, 1);
I think that we should add some note about this change (and improve example no. 10, because currently it usage wrong, floats type method). Bind a texture by a float interface caused problems on some machines (texture wasn't bind properly, but only in some cases, so was problematic for debugging and thats why I removed support for textures by a float interface and left only int interface for a textures).

BTW. In an OpenGL shader callback we use extGlGetUniformLocation call for an each setPixelShaderConstant call and this is serious fault (It can cause fps drop in an applications with many setPixelShaderConstant calls). In my opinion we should add a cache similar for this for vertex attribute locations in FVF stuff. For shaders, cache will be even simpler.
Library helping with network requests, tasks management, logger etc in desktop and mobile apps: https://github.com/GrupaPracuj/hermes
tbw
Posts: 59
Joined: Sat Jan 15, 2011 9:51 am
Location: Germany

Re: [SOLVED] Clipplanes in opengl

Post by tbw »

I used a rev earlier than 4106, because the new setPixelShaderConstant with int uniforms Nadro mentioned was not available.
I didn't notice the change though I look into this part of the code quite often.
@Sinsemilla: In which way did you change the swapAuxBuffer code (I want to change the code and upload a new version for the xml postproc framework)
I thing changing SwapAuxBuffers from

Code: Select all

void CPostProcessManager::SwapAuxBuffers()
{
        // swap the in and out buffers
        video::ITexture* tmp = RenderTargetMap["auxIn"];
        RenderTargetMap["auxIn"] = RenderTargetMap["auxOut"];
        RenderTargetMap["auxOut"] = tmp;
}
to

Code: Select all

void CPostProcessManager::SwapAuxBuffers()
{
        // swap the in and out buffers
        video::ITexture* auxIn = RenderTargetMap["auxIn"];
        video::ITexture* auxOut = RenderTargetMap["auxOut"];
        RenderTargetMap["auxIn"] = auxOut;
        RenderTargetMap["auxOut"] = auxIn;
}
should work
Also the water is nearly finished and I will upload it in the next days in the code snippets section.
Thanx in advance!
Sinsemilla
Posts: 38
Joined: Mon Jan 09, 2012 5:07 pm

Re: [SOLVED] Clipplanes in opengl

Post by Sinsemilla »

@tbw: Looks like this is the most obvious change possible. :D My code in SwapAuxBuffers looks exactly the same, this will definitively work. Even the variable name is identical :wink:
Post Reply