Help with shader

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!

Moderator: GZDoom Developers

Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.

Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
Post Reply
User avatar
Enjay
 
 
Posts: 26952
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland
Contact:

Help with shader

Post by Enjay »

I'm trying to learn something about shaders and I thought that looking at some existing ones and then editing them to my own needs would help clue me in. Anyway, I've come across a minor issue.

Looking at one of the shaders invglow.fp from Total Chaos, there is this line:

Code: Select all

    Material material;
	vec4 addEnv = texture(invglow, ((pixelpos.xyz).xy + (timer*30)) * 0.01);
if I change the word invglow to something else (glowscan in my case) I get:

Code: Select all

**** DIED WITH FATAL ERROR:
Shader 'glowscan' could not be compiled:
ERROR: 0:11: 'glowscan' : undeclared identifier 
ERROR: 0:11: '' : compilation terminated 
ERROR: 2 compilation errors.  No code generated.
If I run it with invglow, it works just fine.

Now, normally I would expect "undeclared identifier" to mean that I need to declare the name "glowscan" somewhere. The problem is, I have searched for invglow inside the shader and the only mention of it is in the above line. So I thought maybe it's declared in some of the GZDoom source files. I have searched through them all (using an automated search) and, again, I can't find the word "invglow".

Googling hasn't helped either.

So, is "invglow" some sort of built-in word that all shaders should know about somehow? If not, where is it declared to allow GZDoom to know about it? And how do I declare any name that I might want to use myself?

Or am I barking up the wrong tree entirely?
User avatar
Enjay
 
 
Posts: 26952
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland
Contact:

Re: Help with shader

Post by Enjay »

Nevermind! I figured it out. I had forgotten to change the instances of the word invglow in my gldefs to glowscan too. Doh!

But that's a good lesson because I was getting similar errors with other shaders and now I think I know why for them too.
Post Reply

Return to “Scripting”