Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (487)
Games in Android Showcase (110)
games submitted by our members
Games in WIP (552)
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 3 ... 5
1  Java Game APIs & Engines / Java 2D / Re: setSize Bug or Feature in Frame class since 1.4? on: 2007-12-07 16:20:00
I don't see any bugs. Your code is correct but what you want to do with the processComponentEvent must be validated by re-packing again the Frame.
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
protected void processComponentEvent(ComponentEvent e)
    {
        if ( e.getID() == ComponentEvent.COMPONENT_SHOWN )
        {
            setMinimumSize(new Dimension(812, 612));
            setLocation(10, 10);
            setMinimumSize(null);
            pack();
            repaint();
            System.out.println("COMPONENT_SHOWN");
        }
    }
Smiley

pack is obsolete, i have no LayoutManager, i use setSize instead of pack, i tried it with pack and preferedSize ( which muste be set when using pack, otherwise window is very very small :-)

same result problem is not pack or setSize, Problem is java is limiting setSize, when i make the Frame resizable and the user ( me ) is making the frame bigger, its working ...

Workaround for Java 1.6 is using setMinimumSize which is forcing the window bigger :-)

I file this as bug and will post here the bug id when it is public available
2  Java Game APIs & Engines / Java 2D / Re: setSize Bug or Feature in Frame class since 1.4? on: 2007-12-06 16:40:20
Here is a little Test Programm you may run it under 1.6.0_03 as application or as applet

TestApplet.java Class

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  
/**************************************************************************************************
 *
 *************************************************************************************************/


import java.applet.*;

/**************************************************************************************************
 *
 *************************************************************************************************/

public class TestApplet extends Applet
{
    private final static long serialVersionUID = 654321; // keep the compiler happy

    /**********************************************************************************************
     *
     *********************************************************************************************/

    public void init()
    {
    }

    /**********************************************************************************************
     *
     *********************************************************************************************/

    public void start()
    {
        TestFrame.main(null);
    }

    /**********************************************************************************************
     *
     *********************************************************************************************/

    public void stop()
    {
    }

    /**********************************************************************************************
     *
     *********************************************************************************************/

    public void destroy()
    {
    }
}

/*************************************************************************************************/


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  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
/**************************************************************************************************
 *
 *************************************************************************************************/


import java.awt.*;
import java.awt.event.*;
import java.awt.image.*;

import javax.swing.*;

/**************************************************************************************************
 *
 *************************************************************************************************/

public class TestFrame extends Frame
{
    private final static long serialVersionUID = 123456; // keep the compiler happy

    private final static int WIDTH = 900;
    private final static int HEIGHT = 700;

    /**********************************************************************************************
     *
     *********************************************************************************************/

    static public void main(String[] args)
    {
        try
        {
            TestFrame aFrame = new TestFrame();

            aFrame.enableEvents(AWTEvent.COMPONENT_EVENT_MASK);
            aFrame.setBounds(0, 0, TestFrame.WIDTH, TestFrame.HEIGHT);
            aFrame.setLayout(null);
            aFrame.setResizable(false);
            aFrame.setTitle("TestFrame");
            aFrame.setBackground(Color.red);
            aFrame.setVisible(true);
        }
        catch ( Exception ex )
        {
            ex.printStackTrace();
        }
    }

    /**********************************************************************************************
     * is called when parts of the peer are damaged and needs redraw
     *********************************************************************************************/

    protected void processComponentEvent(ComponentEvent e)
    {
        if ( e.getID() == ComponentEvent.COMPONENT_SHOWN )
        {
            setMinimumSize(new Dimension(812, 612));
            setLocation(10, 10);
            setMinimumSize(null);
            System.out.println("COMPONENT_SHOWN");
        }
    }

    /**********************************************************************************************
     * is called when parts of the peer are damaged and needs redraw
     *********************************************************************************************/

    public void paint(Graphics gg)
    {
        gg.setColor(Color.blue);
        gg.fillRect(0, 0, TestFrame.WIDTH - 20, TestFrame.HEIGHT - 20);

        gg.setColor(Color.black);
        gg.drawString("Hello World :-)", 20, 50);

        gg.drawString(getWidth() + "x" + getHeight(), 20, 100);
    }

    /**********************************************************************************************
     * triggered by repaint
     *********************************************************************************************/

    public void update(Graphics gg)
    {
        paint(gg);
    }
}

/*************************************************************************************************/


First run it with the processComponentEvent method commented out and you will see under a 800x600 desktop the window size is screen size minus screen insets, now uncomment the processComponentEvent and the window size is bigger.

Is this a bug ? or a feature ?
3  Java Game APIs & Engines / Java 2D / setSize Bug or Feature in Frame class since 1.4? on: 2007-12-06 14:06:00
I have a application/applet which is creating Frame's of differnt size, some are 900 x 700 ( client size ), so they are a little bit bigger with the insets.

Problem is when the screen size is set to 800 x 600.

In my program as a application running under java 1.6.0_03 ( latest stable version available ) its running fine and creating a Frame of size 812 x 612 ( this is ok windows XP restricts frame to this size ).

When i run my program as a applet under MSIE 6.0 using java 1.6.0_03 as a plugin, the size of the Frame is the ScreenSize minus Screen Insets. setSize is not able to make my Frame bigger.

My Frame is resizable, when the user is making it bigger by dragging at the frame edges, the frame is resizing to 812 x 612

This is a strange and unwanted behaviour, is this a bug or a feature, any workaround known.

This strange behaviour does not happen with java 1.1 or with M$ java 1.1.4

I notice this strange frame behaviour in applets since version 1.4
4  Java Game APIs & Engines / Java 2D / Re: Please try the new Direct3D 9 pipeline in 6uN EA on: 2007-11-18 02:54:51
Also, AFAIK non-rectangular and translucent windows are being worked on for Java 7.

Dmitri


This would be great, real transparent native windows :-)
5  Java Game APIs & Engines / Java 2D / Re: Please try the new Direct3D 9 pipeline in 6uN EA on: 2007-11-16 14:55:00
@trembovetski

When you derive my test16 Frame from JFRame, no native background erase takes place, but when i resize ( make it bigger ) then its erasing the background Huh strange behaviour.

What i need is native window ( a awt frame ) which can disable native background erasing in all cases, so i can develop for e.g. a program which has a non rectangular window ( for e.g. a java clock :-) ).

On some gfx cards window resizing flickers ( check my last post its a nvidia card which is having this problem ), on a resize the native background erase is triggered, if a awt frame has a function like

disableNativeBackgroundErase

have a look at sun.awt.windows.WCanvasPeer
6  Java Game APIs & Engines / Java 2D / Re: Please try the new Direct3D 9 pipeline in 6uN EA on: 2007-11-16 13:33:10
Will it be possible to disable  background erasing on native frames ? at the moment this can be done by specifying sun.awt.noerasebackground and sun.awt.erasebackgroundonresize.

my program will run as applet and application, so i cant set the global noerasebackground options :-(

I have a application which will disable the frame decoration and draw its own non rectangular frame, problem is the white rectangular native background, swing is doing it, why not allow other swing like things this also ?

Should i file a RFE for this ?

7  Java Game APIs & Engines / Java 2D / Re: Please try the new Direct3D 9 pipeline in 6uN EA on: 2007-11-08 20:43:33
Quote
Starting with 6uN you can assume that if the image (back-buffer)
is accelerated then most operations to and from it are
accelerated.

ok i will use this logic

here some test from me, works fine on this chipset, my real applet with lots of components which has normally a 20ms rendering time was speeded up to 6ms per frame, wow thats fast.

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  
C:\TEMP\marcus>c:\programme\java\jre6\bin\java.exe -Dsun.java2d.trace=log -Dsun.
java2d.d3d=True -classpath ".;c:\programme\java\jre6\lib\rt.jar" test16
[I] CheckAdaptersInfo
[I] ------------------
[I] Adapter Ordinal  : 0
[I] Adapter Handle   : 0x10001
[I] Description      : ATI RADEON 9600 Series
[I] GDI Name, Driver : \\.\DISPLAY1, ati2dvag.dll
[I] Vendor Id        : 0x1002
[I] Device Id        : 0x4151
[I] SubSys Id        : 0x40361458
[I] Driver Version   : 6.14.10.6387
[I] GUID             : D7B71EE2-0211-11CF-1B6F3C60A1C2CB35
[I] ------------------
[I] InitD3D: successfully created Direct3D9 object
[I] D3DGD_getDeviceCapsNative
[I] D3DPPLM::CheckDeviceCaps: adapter 0: Passed
[I] D3DContext::InitContext device 0
[I] D3DContext::ConfigureContext device 0
[I] D3DContext::ConfigureContext: successfully created device: 0
[I] D3DContext::InitDevice: device 0
[I] D3DContext::InitDefice: successfully initialized device 0
[V]   | CAPS_DEVICE_OK
[V]   | CAPS_ALPHA_RT_PLAIN
[V]   | CAPS_ALPHA_RTT
[V]   | CAPS_OPAQUE_RTT
[V]   | CAPS_LCD_SHADER | CAPS_BIOP_SHADER
[V]   | CAPS_MULTITEXTURE
[V]   | CAPS_TEXNONSQUARE
Direct3D pipeline enabled on screen 0
D3DFillRect
D3DFillRect
D3DFillRect
created offscreen image sun.awt.image.SunVolatileImage@128e20a accelerated=true
volatile=true
D3DFillRect
D3DFillRect
D3DDrawGlyphs
sun.java2d.d3d.D3DRTTSurfaceToSurfaceTransform::TransformBlit("D3D Surface (rend
er-to-texture)"
, AnyAlpha, "D3D Surface")
> paint took 25225 mikro seconds
D3DFillRect
D3DDrawGlyphs
sun.java2d.d3d.D3DRTTSurfaceToSurfaceTransform::TransformBlit("D3D Surface (rend
er-to-texture)"
, AnyAlpha, "D3D Surface")
> paint took 1004 mikro seconds


I had problems with WM_ERASEBACKGROUND on this chipset, will resizing it background gets erased by native code, thats why i asked for a method to disable background erasing ( like in the JFrame's ).

remember this
Quote
TESTCASE3: run test16 with 1.6 update 3 on my 945G it flickers when i move another application ( like calc.exe ) over my window, its caused by
Toolkit.getDefaultToolkit().sync() when i comment out this line it does not flicker, or when i set sun.awt.noerasebackground=true.

Nice would be a function like setEraseBackground(boolean) for heavyweight components :-)

This flicker happens on my 945 (Dell Dimension 5100) but not on a 865 ( Dell Dimension 3000 )


Hmm. Looks like there was some bug which triggered this cascade of issues.

this flickering does not happen when i disable D3D or when i run it on a different pc, i removed Toolkit.getDefaultToolkit().sync() still flickering


Quote
Hmm. Did you override update() method in your hw component? Because if you didn't
the default behavior is to clear the background:

yes have a look at java16, update is overwritten, its calling paint ( not at all the best, i use different code in my applets )
8  Java Game APIs & Engines / Java 2D / Re: Please try the new Direct3D 9 pipeline in 6uN EA on: 2007-11-08 16:38:04
Quote
Quote
A good idea would be to allow us to override default behavior, sun.awt.noerasebackground is not allowed for applets, so i cant use it.

Java using D3D rocks 

Why is it bothering you though? Do you see any artifacts or something?

Some applets/application and also my applet/application is drawing a backdrop, so first client rect is filled with color then overpainted with backdrop, only for speed reasons ( WM_ERASEBACKGROUND was done using GDI in previous release, i think you fixed it in 6uN and its using D3D ), but i think its better to file a RFE for this, its a good feature, so a Window could have a function like setEraseBackground or setOpaque.


It would be very helpfull i we can detect if hardware acceleration is enabled and used, like for me i am drawing a scaled image on the fly and set Image Rendering Hints to NEAREST_NEIGHBOUR, how can i detect that this pc can use hw acceleration when i set Image Rendering Hints to

g2.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);

they idea is to set interpolation to nearest neighbour for all, but for those who have better gfx cards set it to bilinear ( which is much smoother )

with hw acceleration a frame takes 5ms without 200ms, so it would be nice if we get something were we can ask for things like that.

P.S.: i will run my littele Testprogramm test16 on some other pc's with update6 and give u some feedback about what happened ( surprise surprise )
9  Java Game APIs & Engines / Java 2D / Re: Please try the new Direct3D 9 pipeline in 6uN EA on: 2007-11-05 19:22:21
running test16.java with build06

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  
D:\projects\eden\src>d:\jre1.6ea\bin\java.exe -Dsun.java2d.d3d=True -Dsun.java2d
.trace=log -classpath ".;d:\jre1.6ea\lib\rt.jar" test16
[I] CheckAdaptersInfo
[I] ------------------
[I] Adapter Ordinal  : 0
[I] Adapter Handle   : 0x10001
[I] Description      : Intel(R) 82945G Express Chipset Family
[I] GDI Name, Driver : \\.\DISPLAY1, ialmrnt5.dll
[I] Vendor Id        : 0x8086
[I] Device Id        : 0x2772
[I] SubSys Id        : 0x1ab1028
[I] Driver Version   : 6.14.10.4299
[I] GUID             : D7B78E66-6432-11CF-5363A121A3C2CB35
[I] ------------------
[I] InitD3D: successfully created Direct3D9 object
[I] D3DGD_getDeviceCapsNative
[I] D3DPPLM::CheckDeviceCaps: adapter 0: Passed
[I] D3DContext::InitContext device 0
[I] D3DContext::ConfigureContext device 0
[I] D3DContext::ConfigureContext: successfully created device: 0
[I] D3DContext::InitDevice: device 0
[W] D3DContext::InitDevice: sync query not available
[I] D3DContext::InitDefice: successfully initialized device 0
[V]   | CAPS_DEVICE_OK
[V]   | CAPS_ALPHA_RT_PLAIN
[V]   | CAPS_ALPHA_RTT
[V]   | CAPS_OPAQUE_RTT
[V]   | CAPS_LCD_SHADER | CAPS_BIOP_SHADER
[V]   | CAPS_MULTITEXTURE
[V]   | CAPS_TEXNONSQUARE
Direct3D pipeline enabled on screen 0
D3DFillRect
D3DFillRect
D3DFillRect
created offscreen image sun.awt.image.SunVolatileImage@e4f972 accelerated=true v
olatile=true
D3DFillRect
D3DFillRect
D3DDrawGlyphs
sun.java2d.d3d.D3DRTTSurfaceToSurfaceScale::ScaledBlit("D3D Surface (render-to-t
exture)"
, AnyAlpha, "D3D Surface")
> paint took 28946 mikro seconds
D3DFillRect
D3DDrawGlyphs
sun.java2d.d3d.D3DRTTSurfaceToSurfaceScale::ScaledBlit("D3D Surface (render-to-t
exture)"
, AnyAlpha, "D3D Surface")
> paint took 4846 mikro seconds


when i use BILINEAR interpolation its really fast, tested with my real program, frame time was ~180ms with build05, and is now 5ms with build06

But i think the 945G has some driver bugs? hardware scaling thru D3D texture seems ok

BUT i have one big problem which blow up my hole pc, the gfx card driver stopped working  Cry

When i use managed images, the screen gets corrupted and strange things happens, pc reboot, freezing, gfx card driver stopped working, fall back to standard driver.

WM_ERASEBACKGROUND is now using D3D, but why do awt frames use it and Jframes not, when u modify my test16 and subclass test16 from jframe background ist not erased.

A good idea would be to allow us to override default behavior, sun.awt.noerasebackground is not allowed for applets, so i cant use it.

Java using D3D rocks  Cool

10  Java Game APIs & Engines / Java 2D / Re: Please try the new Direct3D 9 pipeline in 6uN EA on: 2007-11-02 15:56:34
Having said all that it would be more efficient if you converted
your application to using the default BufferStrategy.

Dmitri


My program has to be compatible with pre java 1.4 jvm's where it uses normal offscreen buffers, so i used this vi double buffering


This is the output from java16 on a new desktop pc, this Radeon should have a v3.0 Pixel Shader

using update5, i think u ran java16 on update 6 ( which is not available for the public )

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  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
[I] CheckAdaptersInfo
[I] ------------------
[I] Adapter Ordinal  : 0
[I] Description      : Radeon X1300/X1550 Series
[I] GDI Name, Driver : \\.\DISPLAY2, atiumdag.dll
[I] Vendor Id        : 0x1002
[I] Version          : 7.14.10.532
[I] ------------------
[I] Adapter Ordinal  : 1
[I] Description      : Radeon X1300/X1550 Series
[I] GDI Name, Driver : \\.\DISPLAY1, atiumdag.dll
[I] Vendor Id        : 0x1002
[I] Version          : 7.14.10.532
[I] ------------------
[I] InitD3D: successfully created Direct3D9 object
[I] D3DGD_getDeviceCapsNative
[I] D3DPPLM::CheckDeviceCaps: device 0: Passed
[I] D3DContext::InitContext device 0
[I] D3DContext::ConfigureContext device 0
[I] D3DContext::ConfigureContext: successfully created device: 0
[I] D3DContext::InitDevice: device 0
[I] D3DContext::InitDefice: successfully initialized device 0
[V]   | CAPS_DEVICE_OK
[V]   | CAPS_ALPHA_RT_PLAIN
[V]   | CAPS_ALPHA_RTT
[V]   | CAPS_OPAQUE_RTT
[V]   | CAPS_LCD_SHADER | CAPS_BIOP_SHADER
[V]   | CAPS_MULTITEXTURE
[V]   | CAPS_TEXNONSQUARE
[I] D3DGD_getDeviceCapsNative
[I] D3DPPLM::CheckDeviceCaps: device 1: Passed
[I] D3DContext::InitContext device 1
[I] D3DContext::ConfigureContext device 1
[I] D3DContext::ConfigureContext: successfully created device: 1
[I] D3DContext::InitDevice: device 1
[I] D3DContext::InitDefice: successfully initialized device 1
[V]   | CAPS_DEVICE_OK
[V]   | CAPS_ALPHA_RT_PLAIN
[V]   | CAPS_ALPHA_RTT
[V]   | CAPS_OPAQUE_RTT
[V]   | CAPS_LCD_SHADER | CAPS_BIOP_SHADER
[V]   | CAPS_MULTITEXTURE
[V]   | CAPS_TEXNONSQUARE
GDIFillRect
D3DFillRect
created offscreen image sun.awt.image.SunVolatileImage@4b4333 accelerated=true v
olatile=true
D3DFillRect
D3DFillRect
D3DDrawGlyphs
sun.java2d.loops.Blit$GeneralMaskBlit::Blit("D3D Surface (render-to-texture)", S
rcNoEa, IntRgb)
sun.java2d.loops.MaskBlit$General::MaskBlit("D3D Surface (render-to-texture)", S
rcNoEa, IntRgb)
sun.java2d.d3d.D3DSurfaceToSwBlit::Blit("D3D Surface", SrcNoEa, IntArgb)
sun.java2d.loops.MaskBlit::MaskBlit(IntArgb, AnyAlpha, IntRgb)
sun.java2d.loops.TransformHelper::TransformHelper(IntRgb, SrcNoEa, IntArgbPre)
> paint took 140065 mikro seconds
D3DFillRect
D3DDrawGlyphs
sun.java2d.loops.Blit$GeneralMaskBlit::Blit("D3D Surface (render-to-texture)", S
rcNoEa, IntRgb)
sun.java2d.loops.MaskBlit$General::MaskBlit("D3D Surface (render-to-texture)", S
rcNoEa, IntRgb)
sun.java2d.d3d.D3DSurfaceToSwBlit::Blit("D3D Surface", SrcNoEa, IntArgb)
sun.java2d.loops.MaskBlit::MaskBlit(IntArgb, AnyAlpha, IntRgb)
sun.java2d.loops.TransformHelper::TransformHelper(IntRgb, SrcNoEa, IntArgbPre)
> paint took 51072 mikro seconds


i am using this version

java version "1.6.0_05-ea"
Java(TM) SE Runtime Environment (build 1.6.0_05-ea-b05)
Java HotSpot(TM) Client VM (build 1.6.0_05-ea-b05, mixed mode, sharing)

Quote
It appears that there was a bug which I can not reproduce now on b06 - I
always get d3d-only operations, even for the 'erase background' fillRect.

when this version is available for everybody i will rerun this test on the pc with the Radeon X1300 i also have a pc with Radeon 9600.
11  Java Game APIs & Engines / Java 2D / Re: Please try the new Direct3D 9 pipeline in 6uN EA on: 2007-11-01 13:35:28
@trembovetski

Here comes my small test programm test16.java and the starting programm test16.bat (so u can see what options i use )

1  
2  
set J2D_TRACE_LEVEL=5
d:\jre1.6ea\bin\java.exe -Dsun.java2d.trace=log -classpath ".;d:\jre1.6ea\lib\rt.jar" test16


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  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
82  
83  
84  
85  
86  
87  
88  
89  
90  
91  
92  
93  
94  
95  
96  
97  
98  
99  
100  
101  
102  
103  
104  
105  
106  
107  
108  
109  
110  
111  
112  
113  
114  
115  
/**************************************************************************************************
 *
 *************************************************************************************************/


import java.awt.*;
import java.awt.event.*;
import java.awt.image.*;

/**************************************************************************************************
 * Double buffering test with 1 backbuffer
 *************************************************************************************************/

public class test16 extends Frame
{
    private final static long serialVersionUID = 123456; // keep the compiler happy

    private final static int WIDTH = 200;
    private final static int HEIGHT = 200;

    private Image offscreen;

    /**********************************************************************************************
     *
     *********************************************************************************************/

    static public void main(String[] args)
    {
        test16 aFrame = new test16();
        aFrame.setBounds(0, 0, 800, 600);
        aFrame.setLayout(null);
        aFrame.setResizable(false);
        aFrame.setTitle("Java 1.6 Double Buffer Test");
        aFrame.setBackground(Color.red);
        aFrame.setVisible(true);
    }

    /**********************************************************************************************
     *
     *********************************************************************************************/

    private void createOffscreen()
    {
        if ( null != offscreen )
        {
            offscreen.flush();
            offscreen = null;
        }

        offscreen = getGraphicsConfiguration().createCompatibleVolatileImage(WIDTH, HEIGHT);
        System.out.println("created offscreen image " + offscreen + " accelerated=" + offscreen.getCapabilities(getGraphicsConfiguration()).isAccelerated() + " volatile=" + offscreen.getCapabilities(getGraphicsConfiguration()).isTrueVolatile());
    }

    /**********************************************************************************************
     *
     *********************************************************************************************/

    private void validateOffscreen()
    {
        if ( offscreen instanceof VolatileImage )
        {
            VolatileImage aImage = (VolatileImage)offscreen;

            if ( aImage.validate(getGraphicsConfiguration()) == VolatileImage.IMAGE_INCOMPATIBLE )
            {
                createOffscreen();

                // revalidate offscreen
               ((VolatileImage)offscreen).validate(getGraphicsConfiguration());
            }
        }
    }

    /**********************************************************************************************
     * is called when parts of the peer are damaged and needs redraw
     *********************************************************************************************/

    public void paint(Graphics gg)
    {
        long startTime = System.nanoTime();

        if ( null == offscreen )
        {
            createOffscreen();
        }
        validateOffscreen();

        Graphics ogr = offscreen.getGraphics();

        ogr.setColor(Color.blue);
        ogr.fillRect(0, 0, WIDTH - 20, HEIGHT - 20);

        ogr.setColor(Color.black);
        ogr.drawString("Hello", 20, 50);

        ogr.dispose();
        gg.drawImage(offscreen, 0, 0, WIDTH, HEIGHT, this);

        Toolkit.getDefaultToolkit().sync(); // flush the pipeline

        long stopTime = System.nanoTime();
        if ( (startTime > 0) && (stopTime > 0) && (stopTime > startTime) )
        {
            long diffTime = stopTime - startTime;
            if ( diffTime > 0 )
            {
                System.out.println("> paint took " + (diffTime / 1000) + " mikro seconds");
            }
        }
    }

    /**********************************************************************************************
     * triggered by repaint
     *********************************************************************************************/

    public void update(Graphics gg)
    {
        paint(gg);
    }
}

/*************************************************************************************************/


when i run this program with 6uN i get this output

GDIFillRect
D3DFillRect
created offscreen image sun.awt.image.SunVolatileImage@dd5b accelerated=true vol
atile=true
D3DFillRect
D3DFillRect
D3DDrawGlyphs
sun.java2d.d3d.D3DSurfaceToGDIWindowSurfaceBlit::Blit("D3D Surface", AnyAlpha, "
GDI")
> paint took 26626 mikro seconds
sun.java2d.loops.FillRect::FillRect(AnyColor, SrcNoEa, AnyInt)
sun.java2d.loops.FillRect::FillRect(AnyColor, SrcNoEa, AnyInt)
sun.java2d.loops.DrawGlyphList::DrawGlyphList(AnyColor, SrcNoEa, AnyInt)
sun.java2d.windows.GDIBlitLoops::Blit(IntRgb, SrcNoEa, "GDI")
> paint took 11443 mikro seconds

the GDIFillRect is the background erase ( WM_ERASEBACKGROUND ) from the heavyweight Frame class

The red area in the frame is not painted by me, its the background set by setBackground
the white area is from the volatile image ( default color for a opaque image )
the blue area is from the fillrect

TESTCASE2: comment out validateOffscreen, screen will be red, the volatile image is NOT drawn ( compare with 1.6 update 3 where it works )

TESTCASE3: run test16 with 1.6 update 3 on my 945G it flickers when i move another application ( like calc.exe ) over my window, its caused by
Toolkit.getDefaultToolkit().sync() when i comment out this line it does not flicker, or when i set sun.awt.noerasebackground=true.

Nice would be a function like setEraseBackground(boolean) for heavyweight components :-)

This flicker happens on my 945 (Dell Dimension 5100) but not on a 865 ( Dell Dimension 3000 )

TESTCASE4: disable D3D with -Dsun.java2d.d3d=false with 6uN, GDI pipeline is used

I hope this helps

Question:

When i change Line 91 to this

1  
gg.drawImage(offscreen, 0, 0, WIDTH * 2, HEIGHT * 2, this);


Would 6uN accelerate it ? its scaling a volatile image on the fly. I have a application/applet which can be scaled, it has one heavyweight component the Frame with a VolatileImage as backbuffers, all other components are lighweight and draw into this volatile image, which is then scaled, it would be great if scaling is accelerated and
if we can specify the interpolation mode ( bilinear would be a great improvement )

P.S.: Which gfx card is recommended for 6uN Huh

Happy Halloween :-)
12  Java Game APIs & Engines / Java 2D / Re: Please try the new Direct3D 9 pipeline in 6uN EA on: 2007-10-31 03:35:48
@trembovetski

i have a applet/application which is doing the following pseudo code in the frame's paint method

create a offscreen buffer on VRAM ( VolatileImage )
draw something on that offscreen buffer
draw the offscreen buffer on the screen ( offscreen buffer on VRAM is drawn thru drawImage to visible portion of VRAM ) blit is accelerated

thats the trace ( running it with java 1.6.0_03 and no special sun.java2d, except trace enabled )
DXFillRect
DXFillRect
sun.java2d.loops.DrawGlyphList::DrawGlyphList(AnyColor, SrcNoEa, AnyInt)
sun.java2d.windows.DDBlitLoops::Blit("Integer RGB DirectDraw", SrcNoEa, "Integer RGB DirectDraw")

when i set sun.java2d.d3d=True i get ( D3D pipeline was actived correctly )
Direct3D pipeline enabled on screen 0
D3DFillRect
D3DFillRect
D3DDrawGlyphs
sun.java2d.windows.DDBlitLoops::Blit("Integer RGB DirectDraw", SrcNoEa, "Integer RGB DirectDraw")

you are not using D3DBlitLoops ( this is confusing me ) when d3d is enabled, also time for rendering is around 6ms with d3d enabled and 4ms with d3d disabled, seems like d3d is broken or not working correct.

Ok now i give 6uN a try and trace looks like this  Shocked (D3D pipeline was actived correctly)

Direct3D pipeline enabled on screen 0
sun.java2d.loops.FillRect::FillRect(AnyColor, SrcNoEa, AnyInt)
sun.java2d.loops.FillRect::FillRect(AnyColor, SrcNoEa, AnyInt)
sun.java2d.loops.DrawGlyphList::DrawGlyphList(AnyColor, SrcNoEa, AnyInt)
sun.java2d.windows.GDIBlitLoops::Blit(IntRgb, SrcNoEa, "GDI")

rendering time is 3ms, but can u please explain me the trace output, is it using the new d3d pipeline, i am confused ...

this is output from trace J2D_TRACE_LEVEL=5

CheckAdaptersInfo
------------------
Adapter Ordinal  : 0
Description      : Intel(R) 82945G Express Chipset Family
GDI Name, Driver : \\.\DISPLAY1, igxprd32.dll
Vendor Id        : 0x8086
Version          : 6.14.10.4764
------------------
InitD3D: successfully created Direct3D9 object
D3DGD_getDeviceCapsNative
D3DPPLM::CheckDeviceCaps: device 0: Passed
D3DContext::InitContext device 0
D3DContext::ConfigureContext device 0
D3DContext::ConfigureContext: successfully created device: 0
D3DContext::InitDevice: device 0
[W] D3DContext::InitDevice: sync query not available
D3DContext::InitDefice: successfully initialized device 0
[V]   | CAPS_DEVICE_OK
[V]   | CAPS_ALPHA_RT_PLAIN
[V]   | CAPS_ALPHA_RTT
[V]   | CAPS_OPAQUE_RTT
[V]   | CAPS_LCD_SHADER | CAPS_BIOP_SHADER
[V]   | CAPS_MULTITEXTURE
[V]   | CAPS_TEXNONSQUARE

something is wrong, if this version gets not fixed, a lot of existing applications get killed, from acceleration to software loop, oops

this happens when i draw the volatile image ( offscreen ) to onscreen ( scaling on the fly )

D3DFillRect
D3DFillRect
D3DDrawGlyphs
sun.java2d.loops.Blit$GeneralMaskBlit::Blit("D3D Surface (render-to-texture)", S
rcNoEa, IntRgb)
sun.java2d.loops.MaskBlit$General::MaskBlit("D3D Surface (render-to-texture)", S
rcNoEa, IntRgb)
sun.java2d.d3d.D3DSurfaceToSwBlit::Blit("D3D Surface", SrcNoEa, IntArgb)
sun.java2d.loops.MaskBlit::MaskBlit(IntArgb, AnyAlpha, IntRgb)
sun.java2d.loops.TransformHelper::TransformHelper(IntRgb, SrcNoEa, IntArgbPre)

Note: this renders in 140ms,  what happend ? u3 needs only 4ms

applets with version 1.6.0_03 are rendering this in 4 ms

DXFillRect
DXFillRect
sun.java2d.loops.DrawGlyphList::DrawGlyphList(AnyColor, SrcNoEa, AnyInt)
sun.java2d.loops.ScaledBlit::ScaledBlit(IntRgb, SrcNoEa, IntRgb)

I can give u a test applet/application if you want one  Smiley



13  Java Game APIs & Engines / Java 2D / Re: Making an Applet repaint in 1.1 compatible on: 2004-12-10 08:22:18
AWT repaint and update 101:

the function repaint in class Component will be called by system when some part of the peer needs redraw ( use a window to rub over your component you will see repaint will be called ) NEVER NEVER NEVER call it by your code.

the function update will be called by java whenever your component triggered repaint ( multiple calls to repaint maybe combined to one call to update for perfomance reasons)

i hope this helps blah * 3
14  Java Game APIs & Engines / Java 2D / Re: AWT ignores setColor() !!! ? on: 2004-12-10 08:17:35
i am a Swing n0Ob  Cool Tongue Lips Sealed

worked for 5 years only with awt
15  Discussions / Miscellaneous Topics / Re: java 1.6.0ea on: 2004-12-07 09:32:38
thank you, but why do the upgrade major version so quick ? there is something fishy about this, why not use 1.5.1

1.5 ( or 5.0 ) is very very very buggy,  they add bugy so fast, i cant add the bugfixes and hotfixes to my applet grrrrrrrrr

*shakes head*
16  Discussions / Miscellaneous Topics / Re: Share the worst code you have ever seen... on: 2004-12-07 08:06:22

this was seen in java code ...

this = null;

Huh Tongue Lips Sealed
17  Discussions / Miscellaneous Topics / java 1.6.0ea on: 2004-12-07 08:05:01
Does this version really exist ? Or is somebody trtying to fool me ? Is sun already working on a new version Huh Is this version available as early download ?
18  Game Development / Performance Tuning / Re: Alternatives for instanceof on: 2004-09-02 11:25:20
1  
2  
3  
4  
class Applet
{
   public void eat();
}


think OO  Cool Question whats wrong with the Apple ? Roll Eyes
19  Java Game APIs & Engines / Java 2D / Re: A doc on most Java2D flags on: 2004-09-02 11:20:33
ah nice trembovetski, i will test this with 5.0 RC and play with the settings on my windows pc
20  Game Development / Networking & Multiplayer / Re: My UDP Protocol Wrapper on: 2004-08-20 08:23:17
hint: TCP needs ACK, UDP not

depends on what you need, you have to decide wether TCP is better for your game or UDP fits in your game.
21  Java Game APIs & Engines / Java 2D / Re: font difference between 1.1 and 1.4 on: 2004-08-18 08:28:01
ok seems the NEED_CONVERTED is causing this, i dont like variable fonts, so seems java fonts are not usable for me, thanks
22  Java Game APIs & Engines / Java 2D / Re: font difference between 1.1 and 1.4 on: 2004-08-18 07:17:24
but on windows 98 i should get for the same font the same height Huh

otherwise java useless, run program with 1.1 on same pc u get 15 pixels run it with 1.4 u get 16 pixel

do u understand what BIG problems this can be, the hole layout does no longer fit, after 20 lines of text i have 20 pixel less than under 1.1  Angry

is there any workaround Huh? trick or whatever to fix this without modifiying all my classes


i use sanserif which is mapped to arial under win98, different results between 1.1 and 1.4 15 and 16 pixels

second i use arial which is mapped to arial under win98 BUT NOW I GET 15 pixel for both 1.1 and 1.4

so 1 != 1 wtf ? or maybe 1 + 1 = 3 Huh

black magic Huh
23  Java Game APIs & Engines / Java 2D / font difference between 1.1 and 1.4 on: 2004-08-17 16:48:12
under 1.1.4 font sansserif size=12 has height 15 and under 1.4.2 it has height 16

thank you for being backwards compatible  Cry

is this a known bug HuhHuh

sanserif is mapped to Arial on both font.properties ( i checked it )
24  Game Development / Performance Tuning / drawImage with null or this ??? on: 2004-08-16 12:01:16
i draw my images with

g.drawImage(aImage, xpos, ypos, null);

the last parameter should be a ImageObserver ( a panel has a ImageObserver Interface )

whats the difference between using null or this, any speedups or any problem when i use null Huh?

Huh
25  Game Development / Performance Tuning / Re: Game Freeze! on: 2004-08-16 11:56:36
using png as animated object is no good idea, use your own animation engine

for e.g. you have a 50kb png with 20 frames and you clone it 100 times you will have 50kb times 100 memory wasted, if you use hw accel images ( these 20 frames ) and blit em like you want u use only 50kb.
26  Java Game APIs & Engines / Java 2D / Re: drawString appears offset in fullscreen!? on: 2004-08-13 11:30:14
if you draw a string at 0,0 simply add fm.getMaxAscent() to your y position and everything will be fine

Fontmetrics fm = getFont().getFontMetrics();

have a look at sun's java documentation and sun's java font beginners tutorial, it will help you to get started in java
27  Java Game APIs & Engines / Java 2D / Re: Browser Reload Problem with static control on: 2004-08-11 14:32:47
ok i managed to get a focus now, but there is no keyboard input possible.

my owner drawn control has now the focus, but it gets no key events, maybe the last instance is eating my key events grrrrrrrrrr

everything is fine when i use M$ 1.1 VM
28  Java Game APIs & Engines / Java 2D / Re: Bitmap Fonts under 1.5 and 1.1 on: 2004-08-06 09:09:16
thanks jbanes, i have already a well working pixel packer, and i am using a RGBFilter ( its the same method u use producer --> consumer model )

you only have to add a few lines ( very important for applets, create small classes ).

but it seems, there is at the moment no faster way to use bitmap fonts under 1.1 and 1.4 , so i guess i am doing everything alright ( applet is running smooth ), but i always think about improving and reducing the applet, that was the reason for me to start the thread.

I know nobody will post complete code or secrets ( i will never do because i am bound to nda ), but looking or discusiing about problems is, i think, ok and will not interfere with other problems ( like your boss )

P.S.: i do not recolor my fonts i hue 'em :-)
29  Java Game APIs & Engines / Java 2D / Re: Bitmap Fonts under 1.5 and 1.1 on: 2004-08-05 11:59:45
interesting --- never tried to create ( or dont know how to ) create a BufferedImage with a 8bit primitive , so my chars live in a DIB , lol

i am bound to 1.1 and upwards *coughs*, with 1.4 my bitmap drawing and colring is fast like hell, under 1.1 its normal speed, but it eats my image mem ( M$ was too lazy ) and after some time i am running out of memory ( depends on the size of user mem )

even a dispose DOES not help ( nah i am not deaf called this function ) the Image ( the native resources are held in mem )


time is running out for 1.1  only 60 days to go ....
30  Java Game APIs & Engines / Java 2D / Re: Bitmap Fonts under 1.5 and 1.1 on: 2004-08-05 08:37:41
ok sometimes i am paranoid, but it seems i am coding it the normal way.


Unfortunaly I HAVE TO stay 1.1 compatible, dont ask ...

20 years ago i coded bitmap fonts like i described above, so i was not thinking about the way i did it.

Question: Whats the best way for hueing a bitmap font, like i described or how to do it best under 1.4 and above Huh?
Pages: [1] 2 3 ... 5
 

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

The first screenshot will be displayed as a thumbnail.

CopyableCougar4 (23 views)
2014-08-22 19:31:30

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

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

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

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

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

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

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

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

Norakomi (41 views)
2014-08-06 19:49:38
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!