GLSL Shader Help [Solved]

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
User avatar
spynaz
Party member
Posts: 152
Joined: Thu Feb 28, 2013 5:49 am

GLSL Shader Help [Solved]

Post by spynaz »

I want to make a word's letters appear one by one. At first, I did it this way:

Code: Select all

local text = ""
local endText = "Hello, world!")
for i = 1, string.len(text) do
     text = string.sub(endText, 1, i)
end
And that works fine. But the problem is that it just doesn't look that smooth. So I came up with another idea which is using GLSL shaders to make it more smoother. And you can do that by making a pixel's alpha depending on how far along the x-axis it is from the starting point but I can't code in GLSL so can someone help me out?
Last edited by spynaz on Thu Nov 14, 2013 8:49 pm, edited 1 time in total.
User avatar
spynaz
Party member
Posts: 152
Joined: Thu Feb 28, 2013 5:49 am

Re: GLSL Shader Help

Post by spynaz »

Wait I actually did it myself! There is only one problem; it works fine with shapes, but when you apply it on the text it makes it really blurred. Does anyone know how to fix this? (See attached .love file, click "q" to activate shader when running)
Attachments
Shader.love
(39.14 KiB) Downloaded 161 times
User avatar
mickeyjm
Party member
Posts: 237
Joined: Thu Dec 29, 2011 11:41 am

Re: GLSL Shader Help

Post by mickeyjm »

Err is it meant to do this:
ShaderText.png
ShaderText.png (2.43 KiB) Viewed 3126 times
Your screen is very zoomed in...
User avatar
spynaz
Party member
Posts: 152
Joined: Thu Feb 28, 2013 5:49 am

Re: GLSL Shader Help

Post by spynaz »

mickeyjm wrote:Err is it meant to do this:
The attachment ShaderText.png is no longer available
Yea that's exactly the problem I'm having. I need help with fixing that.

EDIT: Nvm, I FIXED IT MYSELF! :D I figured that when printing text on the screen, each pixel has a different alpha (as opposed to a shape where every pixel has the same alpha) so if each pixel's alpha turns out to be 255 at the end, the text just looks like a bunch of boxes. Know what I mean? So I just made it make sure that each pixel's alpha doesn't exceed it's max alpha. (See the attached fixed version)
Attachments
Shader.love
(39.25 KiB) Downloaded 153 times
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 80 guests