[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/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 - Ray Creator

Slick Forums

Discuss the Slick 2D Library
It is currently Thu Jul 09, 2020 6:04 pm

All times are UTC




Post new topic Reply to topic  [ 13 posts ] 
Author Message
 Post subject: Ray Creator
PostPosted: Mon Sep 10, 2012 3:37 am 
Offline
Regular

Joined: Tue Aug 23, 2011 8:19 am
Posts: 111
Even though Slick is a game library, it has many other uses :D

Ray Creator is a program that lets you randomly create a ray-based image, such as the ones below, based on your options. It starts with a Swing GUI that lets you pick your options, and then when you click the button, it creates a random image using those options.

Created using Target RGB mode:

Created using Greyscale mode:

Created using Rainbow mode:


I wish this forum supported resizing images in BBcode :(

Image window controls:
Enter: Create a new random image using the same options as the previous image.
S: Save image to a BMP file in a folder called "Saved_images" in the same spot as the EXE and Jar files.

To DOWNLOAD Ray Creator, click , and then click the green download button. I'd give a direct link, but this way I can make sure this thread always has the most up-to-date version.

Note: Saving an image can take minutes at large resolutions on slow computers. The longest I've had it take is 30 seconds at 1280x720.

Hope you guys give it a try. Let me know what I should change/add :D

_________________
My indie games: http://cmagames.webs.com


Top
 Profile  
 
 Post subject: Re: Ray Creator
PostPosted: Mon Sep 10, 2012 2:27 pm 
Offline
User avatar

Joined: Fri Dec 24, 2010 3:06 am
Posts: 90
Location: USA, Texas


Top
 Profile  
 
 Post subject: Re: Ray Creator
PostPosted: Mon Sep 10, 2012 7:49 pm 
Offline
Regular

Joined: Tue Aug 23, 2011 8:19 am
Posts: 111

_________________
My indie games: http://cmagames.webs.com


Top
 Profile  
 
 Post subject: Re: Ray Creator
PostPosted: Thu Sep 13, 2012 2:35 am 
Offline
User avatar

Joined: Fri Dec 24, 2010 3:06 am
Posts: 90
Location: USA, Texas
Alright, cool, and no, I'm running on 64-bit Windows 7 Home Premium.

It would be nice to provide, for example, an MD5 hash so people can check the file. I redownloaded the same version, but no dice, same error.


Top
 Profile  
 
 Post subject: Re: Ray Creator
PostPosted: Sat Sep 15, 2012 3:34 am 
Offline
Regular

Joined: Tue Aug 23, 2011 8:19 am
Posts: 111
@dpek Thanks for letting me know about the error. I tried running the exe on my laptop and got the same error you did. Then I tried one of my older games and got the same error. That means I'm doing something wrong in NetBeans or Launch4j.

_________________
My indie games: http://cmagames.webs.com


Top
 Profile  
 
 Post subject: Re: Ray Creator
PostPosted: Mon Sep 17, 2012 4:30 am 
Offline
Slick Zombie

Joined: Sat Jan 27, 2007 7:10 pm
Posts: 1482
This is awesome. :) Tech demos like these are a good way to learn a library and graphics programming before diving nose-first into a monstrous game project.

Two things are contributing to your slow saves. Firstly, you are getting each individual pixel in the screen, which can be very costly since it may require hundreds of thousands of texture transfers. (Slick's getPixel wasn't really designed for this use.)

One solution would be to copy the entire screen to a Slick Image (using Graphics.copyArea) and then saving that with Slick's ImageOut utility. A better solution would be to render the effect to an offscreen image (using Image.getGraphics) instead of the screen; then simply pass the image to ImageOut.

Also, for future reference, it's more efficient to use the backing pixels of a BufferedImage instead of relying on getRGB/setRGB -- .

--

I hope you don't mind: I tried re-implementing your idea using shaders (assuming you aren't already using them). Hopefully the demo shows an alternative way of achieving a starburst effect (on the GPU) as well as some standard Slick practices (like image graphics and Image IO).

Take note of how I'm using createOffscreenGraphics and saving images with ImageOut -- you will probably want to do the same for efficiency (my app saves a 2048x2048 image in a split second). I included a couple of shader effects (vignette, grayscale) which you can comment out and play around with.

Of course; a shader approach has its own limitations -- including non power of two sizes (it would take a bit of tweaking), aliasing and blurring at larger resolutions, etc. This is why your current approach (polygons?) looks better.



()
()
()

You could even take your application a step further -- generate your starburst image using polygons, and then add GLSL post-processing like vignette, blurring, .


Top
 Profile  
 
 Post subject: Re: Ray Creator
PostPosted: Tue Sep 18, 2012 8:43 am 
Offline
Regular

Joined: Tue Aug 23, 2011 8:19 am
Posts: 111
Wow, davedes! I'll have to take a look at your version and see what I can do to improve mine. I've built a few games using Slick before, but they never had any advanced graphics stuff (like shaders).

I looked for a way to make Slick save an image, but couldn't find anything, so I went the javax.ImageIO route. I'm glad you mentioned that Slick has utilities to save an image.

_________________
My indie games: http://cmagames.webs.com


Top
 Profile  
 
 Post subject: Re: Ray Creator
PostPosted: Mon Oct 01, 2012 3:48 am 
Offline
Regular

Joined: Tue Aug 23, 2011 8:19 am
Posts: 111
davedes, I tried to run your shader idea but NetBeans is telling me it can't find ShaderProgram and Image.createOffscreenImage(). It is able to find the Image class, but not that specific method. I'm using Slick build 274. Can you help me get your code working?

_________________
My indie games: http://cmagames.webs.com


Top
 Profile  
 
 Post subject: Re: Ray Creator
PostPosted: Tue Oct 02, 2012 10:59 pm 
Offline
Slick Zombie

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


Top
 Profile  
 
 Post subject: Re: Ray Creator
PostPosted: Tue Oct 02, 2012 11:45 pm 
Offline
Regular

Joined: Tue Aug 23, 2011 8:19 am
Posts: 111
I downloaded Liam's jar since I'm using NetBeans and don't know my way around Mercurial. It says the build is 264. Is that right? 274 is older but a bigger number.

I was able to run your program now. It's too advanced for me. I have no idea how you converted vertical rainbow bars to a greyscale starburst. I know it has to do with the .frag and the .vert files, but I know nothing about shaders.

_________________
My indie games: http://cmagames.webs.com


Top
 Profile  
 
 Post subject: Re: Ray Creator
PostPosted: Sun Oct 07, 2012 2:10 am 
Offline
Slick Zombie

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


Top
 Profile  
 
 Post subject: Re: Ray Creator
PostPosted: Wed Oct 24, 2012 5:09 pm 
Offline
Regular

Joined: Tue Aug 23, 2011 8:19 am
Posts: 111
I updated the program. It now saves images using Slick, so it's much faster. I think I also fixed the exe file now because it runs fine on my laptop.

_________________
My indie games: http://cmagames.webs.com


Top
 Profile  
 
 Post subject: Re: Ray Creator
PostPosted: Wed Oct 24, 2012 5:45 pm 
Offline
User avatar

Joined: Fri Dec 24, 2010 3:06 am
Posts: 90
Location: USA, Texas


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 13 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


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