My 4KB Hypnotic Thing, wanna share yours ?

Showcase your libraries, tools and other projects that help your fellow love users.
User avatar
Ref
Party member
Posts: 693
Joined: Wed May 02, 2012 11:05 pm

Re: My 4KB Hypnotic Thing, wanna share yours ?

Post by Ref »

Can't come up with anything here.
Just spinning my wheels.
Attachments
gears.love
Just another one of those darn shaders
(1.42 KiB) Downloaded 163 times
User avatar
chezrom
Citizen
Posts: 59
Joined: Tue May 28, 2013 11:03 pm
Location: France

Re: My 4KB Hypnotic Thing, wanna share yours ?

Post by chezrom »

I love your drawings !

Here's the mine, using pixel effect and derived from the "metaball" demo but with voronoi diagram, a thing that always amaze me.

Keys :
  • a point follow the mouse
  • Mouse Left to change colors
  • Mouse right to change movement of other points
  • ESC to quit
  • any other key to toggle on/off the drawing of the point
Attachments
voronoi.love
(1.3 KiB) Downloaded 134 times
User avatar
RedHot
Citizen
Posts: 87
Joined: Mon May 27, 2013 2:43 pm
Location: Poland

Re: My 4KB Hypnotic Thing, wanna share yours ?

Post by RedHot »

Ref wrote:Can't come up with anything here.
Just spinning my wheels.
Your example won't work on AMD cards as AMD drivers are extremly picky when it comes to casting from int to float. I assume you are using an nvidia card and haven't experienced the problem.

FTFY.
Attachments
gears.love
Example from above working on AMD cards
(1.45 KiB) Downloaded 104 times
User avatar
Ref
Party member
Posts: 693
Joined: Wed May 02, 2012 11:05 pm

Re: My 4KB Hypnotic Thing, wanna share yours ?

Post by Ref »

Thanks for pointing that out - I think.
Babe in the woods here.
Would really appreciate any additional explanation as to what 'casting from int to float' really means.
It appears that you just removed the extern S (scaling factor) which is a float which I used to augment other float numbers (such as 0.03).
Just don't know what 'casting' is - my bad.
User avatar
RedHot
Citizen
Posts: 87
Joined: Mon May 27, 2013 2:43 pm
Location: Poland

Re: My 4KB Hypnotic Thing, wanna share yours ?

Post by RedHot »

I must have omitted the "extern S", my bad.


When you are doing arythemtic operations in C or C++ if you'd divide int by a float (f.i) 4/2,5 , the int gets promoted by default to a float, so you'd get 4,0/2,5 .

Same goes for shaders using Nvidia drivers. AMD is different. The shader won't compile if you'd wish to mix ints with floats. You have to change the type of variable implicitly (that's what we call casting). You can't use 4/2,5 it's gotta be 4,0/2,5

So if'd have

Code: Select all

int i = 4;
float n = 2.5
We need to do an implicit cast

Code: Select all

float result = (float)i/n;
Should be clear now
User avatar
Ref
Party member
Posts: 693
Joined: Wed May 02, 2012 11:05 pm

Re: My 4KB Hypnotic Thing, wanna share yours ?

Post by Ref »

Thanks for the INFO.
In my case, how would I make the shader scaleable?
In love.update I do:

Code: Select all

if love.keyboard.isDown( 'up' ) then S=S+dt s.effect:send('S',S) end
if love.keyboard.isDown( 'down' ) then S=S-dt s.effect:send('S',S) end
in the shader I have:

Code: Select all

extern number S;
and scale the gears using:

Code: Select all

Gear g0 = Gear(vec2(-0.30*S,0.00*S),	16,	0.03*S,	0.10*S,	time);
How would I avoid casting?
Help appreciated.
User avatar
RedHot
Citizen
Posts: 87
Joined: Mon May 27, 2013 2:43 pm
Location: Poland

Re: My 4KB Hypnotic Thing, wanna share yours ?

Post by RedHot »

Just change 16 to 16.0
User avatar
Ref
Party member
Posts: 693
Joined: Wed May 02, 2012 11:05 pm

Re: My 4KB Hypnotic Thing, wanna share yours ?

Post by Ref »

Thanks!
Something I would never have caught as my Acer doesn't care.
User avatar
Zer0
Citizen
Posts: 59
Joined: Sat Oct 06, 2012 9:55 am
Location: Sweden
Contact:

Re: My 4KB Hypnotic Thing, wanna share yours ?

Post by Zer0 »

Odd that this thing has yet to show up.

I would describe it as Classic.
Attachments
Vortex.love
(768 Bytes) Downloaded 116 times
If you can't fix it, Kill it with fire. ( Preferably before it lays eggs. )
User avatar
DaedalusYoung
Party member
Posts: 402
Joined: Sun Jul 14, 2013 8:04 pm

Re: My 4KB Hypnotic Thing, wanna share yours ?

Post by DaedalusYoung »

I had nothing better to do, so here's mine. Not exactly what I had in mind when I started, but it still turned out pretty good.

Mouse position influences colour value, left click increases size, right click decreases size. Any key quits.
Attachments
dyhypno.love
(1.8 KiB) Downloaded 132 times
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 25 guests