Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (481)
Games in Android Showcase (110)
games submitted by our members
Games in WIP (548)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
   Home   Help   Search   Login   Register   
  Show Posts
Pages: [1] 2
1  Game Development / Game Mechanics / Re: WritableRaster problems on: 2013-06-26 20:51:29
I figured out the problem.

The bug was serveral things. The for-loops WIDTH and HEIGHT conditions were not set correctly and were giving false states. As for the WritableRaster, the code below is what now works. Strange, you have to set the data in the buffered image you are currently working on. Apparently the reference is a copy so I was not working directly on the image.

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
private void render(Graphics2D g2d){
       
        WritableRaster wr = lithosphere.getRaster(); // <-------------- Not making a copy, just getting the reference
       
        Color colorRef;
        int lookup, color;
       
        double mapHeight;
       
        int[] data = {0,0,0}; //<----------- This was changed to int
           
        Graphics2D lg2d = lithosphere.createGraphics();
       
        for (int x = 0; x < JGeoTec.WIDTH; x++) { // <------------------ Bug here

            for (int y = 0; y < JGeoTec.HEIGHT; y++) { // <------------------ Bug here

                mapHeight = (map[x][y].getHeight() <= 650) ? 650 : map[x][y].getHeight();

                lookup = (int)(mapHeight / 650) - 1;

                heightmap_lookup_raster.getPixel(lookup, 0, data);
               
                wr.setPixel(x, y, data);

            }

        }
       
        renderFaults(wr);
       
        //lithosphere.setData(wr); //<-------- ONLY needed if you are creating a copy of a raster
       
        g2d.drawImage(lithosphere, null, null);
       
}


I am able to work on 1024x1024 pixels very quickly. Very useful stuff here if you are wanting to work on images right down to the pixels. setRGB methods are very slow...



****** EDIT *******

I was creating a new raster by calling createCompatiableWritableRaster or something. OTHERWISE the code above is completely correct.
2  Game Development / Game Mechanics / Re: WritableRaster problems on: 2013-06-26 15:29:07
I have also tried this with no success either... The array K was deleted and data was used as the input array for the pixel. The array data shows a change when this is called,
1  
heightmap_raster.getPixel(lookup, 0, data);


However nothing still works. I don't understand why nothing is showing a change when the image is rendered.
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
private void render(Graphics2D g2d){
       
        WritableRaster wr = lithosphere.getRaster().createCompatibleWritableRaster();
       
        int lookup;
       
        double mapHeight;
       
        double[] data = {0,0,0};
           
        for (int x = 0; x < WIDTH; x++) {

            for (int y = 0; y < HEIGHT; y++) {

                mapHeight = (map[x][y].getHeight() <= 650) ? 650 : map[x][y].getHeight();

                lookup = (int)(mapHeight / 650) - 1;

                heightmap_raster.getPixel(lookup, 0, data);

                wr.setPixel(x, y, data);

            }

        }
       
        g2d.drawImage(lithosphere, 0, 0, null);
       
}
3  Game Development / Game Mechanics / Re: WritableRaster problems on: 2013-06-26 14:58:30
No, that is the only place in which the image is being rendered. Also the image is being drawn onto a JPanel. The Graphics2D device is passed by the JPanel's paintComponent(Graphics g) method. Which is shown below.

The funny thing about it is if I fill a rectangle onto the image in the start before any changes are made, say a red box, it renders that just fine. But no changes are being made to the raster.

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
private class gtPanel extends JPanel {
       
        public void paintComponent(Graphics g) {
       
            Graphics2D g2d = (Graphics2D) g;

            super.paintComponent(g);

            render(g2d);

            g2d.dispose();

        }
       
}
4  Game Development / Game Mechanics / WritableRaster problems on: 2013-06-26 05:37:44
I don't know why but when I try to paint the manipulated image nothing has changed.



1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
private void render(Graphics2D g2d){
       
        WritableRaster wr = lithosphere.getRaster();
       
        int lookup;
       
        double mapHeight;
       
        double[] k = {0,0,0}, data;
           
        for (int x = 0; x < WIDTH; x++) {

            for (int y = 0; y < HEIGHT; y++) {

                mapHeight = (map[x][y].getHeight() <= 650) ? 650 : map[x][y].getHeight();

                lookup = (int)(mapHeight / 650) - 1;

                data = heightmap_raster.getPixel(lookup, 0, k);

                wr.setPixel(x, y, data);

            }

        }
       
        g2d.drawImage(lithosphere, 0, 0, null);
       
    }


The raster is changing but when I go to draw the image nothing is drawn. The image stays the same. Any ideas?

Oh and I didn't know where this was supposed to go. And please do not give me a link to something. I've been on this for a while and still can't figure it out.
5  Java Game APIs & Engines / Engines, Libraries and Tools / Re: LWJGL Linking Libraries on: 2013-03-19 18:14:35
Well the thing is I already know all this. But it still doesn't work. I've tried the class path and I've used the VM Options and placed all the right JARs in their own library in netbeans but I still get the error.
6  Java Game APIs & Engines / Engines, Libraries and Tools / Re: LWJGL Linking Libraries on: 2013-03-19 17:42:47
Thanks for making me feel stupid, if it's so basic why don't I know it? Not much of this stuff is taught or spoken of.

I'm also using netbeans 7.3 and it's been kind of a pain to deal with
7  Java Game APIs & Engines / Engines, Libraries and Tools / LWJGL Linking Libraries on: 2013-03-19 17:14:35
I am a little confused on why this isn't working but I am trying to get LWJGL to work along side my own library but when I try to use my library which used the LWJGL I always get this error message

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
Exception in thread "main" java.lang.NoClassDefFoundError: org/lwjgl/LWJGLException
   at easycliptest.EasyClipTest.<init>(EasyClipTest.java:18)
   at easycliptest.EasyClipTest.main(EasyClipTest.java:67)
Caused by: java.lang.ClassNotFoundException: org.lwjgl.LWJGLException
   at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
   at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
   at java.security.AccessController.doPrivileged(Native Method)
   at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
   at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
   at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
   at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
   ... 2 more
Java Result: 1


The thing about it though is LWJGL works if I just run the a test within the library project Easy Clip that uses LWJGL. If another program is to use Easy Clip as a library and easy clip uses LWJGL, then how can this be done?

Also not sure where this topic goes, I tried registering for LWJGL forums but this question "What is the package + class name that Display inherits from?", is the one I am stuck on. In my opinion that forum has too many security requirements during registration. Seems too much to me.
8  Java Game APIs & Engines / Tools Discussion / New Update coming on: 2012-11-03 05:11:42

Just a few bug fixes.

 Tongue

9  Java Game APIs & Engines / Tools Discussion / Re: Game Engine for beginner and intermediate game programmers on: 2012-09-19 03:14:13
I intend to  Wink
Let me know what you think
10  Java Game APIs & Engines / Tools Discussion / Re: Game Engine for beginner and intermediate game programmers on: 2012-09-19 03:13:39
Yes. that is true  Cool
11  Java Game APIs & Engines / Tools Discussion / Engine is uploaded on: 2012-09-18 04:12:00

Since I haven't had any time to construct an officall website for Easy Clip, I decided to post it on Google Sites.

here is the temporary website, https://sites.google.com/site/easyclip2d/

The documentation is not complete yet. The last bit that needs to be written is using the sound library.

12  Java Game APIs & Engines / Tools Discussion / Project Update on: 2012-09-05 02:03:05

Easy Clip is finished. The last step is getting it online. The website's server has been acting strange lately. Hopefully the hosting service will fix the problem soon.

The first version of easy clip along with it's manual will be released as version 2.0
There is one last major update to the engine I will be making in the future and that is
better sound support for music and sound effects using OpenAL. Right now since
the engine's sound is still in development, a small OGG support library will be used.

I also have a bunch of simple example programs that can be downloaded with their
source code so you can get a good idea of how to use the engine.
13  Java Game APIs & Engines / Tools Discussion / Re: Game Engine for beginner and intermediate game programmers on: 2012-07-19 20:39:08
The main page of this Post has been updated. I am very close to finishing the documentation and some example programs to get an idea of how to use the engine.
14  Java Game APIs & Engines / Tools Discussion / Re: Game Engine for beginner and intermediate game programmers on: 2012-07-07 17:31:26
That is a good idea. Maybe make a bunch of small sample games?
15  Java Game APIs & Engines / Tools Discussion / Re: Game Engine for beginner and intermediate game programmers on: 2012-07-06 06:35:59
For those who have either been waiting or have stumbled upon this thread, I thank you for your patients in my development of my game engine, Box2D has been implemented and you have the option of having the Box2D libraries or going through Easy Clip which contains the Box2D libraries. Of course my aim for this engine is for beginners and advanced users as well. I plan to have the engine out for people to use by the end of July.
16  Java Game APIs & Engines / Tools Discussion / Re: Game Engine for beginner and intermediate game programmers on: 2012-06-21 19:18:05
I think I have it covered and safe... So you don't have to worry  Stare
17  Java Game APIs & Engines / Tools Discussion / Large Update on: 2012-06-21 19:10:15
It has been a while since my website was hacked. I didn't fix the site because I decided to revamp the game engine. So to those few hundred who downloaded it please know that I am coming out with a newer, much better, engine.
I have implemented Box2D into the engine as well. This gives the new object Sprite2D. It's easy to set up and you don't need the libraries of Box2D, since EC already performs those tasks for you.

I plan on fixing the site soon when I am ready to release the newer version.

Also on a side note: I am not going to revamp the graphics side of easy clip because it's really meant for beginner game programmers. There is also really no point in not utilizing an existing graphics library. Anyways. I hope people will try it out, it will also be going into open source when it releases.
18  Games Center / Archived Projects / Re: TicTacToe on: 2011-11-12 22:27:50
Ya it's on the download page of the website.

http://easyclip2d.com/easy-clip2d-download-page
19  Games Center / Archived Projects / Re: TicTacToe on: 2011-11-06 05:56:58

Tongue I was thinking about that. Would indeed be the next step to go
20  Games Center / Archived Projects / TicTacToe on: 2011-11-06 05:08:24
A basic tic tac toe game I made cause I was kinda board.
I also did it to test the newer version of my game engine.
The engine is actually overkill for this kind of game but I thought what the heck.
I put the game on my website at EasyClip2D.com, it's the
last link on the left.
21  Games Center / Showcase / Re: Lode Runner remake on: 2011-07-18 18:53:13
there are a few bugs, like i would fall through a block when its still there. this is awesome work though, it brings me back to when the original lode runner was around when it was just black and green screen Cheesy
22  Games Center / Archived Projects / Re: LazRs on: 2011-07-18 01:03:05
Yes, there's alot of things that need to be plugged into the game, but with how small it is Im not going to bother, you may do it yourself if you prefer to. The source is included, and you may play around with the code. The main constructor in the file LazRs.java is the main file that runs the game. The constructor holds a call to a super constructor by passing in the width and height of the screen display while in full screen mode. If you remove the 32 from the constructor, it will enable it to be window mode instead, also the source has been tweaked a bit from the compiled version. You need to change the variable 'edit' to false. otherwise no levels will be loaded and the variable maxLevels to 18 or however many data files there are.
23  Games Center / Archived Projects / Re: LazRs on: 2011-07-17 22:10:44
as far as tweaking and polishing, I think ill leave it as it is, it only took a few days to make. I was just seeing how well easy clip could stand up to it. And play all the levels. Theres more than just one color of laser. and more to do than just reflect light.
24  Games Center / Archived Projects / Re: LazRs on: 2011-07-12 06:34:28
There is a variable within the source called edit. set it to false. you can change the resolution as well in the source. Ill go ahead and re post this cause i did notice i uploaded the wrong version.
25  Games Center / Archived Projects / Re: LazRs on: 2011-07-12 06:34:16
There is a variable within the source called edit. set it to false. you can change the resolution as well in the source. Ill go ahead and re post this cause i did notice i uploaded the wrong version.
26  Games Center / Archived Projects / LazRs on: 2011-07-11 04:03:03
I just finished writing my first puzzle game. I never really liked writing them but here is my finished game.
I posted it on my website at www.easyclip2d.com on the home page.

The source is included as well.

27  Java Game APIs & Engines / Tools Discussion / Re: JDIV , a 2d engine for java (fully java2d) on: 2011-06-19 09:55:50
I tried it and everything worked fine. You should make an applet with the examples instead of offering the .bat files, so we can easily click through.
The particles demo is extremely slow (shows 2 fps here, actually it is 1 fps). I didn't look at the code, but you can get 50x (minimum!) the performance with pure software rendering.

Thank you so much for having that understanding, my game engine is similar to yours in the sense that it takes advantage of all the java api that will already be there for the user without having to download or update your OS/Computer and the fact that OpenGL is very complicated for newer game developers, having a simple easy game engine that deals with simple tasks can be rewarding to those just starting out. I remember how frustrating it was when I first started out, even with just programming itself.
28  Game Development / Shared Code / Re: Source Code for sample game made by Easy Clip2D on: 2011-06-14 08:27:12
The server is down right now. Please follow us on Twitter http://twitter.com/EasyClip2D


I've made a lot of updates to the game engine so the source game may not work but if it does then great.
29  Discussions / Business and Project Management Discussions / Easy Clip2D Discussion on: 2011-06-06 04:04:46
1
30  Game Development / Shared Code / Re: Source Code for sample game made by Easy Clip2D on: 2011-06-05 04:55:02
The server is down right now. Please follow us on Twitter http://twitter.com/EasyClip2D
Pages: [1] 2
 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

atombrot (26 views)
2014-08-19 09:29:53

Tekkerue (24 views)
2014-08-16 06:45:27

Tekkerue (23 views)
2014-08-16 06:22:17

Tekkerue (14 views)
2014-08-16 06:20:21

Tekkerue (22 views)
2014-08-16 06:12:11

Rayexar (60 views)
2014-08-11 02:49:23

BurntPizza (39 views)
2014-08-09 21:09:32

BurntPizza (30 views)
2014-08-08 02:01:56

Norakomi (37 views)
2014-08-06 19:49:38

BurntPizza (67 views)
2014-08-03 02:57:17
List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!