Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (539)
Games in Android Showcase (132)
games submitted by our members
Games in WIP (603)
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  Game Development / Game Mechanics / Re: [OdeJava] Howto getting odejave to run under Mac OS X 10.5 Leopard? on: 2007-12-17 18:16:43
I already tried that, without a result. At the moment the ode people managed it to totally break the code for me, so I hope you get pre-build libs and jars that are running on my mac up into the repository Smiley
2  Game Development / Game Mechanics / Re: [OdeJava] Howto getting odejave to run under Mac OS X 10.5 Leopard? on: 2007-12-17 16:21:06
They answered my question/bugreport
Quote
did you try "./configure --disable-demos"
since then ode runs flawlessly under leopard for me
since the buildscript calls the opende configure script with --disable-demos , there could be some problem with my leopard installation, or the answering person has some problems with his Smiley
3  Game Development / Game Mechanics / Re: [OdeJava] Howto getting odejave to run under Mac OS X 10.5 Leopard? on: 2007-12-16 15:37:43
ok, thx a lot for your help, I will stay tuned and post to the ode maillist about the libGL stuff.
4  Game Development / Game Mechanics / Re: [OdeJava] Howto getting odejave to run under Mac OS X 10.5 Leopard? on: 2007-12-16 12:50:20
I wanted to build it on my own, mainly because if I try to use the built libs in odejava/odejava-jni/bin together with the odejava.jar, which is build from the ant build.xml in odejava/odejava/build.xml I get the following error while calling: System.out.println(Odejava.getLibraryVersion());

1  
2  
3  
4  
0    [main] FATAL odejava  - Native code library failed to load. java.lang.UnsatisfiedLinkError: dCCylinderClass_get
Exception in thread "main" java.lang.NoClassDefFoundError
   at org.odejava.Odejava.getLibraryVersion(Odejava.java:140)
(...)


After I put the build-odejava-jni-osx.sh you pointed to me into a new, empty folder and executed it (after I set the env vars), it started to download (but the script downloads the head of odejava, and not the 'with-odejava-jni' branch). Configure went good, and even the uint32 duplicate define error was not there. But again, I got the error with the libGL.dylib:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
Making all in CppTestHarness
ld: cycle in dylib re-exports with /usr/X11/lib/libGL.dylib for architecture ppc
collect2: ld returned 1 exit status
ld: cycle in dylib re-exports with /usr/X11/lib/libGL.dylib for architecture i386
collect2: ld returned 1 exit status
lipo: can't open input file: /var/folders/2f/2fUhATI5EgOeAGzxoObLLE+++TI/-Tmp-//cc4RlXTX.out (No such file or directory)
make[2]: *** [ode_unit_test] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all-recursive] Error 1
opende make failed!

To fix (or suppress) it, I removed all '-L/-R /usr/X11/lib' occurrences in all Makefiles in the ode checkout the script made. Starting at 'Running make for ODE' I executed the commands from the script by hand, I advanced to the end of the script, and had a compiled libodejava.jnilib.
Then I built the odejava.jar with the odejava/odejava/build.xml file and ant, and copied the resulting jar (and the log4j jar) and the jnilib into my projects lib folder. I included the jar into the classpath, and set -Djava.library.path to the lib dir with the jnilib file.
Now I had the same setup like I had with the prebuild libs from the checkout, but executing System.out.println(Odejava.getLibraryVersion()); this time got me another error:
1  
2  
3  
4  
5  
6  
0    [main] FATAL odejava  - Native code library failed to load. java.lang.UnsatisfiedLinkError: /Users/jarod/diplom_arbeit/ode_opengl/lib/libodejava.jnilib: 
Exception in thread "main" java.lang.UnsatisfiedLinkError: ODEJAVA_VERSION_get
   at org.odejava.ode.OdeJNI.ODEJAVA_VERSION_get(Native Method)
   at org.odejava.ode.OdeConstants.<clinit>(OdeConstants.java:12)
   at org.odejava.Odejava.getLibraryVersion(Odejava.java:140)
(...)

5  Game Development / Game Mechanics / Re: [OdeJava] Howto getting odejave to run under Mac OS X 10.5 Leopard? on: 2007-12-15 22:12:53
first in reply to your 1 points:
1. I have installed automake 1.10
2. ok, I hasn't used the branch, but the head
rev 1323 sounds like SVN to me, but I only found a CVS repos on the https://odejava.dev.java.net/source/browse/odejava/ website.

Yesterday I started a new try, with (hopefully) the right branch, I downloaded the following:
cvs -d :pserver:username@cvs.dev.java.net:/cvs checkout odejava -r with-odejava-jni

Then I followed the odejava/odejava-jni/build/build-odejava-jni-osx.sh script:

sh-3.2# export JAVA_INCLUDE=/System/Library/Frameworks/JavaVM.framework/Home/include
sh-3.2# export DEV_SDK=/Developer/SDKs/MacOSX10.5.sdk/
sh-3.2# cat src/ode.patch|grep \(revision|head -1|sed -e 's/.*(revision \(.*\))/\1/'
1  
996

sh-3.2# svn -q co https://opende.svn.sourceforge.net/svnroot/opende/trunk opende -r 996
1  
2  
3  
4  
5  
6  
7  
8  
9  
Error validating server certificate for 'https://opende.svn.sourceforge.net:443':
 - The certificate is not issued by a trusted authority. Use the
   fingerprint to validate the certificate manually!
Certificate information:
 - Hostname: *.svn.sourceforge.net
 - Valid: from Oct  9 14:15:07 2007 GMT until Dec  8 15:15:07 2008 GMT
 - Issuer: Equifax Secure Certificate Authority, Equifax, US
 - Fingerprint: fb:75:6c:40:58:ae:21:8c:63:dd:1b:7b:6a:7d:bb:8c:74:36:e7:8a
(R)eject, accept (t)emporarily or accept (p)ermanently? t

sh-3.2# cd opende/
sh-3.2# patch -p0 < ../src/ode.patch
1  
2  
3  
4  
5  
6  
patching file include/ode/common.h
patching file include/ode/objects.h
patching file include/ode/odecpp.h
patching file ode/src/error.cpp
patching file ode/src/joint.cpp
patching file ode/src/joint.h

sh-3.2# sh autogen.sh
[Code]Please make sure that you use automake 1.8.2 or later
Warnings about underquoted definitions are harmless
Running aclocal
Running autoheader
Running automake
configure.in:5: installing `./config.sub'
configure.in:8: installing `./missing'
configure.in:8: installing `./install-sh'
configure.in:5: installing `./config.guess'
drawstuff/dstest/Makefile.am: installing `./depcomp'
Running autoconf
Now you are ready to run ./configure
[/code]
sh-3.2# automake --version
1  
2  
3  
4  
5  
6  
7  
automake (GNU automake) 1.10
Written by Tom Tromey <tromey@redhat.com>
       and Alexandre Duret-Lutz <adl@gnu.org>.

Copyright 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

sh-3.2# export CFLAGS="-arch ppc -arch i386 -isysroot $DEV_SDK"
sh-3.2# export CXXFLAGS=$CFLAGS
sh-3.2# ./configure --disable-dependency-tracking --without-tests
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  
checking build system type... i386-apple-darwin9.1.0
checking host system type... i386-apple-darwin9.1.0
checking target system type... i386-apple-darwin9.1.0
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... ./install-sh -c -d
checking for gawk... no
checking for mawk... no
checking for nawk... no
checking for awk... awk
checking whether make sets $(MAKE)... yes
checking for style of include used by make... GNU
checking for gcc... gcc
checking for C compiler default output file name... a.out
(...)
checking for isnan... yes
checking for isnanf... no
checking for _isnan... no
checking for _isnanf... no
checking for __isnan... yes
checking for __isnanf... yes
checking for working alloca.h... yes
checking for alloca... yes
checking for stdlib.h... (cached) yes
checking for GNU libc compatible malloc... yes
checking for obstacks... no
checking for stdlib.h... (cached) yes
checking for GNU libc compatible realloc... yes
checking sys/select.h usability... yes
checking sys/select.h presence... yes
checking for sys/select.h... yes
checking sys/socket.h usability... yes
checking sys/socket.h presence... yes
checking for sys/socket.h... yes
checking types of arguments for select... int,fd_set *,struct timeval *
checking for vprintf... yes
checking for _doprnt... no
configure: creating ./config.status
config.status: creating Makefile
config.status: creating include/Makefile
config.status: creating include/ode/Makefile
config.status: creating ode/Makefile
config.status: creating ode/src/Makefile
config.status: creating drawstuff/Makefile
config.status: creating drawstuff/src/Makefile
config.status: creating drawstuff/dstest/Makefile
config.status: creating ode/test/Makefile
config.status: creating ode-config
config.status: creating include/ode/config.h
config.status: executing depfiles commands
Configuration:
  Target system type:      i386-apple-darwin9.1.0
  Build  system type:      i386-apple-darwin9.1.0
  Host   system type:      i386-apple-darwin9.1.0
  Use double precision:    no
  Use OPCODE:              yes
  Use gyroscopic term:     yes
  Is this a Pentium:       yes
  Is the CPU x86-64:       no
  Is this a release build: no
  Is this a debug build:   no
  Using SONAME:        no
  Headers will be installed in /usr/local/include/ode
  Libraries will be installed in /usr/local/lib

After I tried configure the first time today, I got the following error:
1  
2  
3  
4  
(...)
checking for C compiler default output file name...
configure: error: C compiler cannot create executables
See `config.log' for more details.

It was the same error I got the first time I tried to compile it, previous to my first post. This time I searched a little longer on the net, and I found, that installing XCode 3.0 isn't enough on Mac OS 10.5 Leopard. The 'Unix Support Tools' must be installed, too, and it is only possible to install them AFTER the first Leopard installation, in a second, seperate installation process involving the Leopard DVD. After installing the Unix Support Tools, configure went fine, like shown above.
I Continued the process:
sh-3.2# make
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
Making all in include
Making all in ode
make  all-am
make[3]: Nothing to be done for `all-am'.
make[2]: Nothing to be done for `all-am'
.
Making all in drawstuff
Making all in src
g++ -DHAVE_CONFIG_H -I. -I../../include/ode    -I../../include -I../../include -arch i386 -isysroot /Developer/SDKs/MacOSX10.5.sdk/ -c -o libdrawstuff_a-drawstuff.o `test -f 'drawstuff.cpp' || echo './'`drawstuff.cpp
g++ -DHAVE_CONFIG_H -I. -I../../include/ode    -I../../include -I../../include -arch i386 -isysroot /Developer/SDKs/MacOSX10.5.sdk/ -c -o libdrawstuff_a-osx.o `test -f 'osx.cpp' || echo './'`osx.cpp
/Developer/SDKs/MacOSX10.5.sdk//System/Library/Frameworks/Security.framework/Headers/cssmconfig.h:64: error: conflicting declaration ‘typedef uint32_t uint32’
../../include/ode/config.h:348: error: ‘uint32has a previous declaration astypedef short unsigned int uint32
(...)
make[2]: *** [libdrawstuff_a-osx.o] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all-recursive] Error 1

The same error I had the first time, so I commented out the uint32 define in the config.h file again

sh-3.2# emacs include/ode/config.h
sh-3.2# make
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
Making all in include
Making all in ode
make  all-am
make[3]: Nothing to be done for `all-am'.
make[2]: Nothing to be done for `all-am'
.
Making all in drawstuff
Making all in src
(...)
g++ -DHAVE_CONFIG_H -I. -I../../include/ode    -arch i386 -isysroot /Developer/SDKs/MacOSX10.5.sdk/ -I../../include -I../../include -arch i386 -isysroot /Developer/SDKs/MacOSX10.5.sdk/ -c -o test_basket.o test_basket.cpp
test_basket.cpp: In functionvoid simLoop(int)’:
test_basket.cpp:183: error: ‘__isnanf’ was not declared in this scope
make[2]: *** [test_basket.o] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all-recursive] Error 1


And that's it, I don't know how to continue now. Btw changing $DEV_SDK from /Developer/SDKs/MacOSX10.5.sdk/ to /Developer/SDKs/MacOSX10.4u.sdk/ like it is said in the odejava/odejava-jni/build/build-odejava-jni-osx.sh script doesn't help much, it only results in the compiler error, which states, that the compiler doesn't produce a executable, because the given SDK doesn't match the OS.

Is another note, I doesn't understand the behaviour of the buildscript. It is bundled with a download, which is containing all sourcecode aside from opende, but as one of the first steps, it tries to download odejava again, which causes a new odejava checkout in the checkout some already has downloaded. Therefore I used the buildscript as a guide to compile odejava, and didn't executed it (besides the fact, that it downloads the head, and you said, I should use the with-odejava-jni branch)

If I made no errors with that, its looks like leopard does behave a little bit different then tiger here, which is bad (for me, and all other leopard users), if nobody in the odejava dev team has leopard on an available machine.
6  Game Development / Game Mechanics / [OdeJava] Howto getting odejave to run under Mac OS X 10.5 Leopard? on: 2007-12-13 01:15:18
Hi,
today I tried to set-up a java eclipse project for which I wanted to use odejava.  In short, I failed in doing so Sad
Here are my PC specs:
Mac OS X 10.5 Leopard on a macbook pro with intel dual core, mac java VM 1.5_something, eclipse 3.3, macports for all the handy linux/unix programs the mac shell didn't offer and gcc4 by apple.

Now the long story:
First I found the pretty outdated files on odejava.dev.java.net in the Documents & files section.
After a quick search, I found a few threads about the libodejava.jnilib version in the CVS section of the said website.

The next step was to download ode-0.9 from ode.org (at that time, I hadn't found out, that the buildscript would download it by itself ...). I unpacked it into /usr/local/src/ and ./configured it, but the make after that failed:
The first problem was, that uint32 was already #defined by an apple .h file, so I edited the (forgot the path)/config.h file and commented out
1  
#define unsigned short uint32

The second problem was, that Leopard already included some openGL stuff, that /usr/X11/lib wanted to include again, which caused a new error
1  
ld: cycle in dylib re-exports with /usr/X11/lib/libGL.dylib
. after finding the following post http://trac.macports.org/projects/macports/ticket/12997 I removed every appearance of /usr/X11/lib from all Makefiles in the ode-0.9 download. Sounds like a solution from someone without bash/make skills ... and so it is Smiley But after that ode compiled, and it installed
two files after calling make install: /usr/local/lib/libode.a and /usr/local/lib/libode.dylib

Then I went back to the odejava cvs checkout. I saved the checkout under /usr/local/src, installed dos2unix and automake over macports and tried to execute build-odejava-jni-osx.sh script in odejava/odejave-jni/build.
The first problem was, that the configure script of opende couldn't identify the type of executable from the gcc compiler. I fixed that by adding
1  
2  
CFLAGS=
CXXFLAGS=

to line 2436 in the configure script generated from autogen.sh, between
1  
ac_config_headers="$ac_config_headers include/ode/config.h"
and
1  
DEPDIR="${am__leading_dot}deps"

I found that two lines by comparing the opende and ode-0.9 configure script, it was the only difference, and the ode script executed, while the opende script did not, so don't ask my why it did work Smiley
After that, the big surprise, the script downloaded ode again (maybe I should look into such scripts the next time BEFORE I execute them), and tried to compile it, with the same problems I had the last time. That was the moment I stopped, and searched the odejava folder for some precompiled libs. I found the libodejava.jnilib along with other .so files and the dll, and copied it over into my eclipse project. Next I searched for jarfiles, and found the log4j and other jars and copied them over to my project, too. Last but not least I executed the ant buildfile in the odejava subfolder, which built me a handy odejava.jar, which joined the log4j jarfile in my project.

The next step was to add all the jars to the buildpath, and add the dir with the .jnilib and .so files to java.library.path and write some pretty simple main() method:
1  
2  
3  
4  
5  
public static void main(String[] args) 
{
    String libraryVersion = Odejava.getLibraryVersion();
    System.out.println( "Successfully loaded libarary version " + libraryVersion );
}

But it failed to run with the following message:
1  
2  
3  
4  
0    [main] FATAL odejava  - Native code library failed to load. java.lang.UnsatisfiedLinkError: dCCylinderClass_get
Exception in thread "main" java.lang.NoClassDefFoundError
  at org.odejava.Odejava.getLibraryVersion(Odejava.java:140)
  (....)

Without adding the lib folder to java.library.path I got
1  
2  
3  
4  
5  
6  
0    [main] FATAL odejava  - Native code library failed to load. java.lang.UnsatisfiedLinkError: no odejava in java.library.path
Exception in thread "main" java.lang.UnsatisfiedLinkError: ODEJAVA_VERSION_get
  at org.odejava.ode.OdeJNI.ODEJAVA_VERSION_get(Native Method)
  at org.odejava.ode.OdeConstants.<clinit>(OdeConstants.java:12)
  at org.odejava.Odejava.getLibraryVersion(Odejava.java:140)
  (....)

Searching for 'dCCylinderClass_get' got me 0 results, so I am stucked now, someone has some help?

Thanks in advance, and sorry for the lengthy post and bad english
7  Discussions / General Discussions / Re: OpenGL crippled under Windows Vista on: 2005-08-11 23:16:06
I don't think that Doom3 would make a difference, its more up to the non-entertainment software, 3D Modelling, CAD, science etc. In that domain OpenGL usage is near 100% and thats where the problem really lies, because most of them are not fullscreen.
I personally think particularly the developers of highly commercial software (1k $ per license and up) will hold some funny talks with MS Smiley
8  Discussions / General Discussions / Re: OpenGL crippled under Windows Vista on: 2005-08-08 21:51:36
I found the post about that, like I said, I have no idea if it's true, but it sounds like it could be.

"The API are different enough (coordinate center position comes to mind, among other things.)"

the URL to the post
http://slashdot.org/comments.pl?sid=158252&cid=13262467

I searched a bit for the starting post about that part of the discuission, but din't found it Sad
9  Discussions / General Discussions / Re: OpenGL crippled under Windows Vista on: 2005-08-08 20:21:07
I read in the slahsdot comments about this topic, that the reason why aeroglas must be shut down for true openGL is the GPU.
Because it is not possible to run openGL and DX on a GPU on the same time. Everytime a command from the an other API should be executed, the GPU must be flushed. Aeroglass ist pure DX, which means that with some OpenGl windowed app, there are both DX and OpenGL computations for the GPU.
For MS the options are: 1. let aeroglass be slown down by an OpenGL app or
2. wrap OpenGL.
As far as I understand it, fullscreenapps won't be touched by this, the vendor spezific drivers will work here with true OpenGL. If you want true OpenGL with windowed apps or with a multidesktop system (I love my second TFT, chatting on it while playing something on the first one in fullscreen is great : ) you must disable aeroglass, or it will be disable automaticly if some real OpenGL driver is loaded (I think you must do it yourself).

I am not sure how much of this is a fact or FUD, I read it last night on different places in the web.
10  Discussions / General Discussions / Re: OpenGL crippled under Windows Vista on: 2005-08-08 00:44:56
Just some additional info about the topic:
http://www.gamedev.net/community/forums/topic.asp?topic_id=337097&whichpage=4&#2195831

For some first-hand informations look here:
"Windows Graphics Overview [WinHEC 2005; 171 KB]"
http://download.microsoft.com/download/9/8/f/98f3fe47-dfc3-4e74-92a3-088782200fe7/TWPR05007_WinHEC05.ppt

"Advances in Display and Composition Architecture for Windows [WinHEC 2005; 422 KB]"
http://download.microsoft.com/download/9/8/f/98f3fe47-dfc3-4e74-92a3-088782200fe7/TWPR05005_WinHEC05.ppt
11  Java Game APIs & Engines / JOGL Development / Re: Pointing to librarys out of java on: 2004-06-04 21:08:24
Thx, I thought something like that

Immo I just use some different batchfiles for Windows and Linux, with different -Djava.library.path= settings, works for me, but as you said, webstart would be great, I'll put it on my todo list :-)
12  Java Game APIs & Engines / JOGL Development / Pointing to librarys out of java on: 2004-06-04 17:52:15
Anyone some idea why I couldn't include my jogl librarys without pointing to them from the shell with

java -Djava.library.path=./my_game_dir/libs/ -cp ....  (if I did it that way it works)


I tried to insert

System.setProperty("java.library.path","./my_game_dir/libs/");

in my javasources, it's one of the first lines in my main(), but anyway I got an error:

java.lang.UnsatisfiedLinkError: no jogl in java.library.path


Is it just impossible to "declare" the librarys (jogl.dll etc) or is there some error in my code?

Edit:
I tried the same thing for jinput:

System.setProperty("jinput.controllerPluginPath", "./my_game_dir/libs/");

and the javaprog finds the jinput librarys
13  Java Game APIs & Engines / Java 2D / Fastes way to cut a form out of an img + collude on: 2003-12-30 23:32:40
Im searching for the fastest way to cut a form (defined by a shape) out of an image and then collude it.
After that the form should be painted on the backbuffer over some sort of backgroundimage, which makes it necessarily to have bitmask transparency on the resulting image.

The way I do it now is that:
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  
Color Alpha0 = new Color(0,true);          // creat a 100% transparent color                
int x[] = {20,40,0,40,0};
int y[] = {0,40,15,15,40};
Polygon Poly = new Polygon(x,y,5);         // create the form to cut-out from the texture

BufferedImage ImgTex = null;               // image for the texture
BufferedImage ImgGoal = null;              // image for the resulting cut-out
ImgTex  = ConfigGrfx.createCompatibleImage(60,60,Transparency.OPAQUE);
ImgGoal = ConfigGrfx.createCompatibleImage(60,60,Transparency.BITMASK);
            
Graphics2D GrfxTex  = ImgTex.createGraphics();
Graphics2D GrfxGoal = ImgGoal.createGraphics();
            
GrfxGoal.setBackground(Alpha0);
GrfxGoal.clearRect(0,0,60,60);      // make goalimage transparent
            
GrfxTex.setColor(Color.red);
GrfxTex.fillRect(0,0,60,60);        // fill the texture-image (in reality e.g. load a png)

GrfxGoal.setColor(Color.black);
GrfxGoal.fill(Poly);                // draw the form on goalimage
            
// draw the texture over the form with spezial Composit, result ist cut-out from the texture
GrfxGoal.setComposite(AlphaComposite.SrcAtop);
GrfxGoal.drawImage(ImgTex,0,0,null);    

// paint "shadow" (50% darkness) over the texture
GrfxGoal.setComposite(AlphaComposite.SrcOver);
GrfxGoal.setColor(new Color(0.0f,0.0f,0.0f, 0.5f));
GrfxGoal.fill(Poly);

// and now draw it to backbuffer

the problem with that piece of code is, that it isn't accalerated.
The form is calculated again every frame, so every frame the mastercopy in SysRam must be copied to VRam (if it is copied to it after all, because it's redrawn so often) after draw the form on it.
And if I use a volatileImage I couldn't draw it to the backbuffer, because it has no alpha, so I would draw the (nice textured)  form with an ugly box around it.

So the question: is there a faster way for that?

Oh, and the code above isn't the code I use in the loop, I just copied the important parts ... I doesn't make new BufferedImages every loop :-)
14  Java Game APIs & Engines / Java 2D / Re: Which methods from Graphics2D are HW-accelerat on: 2003-12-30 11:14:37
I don't know if it's correct, but this is the way I would do it (dirty pseucdocode):

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  
class Screen extends Frame implements Runnable
{
BufferStrategy BufferStrat;
VolitaleImage ImgBig;
Grpahics2D GrfxOnBig;
BufferedImage ImgSmall[];

public Screen()
{
System.setProperty("sun.java2d.translaccel", "true");       // for accelerated translucent  transperency
ImgBig = getGraphicsConfiguration().createCompatibleVolatileImage(Width, Height, true);     // the true for HW acceleration
GrfxOnBig = ImgBig.createGraphics();
ImgSmall = new BufferedImage[NumberOfSmallImgages];
for(int i = NumberOfSmallImgages-1; i >= 0; i--)
     {
     ImgSmall[i] = getGraphicsConfiguration().createCompatibleImage(ImgWidth,ImgHeight,Transparency.TRANSLUCENT);
     }
}

public void run()
{
Graphics2D GrfxScreen;
createBufferStrategy(2);     // to get accelerated screensurfaces
BufferStrat = this.getBufferStrategy();
GrfxScreen = (Graphics2D)BufferStrat.getDrawGraphics();

while(ProgRuns == true)
for(int i = NumberOfSmallImgages-1; i >= 0; i--)
     {
     YourMethodToDrawOnSmallImg(SmallImg[i]);
     GrfxBig.drawImage(posX, posY, SmallImg[i];
     }
GrfxScreen.drawImage(posX, posY, BigImg);     // draw on backbuffer
BufferStrat.show();      // flipp back- and frontbuffer
}

}


and then

1  
2  
Screen MyScreen = new Screen();
new Thread(MyScreen).start();


This is like I approximately made it.
I hope I haven't forgot some part you need.

The BufferedImage I just use because I haven't found a way to make VolitaleImages with Alphachannels.

Someone else some hints?
15  Java Game APIs & Engines / Java 2D / Which methods from Graphics2D are HW-accelerated? on: 2003-12-28 19:33:21
Which methods from Graphics2D (got with createGraphics from a BufferedImage which was got with createCompatibleImage) are Hardwareaccelerated?
All of them or only drawImage(). And if only drawImage is accelerated, what happens if I call (e.g.) drawLine()?
Is the line drawn on the BufferedImage in the VRAM, or is the (BufferedImage in) VRAM copied to SystemRAM, the line drawn and the result copied back to VRAM?

And what happens if I call setRGB() from the BufferedImage?

And is there absolutely no HW acceleration for linux?
16  Game Development / Newbie & Debugging Questions / Re: newbie question (sort of) on: 2003-12-28 19:31:48
Quote
You can force fullscreen to BLT, but I don't know why you would want to


mh .. good question, I think the only reason would be to test the approximately FPS the programm has if it's started under linux, without reboot to it and test.

For the ones which are interessted in my questions about the acceleration of Graphics2D methods I copied it to the Java2D forum, topic is named:
Which methods from Graphics2D are HW-accelerated?
17  Game Development / Newbie & Debugging Questions / Re: newbie question (sort of) on: 2003-12-28 11:06:44
K, I will stop writing as if I am chat with friends in a MMORPG, will be more simply to read for the normal ones :-)

Quote
If you flip frames for a window, then flipping is done with an (unsynchronized on Win32) BLT to the screen.  If you flip frames in full screen then its done with video page flipping [...]

if you make your bufferstrategy with
createBufferStrategy(2)
then it will be done like that, but furthermore you can create the bufferstrategy with
createBufferStrategy(2, BufferCapabilities)
then you can select between page flipping and page blitting.

If we are already at Hardwarefeatures, which methods from Graphics2D (got with createGraphics from a BufferedImage which was got with createCompatibleImage) are Hardwareaccelerated?
All of them or only drawImage(). And if only drawImage is accelerated, what happens if I call (e.g.) drawLine()?
Is the line drawn on the BufferedImage in the VRAM, or is the (BufferedImage in) VRAM copied to SystemRAM, the line drawn and the result copied back to VRAM?

And what happens if I call setRGB() from the BufferedImage?


I hope my grammar is understandably ... to read some english text and to write some is a a larger difference than I thought **
18  Game Development / Newbie & Debugging Questions / Re: newbie question (sort of) on: 2003-12-26 11:24:16
Quote
Other things to think about: if your game is in a window then you cannot do page flipping or blitting, so your game will have performance problems.


Sure about that?
If u make a BufferStrategy with BufferCapabilities like this for pageblitting:
1  
2  
3  
BufferCaps = new BufferCapabilities(new ImageCapabilities(true),
                                                                                                                                                                                                              new ImageCapabilities(true),
                                                                                                                                                                                                              null);

flipContents - the contents of the back buffer after page-flipping, null if page flipping is not used

this works with windowed frames or what else u use, exclusiv fullscreen is just needed if u use a pageflipping strategy for flipContents.
19  Game Development / Performance Tuning / Re: Flipping < Blitting? ... or where is the er on: 2003-12-25 19:55:53
it was the scan-synchronization, if I disable it I got twice the frames with PageFlipping then I got with PageFlipping, thx guys
20  Game Development / Performance Tuning / Flipping < Blitting? ... or where is the error on: 2003-12-25 16:23:26
Moin
I started to write a 2D engine for Games/Appz a few days before.
First I did was to create a window, get the GraficsConfiguration and build some Bufferstrategy.
I read some books about 3D grafics in C for an basic understanding of technics to be used for fast and smooth moving pics, so I decided to build the BufferStrat with PageFlipping.
To do that I set the window I used to exklusiv fullscreenmode.
After that I wrote a simple FPS counter and start the application.

Code of the method which draws (and sry for german comments, but I think all of u will understand the code without them *g*):

     public void run()
     {
           long             lTime             = System.currentTimeMillis();
           int             nOldFPS       = 0;
           int             nFPS             = 0;
           Color             ClrBack       = GrfxScreen.getColor();

           while(bRunning)
           {
                 if(Backbuffer.getCapabilities().getFlipContents()!=BufferCapabilities.FlipContents.BACKGROUND)
                 {
                       GrfxScreen.fillRect(0,0,nWidth, nHeight);
                 }// if(...) -> Falls die Bufferstrategier nicht selbst den Backbuffer saeubert machen wir das
                 
                 // ----  Draw here  ----
                 GrfxScreen.setColor(Color.green);
                 GrfxScreen.drawString("Pageflipping: " + this.getBufferStrategy().getCapabilities().isPageFlipping(),0,40);
                 GrfxScreen.drawString("Fullscreen: " + this.bFullscreen,0,60);
                 GrfxScreen.drawString("VRAM: " + this.getGraphicsConfiguration().getDevice().getAvailableAcceleratedMemory(),0,80);
                 GrfxScreen.drawString("FlipContent: " + Backbuffer.getCapabilities().getFlipContents(),0,100);
                 GrfxScreen.drawString("Bounds: " + this.nWidth + " x " + this.nHeight,0,120);
                 
                 GrfxScreen.setColor(Color.blue);
                 GrfxScreen.drawString("F Fullscreen <-> Window",0,140);
                 GrfxScreen.drawString("P PageFlipping oder -Blitting",0,160);
                 GrfxScreen.drawString("Esc Ende",0,180);
                 
                 GrfxScreen.setColor(ClrBack);
                 // ---- End Drawing ----
                 
                 // Anzahl Frames der letzten Sekunde anzeigen
                 GrfxScreen.setColor(Color.red);
                 GrfxScreen.drawString("FPS: "+nOldFPS, 0,20);
                 GrfxScreen.setColor(ClrBack);
                 
                 nFPS++;
                 if(lTime+1000 <= System.currentTimeMillis())
                 {
                       lTime = System.currentTimeMillis();
                       nOldFPS = nFPS;
                       nFPS = 0;
                 }// if(...) -> Jede Sekunde Anzahl FPS der letzten Sek updaten
                 if(bRunning)Backbuffer.show();
           }// while(bRunning)
     }// public void run()

Then I wonder: it ran, but really slow (60FPS).
So I tried a few things (using a frame and not a window and such things) and finally I changed the BufferStrat from PageFlipping to PageBlitting (first the flipping, then the blitting strat):

           if(bFlipping && bFullscreen)
           {
                 BufferCaps = new BufferCapabilities(new ImageCapabilities(true),
                                                                       new ImageCapabilities(true),
                                                                       BufferCapabilities.FlipContents.BACKGROUND);
           }// if(...) -> Soll mit PageFlipping laufen?
           else
           {
                 bFlipping = false;
                 BufferCaps = new BufferCapabilities(new ImageCapabilities(true),
                                                                        new ImageCapabilities(true),
                                                                       null);
           }// else -> PageBlitting ... ist aus irgend einem Grund schneller als PageFlipping

And after that change the frames per minute increased to 220.

So is that normal? I thought PageFlipping is the fastest way, cause the graficcard just needs to change the pointer to a nother place in VRAM.

So finally, have i made a mistake (the full prog lists 240 lines, so I wouldn't post it completely, but here is the link http://www.tzi.de/~oherdin/java/GrfxTest.rar), or ist PageFlipping in Java really slower then Blitting?

I use a Pentium M 1.7GHz 512MB RAM with Radeon 7500M on Windows XP SP1 with jre 1.4.2_02.

Don't try to run the code under Linux, you will run into problems with your mice and keyboard.



P.S.: I'm a first poster, but doesn't find something about that topic somewhere else in the forum, so hope it is placed correct here :-)

P.P.S.: oh, and happy Xmas
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.

rwatson462 (32 views)
2014-12-15 09:26:44

Mr.CodeIt (23 views)
2014-12-14 19:50:38

BurntPizza (51 views)
2014-12-09 22:41:13

BurntPizza (84 views)
2014-12-08 04:46:31

JscottyBieshaar (45 views)
2014-12-05 12:39:02

SHC (59 views)
2014-12-03 16:27:13

CopyableCougar4 (58 views)
2014-11-29 21:32:03

toopeicgaming1999 (123 views)
2014-11-26 15:22:04

toopeicgaming1999 (114 views)
2014-11-26 15:20:36

toopeicgaming1999 (32 views)
2014-11-26 15:20:08
Resources for WIP games
by kpars
2014-12-18 10:26:14

Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

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
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!