Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (494)
Games in Android Showcase (114)
games submitted by our members
Games in WIP (563)
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
1  Java Game APIs & Engines / Xith3D Forums / Re: Multiple Canvas errors on: 2005-06-10 07:31:55
The problem as I experienced it is as follows (with latest jogl):

Same scene multiple views with respective canvas: VM crashes with error as above (although both frames are initially rendered)

One scene per view with respective canvas: Using a single texture instance in both scenes causes a huge memory leak (appears that texture gets reallocated per render call)

One scene per view with respective canvas and texture instances: Works fine for me.

Same scene multiple views in one canvas and switching between views: don't know, have not tried it.

Ca$
2  Java Game APIs & Engines / Xith3D Forums / Re: Multiple Canvas errors on: 2005-06-09 09:20:49
I had the same error when using two canvases.

The latest JOGL version should work. At least I can render two canvases if I am using two completely separate universes/scenes.

Another issue in this domain is a problem that occurs when a single texture instance is used in both canvases. This caused in my case a severe memory leak with all its consequences.

Since the (old) textureLoader class identifies textures by their respective filename (thus you can't get two instances of the same texture) I used multiple TextureLoader instances to organize the textures according to the canvas they were used in.

If someone has a better idea to solve the problems in the "multiple canvas" domain please tell me/us.

Further, I would very much like to render the same scene using different views in different canvases. But I could not get it working so far.

Ca$

 
3  Java Game APIs & Engines / Xith3D Forums / Re: Terrain on: 2005-04-22 10:08:56
I use my own.

It is based on a simple set of triangles. The triangles are created using the Delauney triangulation from arbitrary point sets. This triangle set is used for collision computation and transforming into the triangleArray used by xith.

To model the terrain I simply use a class which can "hammer" half-spheres (parameterized to size, radii etc) into the terrain to create hills, craters, ditches, rivers and so on.

My implementation is sufficient performance wise for my needs. I use a 2d grid of arraylists to cache the triangles for ray-triangle intersection computation to reduce the number of triangles to check.

The last time I checked (java 1.4.x / linux / P4 2Ghz) I got 50k-60k ray-triangle collision computations per second. This allows a good response time when for example catching the mouseMove event to project a virtual cursor on the terrain based on the mouse position.


Ca$
4  Java Game APIs & Engines / Xith3D Forums / Triangulation for Terrains (link) on: 2005-03-14 15:21:03
Hi folks,

this link might be usefull for people in need of terrains.

http://astronomy.swin.edu.au/~pbourke/terrain/triangulate/

There is a link to a java version of the code.

What this is good for:

When you need a terrain you will most often start with some sort
of heightfield defined by a 2d matrix of height values.
This works fine for most of the time. But if you want a terrain that is quite large but want to keep poly count low your terrain will become rather ugly because the triangle/quad structure is clearly visible. But if you go for a finer mesh by your 2d heightfield matrix you poly count grows by the square.

The link above provides the algorithm (source) to use the Delauney triangulation of an arbitrary 2d point set. That means that you can use points in arbitrary positions (I think you need to project them to (x,y) to get the algorithm point format). The triangulation method will return a mesh of triangles defined by the points you give it. This is very nice as you can have both sections in your terrain having a very fine mesh while in other locations the mesh can be more chunky (e.g. regions the player can see but not reach). Another advantage is that the terrain can have any type shape (in terms of boundary) in contrast to being constrained by some rectangular matrix type shape.

I got it working but have yet no experience about it's performance or robustness.

Update: haha, the java port omitted the completely unimportant fact that the points supplied have to be sorted by their x coords.

Will this be the last surprise ?

Ca$
5  Java Game APIs & Engines / Xith3D Forums / Re: Why do lights only have to light the subgraph on: 2005-03-14 04:26:17
Compute the orientation, translation of your object, transform them to VirtualWorld Coords and use them for the orientation, position of your light.

I use this method to have a virtual robot mounted camera. The camera is a simple cube and I compute the position on one of the cubes faces to be the origin of the camera. Now when the robot and or the camera is moving the view moves along. Positioning your light should work the same way (I suppose).

Get the geometry of the object you want to attach the light to e.g. your flashlight front. Compute the normal and put the light on some position along this normal. Then transform this position using localToVworld into the Vworld coordinate space. Whats missing now is the orientation but you need to get this from the transformgroup your flashlight is attached to (and again: localToVworld transformation).

Perhaps this is works as well: Get the local transform of your flashlight (4x4 Matrix). Put the translation of the lightsource in it (e.g. the position of the light relative to the flashlight). Then use localToVworld on this 4x4 Matrix and this should be the transform to use with your light.

Ca$
6  Java Game APIs & Engines / Xith3D Forums / Re: Text labels on: 2005-03-09 08:16:08
One way can be to create a BufferedImage and draw Text into it via Java's AWT GraphicsContext and then make a texture out of it. This should work for static text labels (e.g. no changing text or animation).

Anotherway is to create an empty texture of and getting the ImageComponent from it. Then you can use again the Graphics Context to draw right into the texture. I think you need to set the textures dirty flag to enable updating.

Problems associated with this approach:
1. Will be tricky to get it on minmap textures to work as you will have to scale it yourself.
2. You need billboard textures to make sure the labels keep their orientation towards the user.
7  Java Game APIs & Engines / Xith3D Forums / Anyone using integrated 3D with xith3d on: 2005-03-07 08:13:54
Hi,

just a question:

has anyone experience about using xith3d and integrated 3d chipsets like the Intel Extreme Graphics things ?

Are good or bad chipsets around, known problems to avoid ... etc.

Thanks,
Ca$

8  Java Game APIs & Engines / Xith3D Forums / Re: Memory leak when using two views on: 2005-02-24 07:38:25
@Will:

here is Ken Russel's reply (JOGL) to this:

The problem is probably that you're trying to use a texture object defined in one OpenGL context that isn't defined in another. If you want to use the same texture object in multiple contexts then you have to set up sharing between those contexts, which you can do with the appropriate factory method in the GLDrawableFactory.

9  Java Game APIs & Engines / Xith3D Forums / Re: Resize CanvasPeer in JFrame on: 2005-02-23 05:00:58
Hi,

I use a JPanel as CanvasPeer as well and it resizes automatically when the JFrame parent is resized. What Layout are you using ? I use BorderLayout.  

thats what I use: (I get the input _panel from a frame)
javax.swing.JPanel panel_ = _panel;
       CanvasPeer cp = rp.makeCanvas(panel_,panel_.getWidth(),panel_.getHeight(),32,false);
       canvas = new Canvas3D();
       canvas.set3DPeer(cp);

Ca$
10  Java Game APIs & Engines / JOGL Development / Re: Can JOGL do multiple GLCanvas ? on: 2005-02-21 12:58:35
@Ken Russel:

can you perhaps hack the gears demo to use *the same instance* of a texture (e.g. on the gears geometry) in both GLCanvas displays and tell whether this works or not. This would help to identify the location of this bug. If JOGL can do this without a problem then perhaps there is something wrong in Xith3D with assigning textures to objects.

I would do it myself if I were in any way familiar with GL/JOGL hacking.

Thanks,
Ca$
11  Java Game APIs & Engines / JOGL Development / Re: Can JOGL do multiple GLCanvas ? on: 2005-02-20 12:38:59
after a long debugging night I (hopefully) resolved the issue Smiley

When using a single texture (Xith3D Texture Object) in two Canvas3D displays at the same time the memory is leaked. By the amount of leaking I suspect that for some reason the texture is allocated on the native GL side each time it is accessed for rendering.

But this problem can be avoided using a simple workaround like double loading the textures which are used in both displays at the same time.

Again, thanks for your help Smiley
12  Java Game APIs & Engines / Xith3D Forums / Re: Memory leak when using two views on: 2005-02-20 11:53:26
I have not looked into this matter any further but by the rate of memory leaking I suspect that the texture is allocated over and over again on the native GL side for each access.

Perhaps the texture is somehow bound to a single Scenegraph ?  

Ca$
13  Java Game APIs & Engines / Xith3D Forums / Re: Memory leak when using two views on: 2005-02-20 10:26:01
Hi,

after quite a lot of debugging until 2.30am last night I have possibly discovered the cause of the problem:

The Texture was the suspected culprit  Shocked

I first checked the HelloXith3D demo and extended it to use two Canvas3D and it worked fine (just as the JOGL demo extension did).

Then I changed my own code to match the modified HelloXith3D demo step by step until they matched almost line by line but I still had my memory leak.
The only difference was that my object used a texture (mapped to 6 separate faces on a cube).

The problem occurred when the same texture (instance) was used in both displays simultaneously. When I used a different Texture on the object in the second display (Canvas3D) the memory leak was no more.

As a workaround to get two identical textures in both displays I tried to load the same texture (same by filename) twice into two Texture instances but this seems not to work. Perhaps Xith is keeping a hash of loaded texture filenames to prevent double loading. Duplicating the texture file with a different filename does work (perhaps a link would do the trick too).

@Will:
The memory leak could not be on the java side since I use default heap size and this was one hell of a memory leak. After a few seconds it was getting difficult to move the mouse to reach the shell to end the process. And there was no OutOfMemoryError thrown by the java VM.

Kudos for the Xith3D coders as I checked a lot of well written code last night. The documentation is a bit sparse but the code is well readable Smiley

Ca$
(Starship Trooper mode: Only a dead bug is a good bug !)
14  Java Game APIs & Engines / Xith3D Forums / Re: Memory leak when using two views on: 2005-02-19 17:09:55
Well, at least I verified that it is not a JOGL problem. JOGL can deal with more than one GLCanvas which means it must reside somewhere else.


15  Java Game APIs & Engines / JOGL Development / Re: Can JOGL do multiple GLCanvas ? on: 2005-02-19 17:05:57
It does not leak on my system either.

So it is possibly somewhere in the JOGL handling of Xith3d.

Lets hope I can track it down.

Thanks for your effort,
Ca$cade
16  Java Game APIs & Engines / JOGL Development / Re: Can JOGL do multiple GLCanvas ? on: 2005-02-19 14:34:11
yes, one old jogl.jar slipped my update  Shocked

with the new update the "make context current" exception is history Smiley

what remains is the memory leak. I tried both using a single thread for the updates and two separate threads for the render update call with no difference in their effect.
If I don't update the second panel no memory is leaked.

here is the output:

# section for panel 1

!!! Created GL context for net.java.games.jogl.impl.x11.X11OnscreenGLContext
!!! Initializing GLU extension address table
!!! Initializing OpenGL extension address table
!!! GLX version: major 1, minor 3
Init GL is net.java.games.jogl.impl.x11.X11GLImpl
OpenGL Renderer = GeForce4 Ti 4600/AGP/SSE/3DNOW!
OpenGL Version = 1.5.2 NVIDIA 66.29
OpenGL Vendor = NVIDIA Corporation
No Fragment Program support, skipping

# section for panel 2

!!! Created GL context for net.java.games.jogl.impl.x11.X11OnscreenGLContext
!!! Initializing OpenGL extension address table
!!! GLX version: major 1, minor 3
OpenGL Renderer = GeForce4 Ti 4600/AGP/SSE/3DNOW!
OpenGL Version = 1.5.2 NVIDIA 66.29
OpenGL Vendor = NVIDIA Corporation

# this is occuring at each render call per frame
Making context net.java.games.jogl.impl.x11.X11OnscreenGLContext@15b0afd current
Freeing context net.java.games.jogl.impl.x11.X11OnscreenGLContext@15b0afd
Making context net.java.games.jogl.impl.x11.X11OnscreenGLContext@1bfc93a current
Freeing context net.java.games.jogl.impl.x11.X11OnscreenGLContext@1bfc93a



17  Java Game APIs & Engines / JOGL Development / Re: Can JOGL do multiple GLCanvas ? on: 2005-02-19 04:59:13
sorry, I don't seem to get more output Sad

I tried it now using the jogl demos:

java -Djogl.verbose -Djogl.debug.GLContext -DJOGL_SINGLE_THREADED_WORKAROUND=true demos.gears.Gears
CANVAS GL IS: net.java.games.jogl.impl.x11.X11GLImpl
CANVAS GLU IS: net.java.games.jogl.impl.GLUImpl
Exception in thread "Thread-1" net.java.games.jogl.GLException: Error making context current
       at net.java.games.jogl.impl.x11.X11GLContext.makeCurrent(X11GLContext.java:154)
       at net.java.games.jogl.impl.x11.X11OnscreenGLContext.makeCurrent(X11OnscreenGLContext.java:111)
       at net.java.games.jogl.impl.GLContext.invokeGL(GLContext.java:203)
       at net.java.games.jogl.GLCanvas.displayImpl(GLCanvas.java:186)
       at net.java.games.jogl.GLCanvas.display(GLCanvas.java:74)
       at net.java.games.jogl.Animator$1.run(Animator.java:104)
       at java.lang.Thread.run(Thread.java:595)

note: java is 1.5.0-rc-b63
18  Java Game APIs & Engines / JOGL Development / Re: JOGL 1.1 b09 released on: 2005-02-18 21:09:25
Hi,

I get the same exception now with b09 (b04 did fine):

xception in thread "X3d[myUniverse]" net.java.games.jogl.GLException: Error making context current
       at net.java.games.jogl.impl.x11.X11GLContext.makeCurrent(X11GLContext.java:154)
       at net.java.games.jogl.impl.x11.X11OnscreenGLContext.makeCurrent(X11OnscreenGLContext.java:111)
       at net.java.games.jogl.impl.GLContext.invokeGL(GLContext.java:203)
       at net.java.games.jogl.GLCanvas.displayImpl(GLCanvas.java:186)
       at net.java.games.jogl.GLCanvas.display(GLCanvas.java:74)
       at com.xith3d.render.jogl.CanvasPeerImpl.render(CanvasPeerImpl.java:1162)
       at com.xith3d.scenegraph.View.renderOnce(View.java:592)
       at ext.xith3d.base.XithWorld.updatePostwork(XithWorld.java:210)
       at kernel.math.geom3dv2.World3d.update(World3d.java:220)

OS: Suse 9.1 Graca: Ti4600: Driver 55xx, and 6629

I had the same problem some time ago while using the nvidia 44?? driver. Updating the driver resolved the issue back then.

19  Java Game APIs & Engines / JOGL Development / Re: Can JOGL do multiple GLCanvas ? on: 2005-02-18 21:02:32
update:

just installed the latest JOGL release. But now I can't run anything because of the following exception:

Exception in thread "X3d[myUniverse]" net.java.games.jogl.GLException: Error making context current
       at net.java.games.jogl.impl.x11.X11GLContext.makeCurrent(X11GLContext.java:154)
       at net.java.games.jogl.impl.x11.X11OnscreenGLContext.makeCurrent(X11OnscreenGLContext.java:111)
       at net.java.games.jogl.impl.GLContext.invokeGL(GLContext.java:203)
       at net.java.games.jogl.GLCanvas.displayImpl(GLCanvas.java:186)
       at net.java.games.jogl.GLCanvas.display(GLCanvas.java:74)
       at com.xith3d.render.jogl.CanvasPeerImpl.render(CanvasPeerImpl.java:1162)
       at com.xith3d.scenegraph.View.renderOnce(View.java:592)
       at ext.xith3d.base.XithWorld.updatePostwork(XithWorld.java:210)
       at kernel.math.geom3dv2.World3d.update(World3d.java:220)

OS: Suse 9.1 Graca: nv Ti4600 Driver: 6629

Any ideas ?

Thanks
20  Java Game APIs & Engines / JOGL Development / Re: Can JOGL do multiple GLCanvas ? on: 2005-02-18 18:29:31
thanks for the hint, I will try it out.

OS is Suse Linux 9.1, Card is Nvidia FX5200 and Ti4600, JOGL version was b04, JDK5 (1.5), driver is latest Nvidia 6629.

I could not get the b09 release working due to a JOGL Exception "Could not make context current" on the FX5200, but I will try now with my old Ti4600 card.


Thanks,
Ca$
21  Java Game APIs & Engines / JOGL Development / Can JOGL do multiple GLCanvas ? on: 2005-02-18 14:43:56
Hi,

I am using the Xith framework and try to get more than one
JPanel with a 3D scene up and running. However, as soon as
there is more than one view rendered the process starts
leaking memory at a rate of about several MB per view.render
call. This leaves my machine unusable within a few seconds.

Since there is no OutOfMemoryError from the java side I suspect it must be somewhere else.

Has anyone experienced similar problems or has more than one GLCanvas active without any problem.

Any ideas where to look for the source of this problem ?

Thanks, Ca$
22  Java Game APIs & Engines / Xith3D Forums / Re: Memory leak when using two views on: 2005-02-18 05:47:43
udpate:

whenever the second rendering thread calls view2.renderOnce about 1 MB is allocated.

I have no idea where to look for the source of this problem Sad
23  Java Game APIs & Engines / Xith3D Forums / Memory leak when using two views on: 2005-02-17 13:43:31
Hi,

I just tried to get two views with each having its own Universe, Canvas3D and renderthread up and running.

Everything is fine as long as there is no object in the second scenegraph. But with only a single object the memory usage of the java process explodes by about 5-10 megs per second.

I have no idea about what the cause of this problem is but perhaps someone else has more experience or has two views up and running without any hazzle.

Any ideas ?

Ca$
24  Java Game APIs & Engines / Xith3D Forums / Re: Picking terrain on: 2005-02-14 12:39:06
Oh, I'm afraid I am using a lot of my own libraries to do that outside xith. I need this for simulations that not necessarily need visualization.

What you basically need is the computation of a pick ray (I think this is done by xith) and the computation of the ray-triangle intersection (given your geometry is triangle based).

Contact me via this forums PM and I will send you the classes and how to use them.



25  Java Game APIs & Engines / Xith3D Forums / Re: Picking terrain on: 2005-02-14 10:38:27
Hi, there are several threads that deal with picking.

I use a triangle-plane buffer based on the terrain geometry and compute the intersection between a pick ray and the terrain geometry. This gives you local object coordinates which can be transformed to virtual world coordinates.


26  Java Game APIs & Engines / Xith3D Forums / Re: Video and xith on: 2005-02-14 08:54:26
I am still struggling on how to get the image data from the C-side into the texture on the java side without brute force array copying.

How can this be done and where do I put the data ?
From C I get a byte buffer containing an RGB (or BGR or ABGR, RGBA) image. Do I now use the BufferedImage I get from the Texture class or the ImageComponent2D ?  

In C there was an openGL function which could partially or fully update a texture and this worked very well.
27  Java Game APIs & Engines / Xith3D Forums / Re: Video and xith on: 2005-02-14 05:21:08
I am just trying to do something similar.

I want to use xith3d to display a live video image inside the 3D world.

I had no time yet to implement it but here is what I am planning:

Use JNI to get access to my video4linux stuff to grab images (if you have some mpeg video stream you need to use you codec code in this part)

Get the image info from the C-side into java. I don't know if one can use direct memory mapping between C and Java to avoid the extra memory copying. Get the image provided from the C-side into a texture on the Xith3d side (I have not figured out this part yet). Map this texture to some 3D geometry (a quad would be the simplest).

Note that you will probably need to scale your image to fit into a texture (only power of 2 sizes allowed).

Too bad I have not come around to implement it by now Sad

Ca$
28  Java Game APIs & Engines / Xith3D Forums / Re: How to get object picking system work? on: 2005-02-14 05:07:34
I have  a special problem for which I need picking:

Laserrange finder simulation for mobile robots. A Laserrangefinder (2D) has a laser and a rotating mirror that fans out the laser beam and allows for example 180/360/720 distance readings in a horizontal 180 degree plane. This must work at 4 - 8 Hz frequencies. If possible I want to get a 3D laser range finder to work but this will cause much more computation.

I do it the following way:

for all pickable objects I keep a plane buffer (triangles) for their geometry (e.g. converting quad geometry to triangles).

I keep basically two groups of objects: static and dynamic.

the static objects like terrain or immobile structures for example are indexed using a 2d grid for optimization (each triangleplane is indexed in the grid). So for pick ray computation I compute the projection of the pickray in the grid and just need to check the triangles which are possibly ahead of the pick ray (my terrain has multiple thousand triangles) making this very fast.

the dynamic objects are organized in different layers and are not stored in the grid (this would require to compute the object to grid coverage after each movement). For example I have one layer for the HUD/GUI objects and one or more layers for the other scene objects.

a pick event (e.g. mouse button event) traverses this hierarchy to find the object being picked (closest to pick-origin but produces a TreeMap with all intersected objects).

objects itself have an event handler (per object/shape/ or each plane) that receives the pick event and further info can be computed (local intersection position, Vworld intersection position). For example a local 2d coordinate system mapped to a quad. This is the way I am just implementing a UI and maps (radar screen etc).

Ca$
29  Java Game APIs & Engines / Xith3D Forums / Re: How to get object picking system work? on: 2005-02-09 11:00:58
I'm just doing some picking/event handling stuff. Picking itself is only the beginning of the story ...

first comes picking ... then a hierarchy with possibly multiple layers for a HUD, the static and dynamic scene objects, the terrain, ... then selection and input mapping to selected objects ... drag and drop handling in 3D

a common framework for this would be nice !



30  Java Game APIs & Engines / Xith3D Forums / Re: Texture-BufferedImage upside down ? on: 2005-02-07 06:42:49
Well, both ways.

But primarily I want to have text displays using textures.

I have already written a text renderer that can display text, icons and more using the graphics context and I want to put this on textures live.

...and of course, at this very moment the possibility to render live video as a texture (and on a cube or whatever geometry).

Pages: [1] 2 3
 

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

The first screenshot will be displayed as a thumbnail.

Dwinin (23 views)
2014-09-12 09:08:26

Norakomi (56 views)
2014-09-10 13:57:51

TehJavaDev (69 views)
2014-09-10 06:39:09

Tekkerue (34 views)
2014-09-09 02:24:56

mitcheeb (56 views)
2014-09-08 06:06:29

BurntPizza (40 views)
2014-09-07 01:13:42

Longarmx (25 views)
2014-09-07 01:12:14

Longarmx (31 views)
2014-09-07 01:11:22

Longarmx (31 views)
2014-09-07 01:10:19

mitcheeb (38 views)
2014-09-04 23:08:59
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!