Use only a Fragment Shader in libGDX?
I am porting my project from pure LWJGL to libGDX, and I'd like to know if
there is a way to create a program only with the Fragment Shader?
What I'd like to do is to change the color of my texture where it is gray
to a color I receive as a parameter. The shader worked perfectly before,
but now, it seems that I need to add a Vertex Shader - what does not make
any sense to me. So I wrote this:
void main() {
gl_Position = ftransform();
}
That, according to the internet, is the simplest possible VS: it does
nothing, and it really shouldn't. But it doesn't work: nothing is
displayed, and no compilation errors or warnings are thrown. I tried to
replace my Fragment Shader with a simpler one, but the results were even
stranger:
void main() {
gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);
}
This should only paint everything in red. But when I run, the program
crashes, no error is thrown, no Exception, very odd behavior. I know that
libGDX adds tilting, but I don't think it would work either, because I
need to replace only the gray-scale colors, and depending on the
intensity, I need to correctly modulate the correct color (that is
varying). Another shader I am using (Fragment only, again) is to set the
entire scene to gray-scale (when on the pause menu). It won't work either.
No comments:
Post a Comment