I hate LÖVEs shading language with a passion. Yes, I know underneath it's GLSL, but GLSL:
• Makes much more sense
• Is more beginner friendly
• Is standard
• Is easier to use
• Is fun
Is it possible for me to just use GLSL and save myself the pain of using the LÖVE shading language? I really hate it. GLSL is fun, LÖVE is fun, this shading language... not so much. Why does LÖVE use it's own shading language, anyway? Is there a special reason?
Thanks!
Using GLSL instead of LÖVEs shading language?
Using GLSL instead of LÖVEs shading language?
"In those quiet moments, you come into my mind" - Liam Reilly
- bartbes
- Sex machine
- Posts: 4946
- Joined: Fri Aug 29, 2008 10:35 am
- Location: The Netherlands
- Contact:
Re: Using GLSL instead of LÖVEs shading language?
Underneath it's glsl? It is glsl, it only has a different entry point. I'm not sure what you're complaining about here.
Nevertheless, it's easy, but undocumented, though found on the forums (here): override love.graphics._shaderCodeToGLSL.
Nevertheless, it's easy, but undocumented, though found on the forums (here): override love.graphics._shaderCodeToGLSL.
Re: Using GLSL instead of LÖVEs shading language?
It has different names, too. I just really don't like it, and I'd much prefer use GLSL. Thanks!
"In those quiet moments, you come into my mind" - Liam Reilly
- slime
- Solid Snayke
- Posts: 3171
- Joined: Mon Aug 23, 2010 6:45 am
- Location: Nova Scotia, Canada
- Contact:
Re: Using GLSL instead of LÖVEs shading language?
The different names are aliases, they don't replace/remove GLSL's names. You can write "pure GLSL" in LÖVE natively, as long as you use the 'effect' entry point for pixel shaders (and the 'position' entry point for vertex shaders.)
For example, this function will compile in WebGL, GLSL 1.10, GLSL 1.20, GLSL ES 1.00, and LÖVE 0.8 - 0.10 (although if you use WebGL or raw OpenGL/OpenGL ES then you will need to call the function from 'main'):
However I do recommend using the 'Texel' function instead of 'texture2D' for future portability to different versions of GLSL, since 'texture2D' doesn't exist in GLSL 1.40+ or GLSL ES 3.00+, whereas 'Texel' can always be aliased to the correct function automatically by LÖVE.
If you try to use third-party GLSL code which uses built in fixed-function compatibility variables from old versions of GLSL (for example gl_Vertex or gl_ModelViewProjectionMatrix) it may not work, because LÖVE doesn't necessarily use the deprecated OpenGL codepaths necessary for those things to work. They only existed to make it easier for programs transitioning from OpenGL 1 to OpenGL 2 to use shaders, and they don't exist at all in later versions of OpenGL / GLSL, or in any version of OpenGL ES.
For example, this function will compile in WebGL, GLSL 1.10, GLSL 1.20, GLSL ES 1.00, and LÖVE 0.8 - 0.10 (although if you use WebGL or raw OpenGL/OpenGL ES then you will need to call the function from 'main'):
Code: Select all
vec4 effect(vec4 vcolor, sampler2D tex, vec2 tex_coords, vec2 pixel_coords)
{
float alpha = texture2D(tex, tex_coords).a;
vcolor.a *= alpha;
return vcolor;
}
If you try to use third-party GLSL code which uses built in fixed-function compatibility variables from old versions of GLSL (for example gl_Vertex or gl_ModelViewProjectionMatrix) it may not work, because LÖVE doesn't necessarily use the deprecated OpenGL codepaths necessary for those things to work. They only existed to make it easier for programs transitioning from OpenGL 1 to OpenGL 2 to use shaders, and they don't exist at all in later versions of OpenGL / GLSL, or in any version of OpenGL ES.
- Zilarrezko
- Party member
- Posts: 345
- Joined: Mon Dec 10, 2012 5:50 am
- Location: Oregon
Re: Using GLSL instead of LÖVEs shading language?
Frankly I can't get either to work. I've even just copy and pasted code and that still shoots out nothing.
Re: Using GLSL instead of LÖVEs shading language?
A tip would be to provide us with a .love, then we will be able to do more for you than just say "ok".Zilarrezko wrote:Frankly I can't get either to work. I've even just copy and pasted code and that still shoots out nothing.
I have used shaders in almost every game I have made and so far not had any issue.
Who is online
Users browsing this forum: No registered users and 3 guests