Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (476)
Games in Android Showcase (106)
games submitted by our members
Games in WIP (532)
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]
1  Java Game APIs & Engines / JOGL Development / Re: Need help splitting PNG images on: 2004-10-07 08:04:48
See nehe's tutorial Lesson 17:2D texture font, I found it's more effective to use Display Lists than to split png image into frames, is it right?!
2  Java Game APIs & Engines / JOGL Development / Re: Need help splitting PNG images on: 2004-10-05 03:30:04
I found the reason!!! I didn't create raster for each frame, but use one raster object for all frames. now it works, the right code is pasted below.

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
        if (bufferedImage.getColorModel().hasAlpha()) {
            for(int i= 0; i < totalFrame; i ++){
                raster = Raster.createInterleavedRaster(DataBuffer.TYPE_BYTE,width, height,4,null);
                frames[i] = new BufferedImage(glAlphaColorModel,raster,false,new Hashtable());
            }
        } else {
            for(int i= 0; i < totalFrame; i ++){
                raster = Raster.createInterleavedRaster(DataBuffer.TYPE_BYTE,width, height,3,null);
                frames[i] = new BufferedImage(glColorModel,raster,false,new Hashtable());
            }
        }
3  Java Game APIs & Engines / JOGL Development / Re: Need help splitting PNG images on: 2004-10-03 16:05:37
I am learning the example of lwjgl 0.92, the spaceinvaders.I try to combine 3 alien sprite images into one png file.It's very useful, isn't it?
the code is listed below.
my problem is:the first frame is correct, and the second is wrong, it's actually a mixture of the first and the second sprite. the third is wrong either. it's a mixture of all sprite.
if I add a statement like g.clearRect(...)(see the code below), it works, the animate can play correctly, but transparent lost.
does anybody can tell me why, and how to solve this problem. thanks.
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  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
    public Texture getFrameTexture(String resourceName, int width, int height,
                                   int frame) throws IOException {
        Texture tex = (Texture) table.get(resourceName+frame);

        if (tex != null) {
            return tex;
        }

        BufferedImage bufferedImage = loadImage(resourceName);
        int totalFrame = bufferedImage.getWidth()/width;

        if(frame >= totalFrame){
            frame = 0;
            tex = (Texture) table.get(resourceName+frame);
            if (tex != null) {
                return tex;
            }
        }

        WritableRaster raster;
        BufferedImage[] frames = new BufferedImage[totalFrame];

        if (bufferedImage.getColorModel().hasAlpha()) {
            raster = Raster.createInterleavedRaster(DataBuffer.TYPE_BYTE,width, height,4,null);
            for(int i= 0; i < totalFrame; i ++){
                frames[i] = new BufferedImage(glAlphaColorModel,raster,false,new Hashtable());
            }
        } else {
            raster = Raster.createInterleavedRaster(DataBuffer.TYPE_BYTE,width, height,3,null);
            for(int i= 0; i < totalFrame; i ++){
                frames[i] = new BufferedImage(glColorModel,raster,false,new Hashtable());
            }
        }

        //??????????????????????????????????????????????????????
       // problem is here?????????????????????????????????????????
       Graphics g=null;
        for(int i = 0; i < totalFrame; i ++){
            g = frames[i].getGraphics();
            //g.clearRect(0,0,width, height); //it works, but transparent lost.
           g.drawImage(bufferedImage, -i*width, 0, null);

            tex = getTexture(frames[i],
                    GL11.GL_TEXTURE_2D, // target
                   GL11.GL_RGBA,     // dst pixel format
                   GL11.GL_LINEAR, // min filter (unused)
                   GL11.GL_LINEAR);

            table.put(resourceName+i,tex);
        }
        //end problem????????????????????????????????????????????

        return (Texture) table.get(resourceName+frame);
    }
4  Java Game APIs & Engines / JOGL Development / Re: Expert help needed! on: 2004-10-02 07:44:50
I still don't know how to do it? I am an opengl beginner,would you please give me some code on this problem?
5  Games Center / Archived Projects / Re: JAVAsteroids on: 2004-09-30 03:22:57
it works on my computer.  very good, i like it.

win2000
jre 1.4.1

INTEL Celeron4 2.0G
gf mx440
memory 256M
sound on board
6  Java Game APIs & Engines / OpenGL Development / Re: Does my game work on your machines? on: 2004-09-21 03:44:36
it works.
intel 82845G graphics card,win2000,firefox
7  Games Center / Archived Projects / made in china,great! on: 2004-03-26 01:29:03
Smiley
would you please give me a test account?
8  Games Center / Archived Projects / good!!! on: 2004-02-23 02:50:27
thanks Grin Shocked
9  Java Game APIs & Engines / J2ME / Re: Transparent PNGs in MIDP1.0 on: 2003-06-04 06:13:12
in midp1.0, png32 or png24 transparent is supported. In photoshop ImageReady7.0, create a transparent image, and save the image as png24 or png32 format, and transparent is supported. I have finish a game like this.
Pages: [1]
 

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

The first screenshot will be displayed as a thumbnail.

pw (17 views)
2014-07-24 01:59:36

Riven (17 views)
2014-07-23 21:16:32

Riven (14 views)
2014-07-23 21:07:15

Riven (17 views)
2014-07-23 20:56:16

ctomni231 (45 views)
2014-07-18 06:55:21

Zero Volt (40 views)
2014-07-17 23:47:54

danieldean (32 views)
2014-07-17 23:41:23

MustardPeter (36 views)
2014-07-16 23:30:00

Cero (51 views)
2014-07-16 00:42:17

Riven (50 views)
2014-07-14 18:02:53
HotSpot Options
by dleskov
2014-07-08 03:59:08

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:58:24

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:47:22

How do I start Java Game Development?
by ra4king
2014-05-17 11:13:37

HotSpot Options
by Roquen
2014-05-15 09:59:54

HotSpot Options
by Roquen
2014-05-06 15:03:10

Escape Analysis
by Roquen
2014-04-29 22:16:43

Experimental Toys
by Roquen
2014-04-28 13:24:22
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!