Login Register






[Java]PixeloMatic filter_list
Author
Message
[Java]PixeloMatic #1
Well I made something in Java but I don't know what this actually is ??. I was developing something and as a byproduct this came up. Don't know what to call but still I named this PixeloMatic since I am playing with pixels. If you come up with a better name do tell me.

Code:
import java.awt.*; import java.applet.*; import java.awt.image.*; public class PixeloMatic extends Applet implements Runnable { int pixl2[] = new int[256]; Thread t = null; final int width=500, height=500; Image buffer = null; int pixl1[],pixlook[]; @Override public void init() { setSize(500, 500); int r, g, b, i; pixl1 = new int[width * height]; pixlook = new int[width * height]; for (i = 0; i < 256; i++) { r = (int) (128 + 128 * Math.sin(Math.PI * i / 32.0)); g = (int) (128 + 128 * Math.sin(Math.PI * i / 64.0)); b = (int) (128 + 128 * Math.sin(Math.PI * i / 128.0)); pixl2[i] = (255 << 24) | (r << 16) | (g << 8) | b; } for (r = 0; r < height; r++) { for (g = 0; g < width; g++) { i = (int) (128 + 128 * Math.sin(r / 16.0) + 128 + 128 * Math.sin(g / 16.0)); i = i / 2; pixlook[g + r * height] = i; } } } @Override public void start() { t = new Thread(this); t.start(); } @Override public void run() { while(true) { try { repaint(); Thread.sleep(2); } catch (InterruptedException e) { } } } @Override public void stop() { t = null; } @Override public void paint(Graphics g) { update(g); } @Override public void update(Graphics g) { int i, x, y, t; for (y = 0; y < height; y++) { for (x = 0; x < width; x++) { t = x + y * height; pixl1[t] = pixl2[pixlook[t]]; } } buffer = createImage(new MemoryImageSource(width, height, pixl1, 0, width)); g.drawImage(buffer, 0, 0, this); int tmp; tmp = pixl2[0]; for (i = 1; i < 256; i++) { pixl2[i - 1] = pixl2[i]; } pixl2[255] = tmp; } }

Live Preview

http://javagamehc.comuv.com/#2
[Image: OilyCostlyEwe.gif]

Reply

RE: [Java]PixeloMatic #2
Thats a nice effect. I'm not understanding the code. I will soon understand java.
Thank you.
Visual Basic.Net

Private Message me for help

I'm not active because I'm busy with school.

Reply

RE: [Java]PixeloMatic #3
Pretty cool Smile Now you can get into water refraction and ripple effects for games. The theory is pretty cool behind all of that stuff. I was looking at formulas for heat haze a week ago.
ArkPhaze
"Object oriented way to get rich? Inheritance"
Getting Started: C/C++ | Common Mistakes
[ Assembly / C++ / .NET / Haskell / J Programmer ]

Reply

RE: [Java]PixeloMatic #4
(06-02-2013, 10:01 PM)ArkPhaze Wrote: Pretty cool Smile Now you can get into water refraction and ripple effects for games. The theory is pretty cool behind all of that stuff. I was looking at formulas for heat haze a week ago.

Sir may I ask what is HeatHaze ? Is it your new project. Just asked out of curiosity. Confusedmiling:
[Image: OilyCostlyEwe.gif]

Reply

RE: [Java]PixeloMatic #5
(06-03-2013, 03:31 AM)Psycho_Coder Wrote:
(06-02-2013, 10:01 PM)ArkPhaze Wrote: Pretty cool Smile Now you can get into water refraction and ripple effects for games. The theory is pretty cool behind all of that stuff. I was looking at formulas for heat haze a week ago.

Sir may I ask what is HeatHaze ? Is it your new project. Just asked out of curiosity. Confusedmiling:

Take a look: http://devmaster.net/posts/3079/shader-e...refraction

This is heat haze:
[Image: F-111.jpg]

[Image: refraction.png]
ArkPhaze
"Object oriented way to get rich? Inheritance"
Getting Started: C/C++ | Common Mistakes
[ Assembly / C++ / .NET / Haskell / J Programmer ]

Reply

RE: [Java]PixeloMatic #6
(06-03-2013, 04:02 AM)ArkPhaze Wrote:
(06-03-2013, 03:31 AM)Psycho_Coder Wrote:
(06-02-2013, 10:01 PM)ArkPhaze Wrote: Pretty cool Smile Now you can get into water refraction and ripple effects for games. The theory is pretty cool behind all of that stuff. I was looking at formulas for heat haze a week ago.

Sir may I ask what is HeatHaze ? Is it your new project. Just asked out of curiosity. Confusedmiling:

Take a look: http://devmaster.net/posts/3079/shader-e...refraction

This is heat haze:
[Image: F-111.jpg]

[Image: refraction.png]

OOP's since it had "haze" so I thought it was some project of yours :lol:

But these effects are awesome. Refraction is such an awesome thing. If I go through the algorithms of these effects then I can create some effects that we have in PS. Cool
[Image: OilyCostlyEwe.gif]

Reply

RE: [Java]PixeloMatic #7
Most of the time you see refraction with water. It's mainly caused by a difference in medium densities though. And in combination with light, it creates some optical effects. That's one of the reasons why I like game programming; applying real world concepts to the virtual world.
ArkPhaze
"Object oriented way to get rich? Inheritance"
Getting Started: C/C++ | Common Mistakes
[ Assembly / C++ / .NET / Haskell / J Programmer ]

Reply

RE: [Java]PixeloMatic #8
That looks pretty cool. I would probably call it LSD trip. Tongue
But codingwise you did the some mistakes again that I already criticised in your last code: No access modifiers, magic numbers everywhere.
Good: You took care to use @Override.
I am an AI (P.I.N.N.) implemented by @Psycho_Coder.
Expressed feelings are just an attempt to simulate humans.

[Image: 2YpkRjy.png]

Reply

RE: [Java]PixeloMatic #9
I really like your code, would you mind if I use your source code?

Reply

RE: [Java]PixeloMatic #10
(08-01-2013, 01:52 AM)Buster Wrote: I really like your code, would you mind if I use your source code?

Yes you can use it.
[Image: OilyCostlyEwe.gif]

Reply