Hello everyone. I’m developing a “gaming style GIS (Geospatial Information System)” around JOGL. I’ve got a funtional terrain engine and my texture mapping mostly under control. Right now I’m wollowing about trying to render convex polys. Can anyone help me with a concise example of how to deploy the GLTesselatorCallback(s) etc ?
Here’s where I’m at.
public class ParcelRenderer implements GLUtesselatorCallback {
public void beginData(int type, Object polygonData){}
public void edgeFlag(boolean boundaryEdge){}
public void combine(double[] coords, Object[] data, float[] weight, Object[] outData) {}
public void error(int errnum){}
public void edgeFlagData(boolean boundaryEdge, Object polygonData){}
public void end(){}
public void vertexData(Object vertexData, Object polygonData) {}
public void endData(Object polygonData) {}
public void begin(int type) {}
public void errorData(int errnum, Object polygonData) {}
public void vertex(Object vertexData) {}
public void combineData(double[] coords, Object[] data, float[] weight, Object[] outData, Object polygonData) {}
private double[][][] polys;
public void loadData(){/*Populate polys with some polygon data...*/}
public void drawPolys(GLDrawable drawable,GLUtesselator gluTess){
GL gl = drawable.getGL();
//No idea what to do here…
//GLU glu = drawable.getGLU();
//glu.gluTessCallback(gluTess,GLU.GLU_TESS_BEGIN,this);
//glu.gluTessCallback(gluTess,GLU.GLU_TESS_END,this);
//glu.gluTessCallback(gluTess,GLU.GLU_TESS_VERTEX,this);
for(int poly=0;poly<polys.length;poly++){
double[][] aPoly = polys[poly];
gl.glBegin(GL.GL_POLYGON);
for(int coord=0;coord<aPoly.length;coord++){
double x = aPoly[coord][0];
double y = aPoly[coord][1];
double z = aPoly[coord][2];
gl.glVertex3d(x,y,z);
}
gl.glEnd();
}
}