[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4688: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4690: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4691: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4692: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
Slick Forums • View topic - [ADDED] Managed Shader support

Slick Forums

Discuss the Slick 2D Library
It is currently Fri Jul 03, 2020 12:59 pm

All times are UTC




Post new topic Reply to topic  [ 63 posts ]  Go to page Previous  1, 2, 3, 4, 5  Next
Author Message
PostPosted: Mon Mar 19, 2012 9:08 pm 
Offline
Game Developer
User avatar

Joined: Thu Mar 03, 2011 6:22 pm
Posts: 534
Ah very nice. That will be very helpful to beginners. Thanks for the hint, I thought that it might be because of that but wasn't sure xD

I will try it out as soon as I have some time (Toy Shader is a really nice tool to test stuff with imho).

_________________
Current Projects:


Projects:
- Build on top of Slick2D, Ideas, Bugs? Open an Issue ticket!


Top
 Profile  
 
PostPosted: Tue Mar 20, 2012 8:32 am 
Offline
Game Developer
User avatar

Joined: Thu Mar 03, 2011 6:22 pm
Posts: 534
Okay, i tested it and it works as expected :)

I would suggest we clean the code and add some doc and push it into the dev branch if liamzebedee does not resist :D If that's done I would do some basic shaders (the first would be a simple texture-fragment shader like the one above). I'm more the fragment shader guy so my vertex shader input will go to one vertex shader positioning the vertices :D

_________________
Current Projects:


Projects:
- Build on top of Slick2D, Ideas, Bugs? Open an Issue ticket!


Top
 Profile  
 
PostPosted: Wed Mar 21, 2012 8:01 am 
Well as of current I'm not liking davedes structuring of the shader code IMO. He is an excellent game developer, surely better than me in alot of regards. Currently the code is very messy (I assume this is just because of rapid dev, understandable) and the structure isn't flexible (there are probably reasons for this).

Currently my code is very simple, and adaptive. IMHO I think it would be simpler to let the user decide what shaders they want to use using program.attachShader(ShaderType.VERTEX, "vertexsource"). The way I have structured my code is flexible too.

Please view the NEW UNSTABLE code

The only part not working now is variable location caching. @davedes help please?


Top
  
 
PostPosted: Wed Mar 21, 2012 8:23 am 
Offline
Game Developer
User avatar

Joined: Thu Mar 03, 2011 6:22 pm
Posts: 534

_________________
Current Projects:


Projects:
- Build on top of Slick2D, Ideas, Bugs? Open an Issue ticket!


Top
 Profile  
 
PostPosted: Wed Mar 21, 2012 8:40 am 
@R.D. Liking the constructive criticism btw. The thing is, shader development is lower level, so I guess we have to find the perfect usability level while maintaining control over data.

I'll say go for @davedes implementation in Slick then. You guys think it's better for the user, I probably just have a different shader hat on. Feel free to use some of my cross platform code, though know that I think of it, probably just stick with OpenGL2 (unless you want geometry shaders).


Top
  
 
PostPosted: Wed Mar 21, 2012 8:46 am 
Offline
Game Developer
User avatar

Joined: Thu Mar 03, 2011 6:22 pm
Posts: 534
Don't get me wrong. I like the idea of having the program deciding what to use based on what runs on the enduser's computer. That's what I want for OffScreenGraphics too (tho your code misses a static method to check if anything of the 2 is supported so the dev can turn it off/use other posibilities :)).

So a nice mix with the open and debugging friendly way davedes uses and the automatism your code serves I guess we could give the devs a really cool shader support.

_________________
Current Projects:


Projects:
- Build on top of Slick2D, Ideas, Bugs? Open an Issue ticket!


Top
 Profile  
 
PostPosted: Wed Mar 21, 2012 12:05 pm 
Offline
Slick Zombie

Joined: Sat Jan 27, 2007 7:10 pm
Posts: 1482


Top
 Profile  
 
PostPosted: Wed Mar 21, 2012 12:21 pm 
Offline
Game Developer
User avatar

Joined: Thu Mar 03, 2011 6:22 pm
Posts: 534
Wouldn't it be better to just use something like "setVertexShader(Shader vertex) {...}" and so on? I can kinda thought the same thing you did about naming it attachShader. It means for a newbie: "Well nicht just let me attach 20 fragment shaders and 4 vertex shaders" :D

When resusing I mostly thought about Android Development. On Desktop I wouldn't mind about such stuff but if you use a lot shaders... well I wouldn't but yeah...

And error logging is indeed usefule. Think about it. Shaders will not tell you they didn't compiled if you don't ask for the errors. Might be a doog iea to through a exeception if the error log returns something after compliling the Shader.

_________________
Current Projects:


Projects:
- Build on top of Slick2D, Ideas, Bugs? Open an Issue ticket!


Top
 Profile  
 
PostPosted: Thu Mar 22, 2012 12:57 am 
Offline
Slick Zombie

Joined: Sat Jan 27, 2007 7:10 pm
Posts: 1482

:twisted:
The animated apple shader from Shader Toy, nicely being rendered to an Image, then some slick text also rendered to that image, then the image rotated... all at 60 FPS...


Top
 Profile  
 
PostPosted: Thu Mar 22, 2012 1:07 am 
Offline
Slick Zombie

Joined: Sat Jan 27, 2007 7:10 pm
Posts: 1482


Top
 Profile  
 
PostPosted: Thu Mar 22, 2012 8:36 am 
Offline
Game Developer
User avatar

Joined: Thu Mar 03, 2011 6:22 pm
Posts: 534
Very Nice! I will test it when I have the time :)
Can you post the source of the apple shader test too? I would like too how you did the drawing on the image (FBO?) :D

_________________
Current Projects:


Projects:
- Build on top of Slick2D, Ideas, Bugs? Open an Issue ticket!


Top
 Profile  
 
PostPosted: Fri Mar 23, 2012 1:49 am 
Offline
Slick Zombie

Joined: Sat Jan 27, 2007 7:10 pm
Posts: 1482
Pushed the shader stuff to org.newdawn.slick.opengl.shader. Still needs some attribute setters and a couple other minor things. Also added ShaderTest, showing the simple invert shader.

For the shader toy render-to-texture I used the FBO class I posted in the other thread:
http://pastebin.com/n67dfFqP

Although I'm sure it's possible with Slick's getGraphics (albeit slightly less efficient).


Top
 Profile  
 
PostPosted: Fri Mar 23, 2012 9:36 am 
Offline
Game Developer
User avatar

Joined: Thu Mar 03, 2011 6:22 pm
Posts: 534

_________________
Current Projects:


Projects:
- Build on top of Slick2D, Ideas, Bugs? Open an Issue ticket!


Top
 Profile  
 
PostPosted: Fri Mar 23, 2012 1:30 pm 
Offline
Slick Zombie

Joined: Sat Jan 27, 2007 7:10 pm
Posts: 1482
One of the problems I've noticed is that it's hard if, say, a user wanted to call glAttachShader to reuse the same shader function between multiple shader programs. "setVertexShader" might be more Slick-esque but it's also a bit more limiting... :|

You can't use two shaders at once in OpenGL. For horizontal and vertical blurs, you'll have to separate that into two render calls, and then blend them together using render to texture (e.g. FBO).

The flipping is annoying right now, I agree. :)


Top
 Profile  
 
PostPosted: Fri Mar 23, 2012 6:08 pm 
Offline
Regular

Joined: Sun Oct 30, 2011 4:47 pm
Posts: 184
Location: Mittweida, Saxony, Germany
Shaders are cool and everything. But... do we need them twice?




Those even appear to be different implementations...
Is one of both obsolete?

Nitram


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 63 posts ]  Go to page Previous  1, 2, 3, 4, 5  Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group