Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (477)
Games in Android Showcase (107)
games submitted by our members
Games in WIP (536)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
   Home   Help   Search   Login   Register   
  Show Posts
Pages: [1]
1  Java Game APIs & Engines / JOGL Development / GLU tesselation problem on: 2004-06-12 22:29:48
Hello,

I hope someone can help me out. I added GLU tesselation for complex polygons to my renderer,
but it does not work for all cases.
It works for complex non-intersecting polygons,
I tried it with a VMAP0 data set - country boundaries for european states with 100k+ vertices. But once I try to tesselate this simple self-intersecting polygon:

0,0, 100,100, 0,100, 100,0

I get a complaint that the combine callback is not defined. Which is funny because this callback is called right before the error callback and it holds the correct new vertex position.

Also the begin, vertex and end callbacks are apparently not called at all...

I boiled this down into the following code, what am I doing wrong here?

private void drawTesselPoly(GL gl, GLU glu) {
   if( this.tesselator == null)
   {
       tesselator = glu.gluNewTess();                  
       glu.gluTessCallback(this.tesselator, GLU.GLU_TESS_VERTEX, this);
                 glu.gluTessCallback(this.tesselator, GLU.GLU_TESS_VERTEX_DATA, this);
                 glu.gluTessCallback(this.tesselator, GLU.GLU_TESS_BEGIN, this);
                 glu.gluTessCallback(this.tesselator, GLU.GLU_TESS_END, this);
                 glu.gluTessCallback(this.tesselator, GLU.GLU_TESS_ERROR, this);
                 glu.gluTessCallback(this.tesselator, GLU.GLU_TESS_COMBINE, this);
                 glu.gluTessCallback(this.tesselator, GLU.GLU_TESS_COMBINE_DATA, this);                  
           }
           
           glu.gluTessProperty(this.tesselator, GLU.GLU_TESS_WINDING_RULE, GLU.GLU_TESS_WINDING_NONZERO);            
                       
           TessPoint3D vertex1 = new TessPoint3D(0.0,0.0,0.0);
           
           glu.gluTessBeginPolygon( tesselator, vertex1);        
           glu.gluTessBeginContour(tesselator);

           glu.gluTessVertex(tesselator, new double[]{0, 0, 0} , new TessPoint3D(0, 0, 0));
           glu.gluTessVertex(tesselator, new double[]{100, 100, 0} , new TessPoint3D(100,100,0));
           glu.gluTessVertex(tesselator, new double[]{0, 100, 0} , new TessPoint3D(0,100,0));
           glu.gluTessVertex(tesselator, new double[]{100, 0, 0} , new TessPoint3D(100,0,0));
                                               
           glu.gluTessEndContour(tesselator);
           glu.gluTessEndPolygon(tesselator);            
     }


I defined the callbacks in my renderer class (which implements the
GLUtesselatorCallback) like this:


     public void begin(int arg0) {      
           gl.glBegin( arg0);      
     }
     
     public void beginData(int arg0, Object arg1) {
           gl.glBegin( arg0);            
     }
     
     public void vertex(Object arg0) {      
           TessPoint3D tessp = (TessPoint3D)arg0;      
           gl.glVertex3d( tessp.x, tessp.y, tessp.z);
     }

     public void vertexData(Object arg0, Object arg1) {            
           TessPoint3D tessp = (TessPoint3D)arg0;
           gl.glVertex3d( tessp.x, tessp.y, tessp.z);      
     }
     
     public void end() {
           gl.glEnd();      
     }
     
     public void endData(Object arg0) {
           gl.glEnd();            
     }
     
     public void combine(double[] arg0, Object[] arg1, float[] arg2, Object[] arg3) {
           gl.glVertex3dv(arg0);                  
     }
     
     public void combineData(double[] arg0, Object[] arg1, float[] arg2, Object[] arg3, Object arg4) {
           gl.glVertex3dv(arg0);
     }
     
     public void error(int arg0) {
           System.out.println("tess error: "+glu.gluErrorString(arg0));
     }
     
     public void errorData(int arg0, Object arg1) {
           System.out.println("tess errorData: "+glu.gluErrorString(arg0));            
     }

TessPoint is a small private class:

     private class TessPoint3D
     {
           public double x;
           public double y;
           public double z;
           
           public TessPoint3D(double p1, double p2, double p3) {
                 
                 x = p1; y = p2; z = p3;
           }            
     }  


Best regards,

Greg
2  Java Game APIs & Engines / Java 2D / Re: JDK 1.5.0-beta2 is now available on: 2004-05-28 16:18:22
Just tested it with my benchmark.
Sadly the performance is much worse than plain
Java2D (10x slower and worse).   :-/
I am using a Quadro4 750 under Win XP. Upgrading
the driver from 45.23 to 56.72 did not speed things
up. I feel as if its not hardware accelerated at all...

Gregor
3  Java Game APIs & Engines / JOGL Development / Re: What are people doing with JOGL? on: 2004-03-19 18:38:21
JOGL is used for the 3D visualisation of meteorological data in this project:

http://java.sun.com/products/java-media/jai/inaction/ninjo.html

It will also be an alternative to Java2D for the rendering of 2D content.
4  Java Game APIs & Engines / JOGL Development / Re: JOGL & J2D Combined Superpower! on: 2003-09-27 19:28:18
Hello,

I encountered similar issues during my work on a project that uses a scenegraph implementation which can be displayed using Java2D, Java3D or OpenGL via GL4Java (and soon JOGL). Because the focus is now mainly on displaying compex 2D scenes (geographical data as raster images and vector data and overlayed meteorological data in all kind of flavours) Java2D is the renderer used by default. The OpenGL path currently has only rudimentary text functionality and has bad performance if complex polygons have to be triangulated prior to their use.
To speed things up I experimented with drawing the Java2D path into a BufferedImage which I used then as a texture. I haven't measured performance yet, but I guess it would be in the area you mentioned (BTW: what is your target platform?) Until now I haven't found a perfect solution to integrate the best features of J2D and OpenGL,  but if I figure something out I'll let you know.

Greetings,

Greg
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.

Riven (20 views)
2014-07-29 18:09:19

Riven (13 views)
2014-07-29 18:08:52

Dwinin (12 views)
2014-07-29 10:59:34

E.R. Fleming (31 views)
2014-07-29 03:07:13

E.R. Fleming (12 views)
2014-07-29 03:06:25

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

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

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

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

ctomni231 (60 views)
2014-07-18 06:55:21
HotSpot Options
by dleskov
2014-07-08 03:59:08

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

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

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

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

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

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

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