This is mostly out of curiosity but:
1. Why is there no vertex shader?
2. Is the vertex shader really in the love2d implementation just hidden from the user?
3. Does the shader code you write need to be GLSL compatible?
I'm actually using love2d for a class project and don't really know the answers to these questions and was hoping someone could shed some light.
Thanks
How do Love2D shaders work?
Re: How do Love2D shaders work?
I don't know anything about shaders, but I remember Thelinx said there's a way to use pure GSGL code, by changing a function
lf = love.filesystem
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics
Re: How do Love2D shaders work?
I'm not sure why this design decision was made. One of the core maintainers might be able to answer that.joey_green wrote: 1. Why is there no vertex shader?
No, it's not hidden. If you have a look at love's source code, you'll see that there is no support for vertex shaders.joey_green wrote: 2. Is the vertex shader really in the love2d implementation just hidden from the user?
Code: Select all
GLuint shader = glCreateShader(GL_FRAGMENT_SHADER);
With the exception of not having a vertex shader, yes, it's just glsl. Love adds a small wrapper to facilitate shader development:joey_green wrote: 3. Does the shader code you write need to be GLSL compatible?
Code: Select all
local header = [[#version 120
#define number float
#define Image sampler2D
#define extern uniform
#define Texel texture2D
uniform sampler2D _tex0_;]]
local footer = [[void main() {
// fix weird crashing issue in OSX when _tex0_ is unused within effect()
float dummy = texture2D(_tex0_, vec2(.5)).r;
gl_FragColor = effect(gl_Color, _tex0_, gl_TexCoord[0].xy, gl_FragCoord.xy);
}]]
Who is online
Users browsing this forum: No registered users and 3 guests