[C++] Reflective Water (conversion from .NET)

Post those lines of code you feel like sharing or find what you require for your project here; or simply use them as tutorials.
Washi
Posts: 20
Joined: Tue Nov 18, 2003 5:53 am
Location: New Zealand

Post by Washi »

Someone reported it as a file which abuses their TOC, noreg you need to contact them and set them straight.
robmar
Posts: 1125
Joined: Sun Aug 14, 2011 11:30 pm

Re: [C++] Reflective Water (conversion from .NET)

Post by robmar »

This demo no longer works under Irrlicht 1.8 :(
ACE247
Posts: 704
Joined: Tue Mar 16, 2010 12:31 am

Re: [C++] Reflective Water (conversion from .NET)

Post by ACE247 »

Ofcourse it doesnt! The code is likely from pre 2007;-)
robmar
Posts: 1125
Joined: Sun Aug 14, 2011 11:30 pm

Re: [C++] Reflective Water (conversion from .NET)

Post by robmar »

Well this demos worked fine up to Irrlicht 1.7.3, and there is no reason that it should not in 1.8.

The shaders are all good, the rest of the code is normal stuff.
ACE247
Posts: 704
Joined: Tue Mar 16, 2010 12:31 am

Re: [C++] Reflective Water (conversion from .NET)

Post by ACE247 »

Does it even compile? if yes, how does the onsetShaderConstants function look like? Else, what else is wrong?
robmar
Posts: 1125
Joined: Sun Aug 14, 2011 11:30 pm

Re: [C++] Reflective Water (conversion from .NET)

Post by robmar »

It compiles fine, and everything is standard. I have some other shaders that now also don´t work if I use 1.8, and they were shader samples out of standard samples.

Reflective water just sets up a parallax plane and a reflective plane, has a camera which takes an upshot of the scene and renders it to the texture which the shader uses. All bog standard stuff, but for some reason, there seems to be a change in 1.8 that stops the shader reading the texture, and everything is black.

Its a good sample to reproduce the issue on 1.8
ACE247
Posts: 704
Joined: Tue Mar 16, 2010 12:31 am

Re: [C++] Reflective Water (conversion from .NET)

Post by ACE247 »

Problem most likely lies with how textures are passed to the shader. onsetShaderConstant now takes int as texture reference type input instead of float/f32. This was already mentioned on the forum, search for 'shader handling broken' or something similar.
robmar
Posts: 1125
Joined: Sun Aug 14, 2011 11:30 pm

Re: [C++] Reflective Water (conversion from .NET)

Post by robmar »

Yeah I saw that somewhere. Under GLSL its passing texture refs as floats, would that stop it working? Easy to fix though!

Is that change related to a new standard for GLSL shaders across all systems, or just for Irrlicht?
ACE247
Posts: 704
Joined: Tue Mar 16, 2010 12:31 am

Re: [C++] Reflective Water (conversion from .NET)

Post by ACE247 »

just irrlicht, and only needs to be changed in your program code, other than that float ref's are still possible in certain scena
robmar
Posts: 1125
Joined: Sun Aug 14, 2011 11:30 pm

Re: [C++] Reflective Water (conversion from .NET)

Post by robmar »

So why was it changed to int, if the standard is still float?
hendu
Posts: 2600
Joined: Sat Dec 18, 2010 12:53 pm

Re: [C++] Reflective Water (conversion from .NET)

Post by hendu »

The standard was never float. Irr sending them as floats was a hack, and it was now fixed.
robmar
Posts: 1125
Joined: Sun Aug 14, 2011 11:30 pm

Re: [C++] Reflective Water (conversion from .NET)

Post by robmar »

okay, that´s good then, I will update my code to the standard!
sio2
Competition winner
Posts: 1003
Joined: Thu Sep 21, 2006 5:33 pm
Location: UK

Re: [C++] Reflective Water (conversion from .NET)

Post by sio2 »

Gee, that's an old demo (and an old thread). From a quick scan of the code it appears to be Shader Model 1.1 for GL and SM2.0 for "other". There may be a few bugs in there - this *is* from six years ago - so be aware. For example, that test for "IF (GL) do this ELSE assume DX9" is not exactly robust!
robmar
Posts: 1125
Joined: Sun Aug 14, 2011 11:30 pm

Re: [C++] Reflective Water (conversion from .NET)

Post by robmar »

Works fine, some "old" things still work perfectly,... like some of our own DNA, hundreds of millions of years old! :)
Post Reply