Author Topic: jPCT dose not support jogl 2.1.5  (Read 20058 times)

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: jPCT dose not support jogl 2.1.5
« Reply #15 on: September 06, 2015, 02:58:27 pm »
You can push any matrix before the operation and pop it afterwards. That way, any changes to the pushed matrix will be discarded after the pop and the original values are restored.

Offline iamfoolberg

  • byte
  • *
  • Posts: 16
    • View Profile
Re: jPCT dose not support jogl 2.1.5
« Reply #16 on: September 07, 2015, 04:37:47 pm »
I've tried to push all that i can image, but the problem goes on.

When i load a .3ds file with the picture texture, WW's maps can be pasted corectly after the box/model goes out of sight. But i can no longer see the model again. It is covered by the WW's map layer--I do not know the reason now.

Is there some differences between drawing a box and a Primitive box? Some gl coordinate or texture transforms?

Or is it about FBO/VBO? Actually, i have no more idea now.



Code: [Select]
// puts opengl in the correct state for this layer
protected void beginDraw(DrawContext dc) {
GL2 gl = (GL2) dc.getGL();

// gl.glPushAttrib(GL2.GL_TEXTURE_BIT | GL2.GL_ENABLE_BIT
// | GL2.GL_CURRENT_BIT | GL2.GL_TRANSFORM_BIT);
gl.glPushAttrib(GL2.GL_ALL_ATTRIB_BITS);

// if (!dc.isPickingMode()) {
// gl.glEnable(GL.GL_BLEND);
// gl.glBlendFunc(GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA);
// }

gl.glMatrixMode(GL2.GL_MODELVIEW);//|GL2.GL_PROJECTION|GL2.GL_TEXTURE);
gl.glPushMatrix();
gl.glLoadIdentity();
gl.glMatrixMode(GL2.GL_PROJECTION);
gl.glPushMatrix();
gl.glLoadIdentity();
gl.glMatrixMode(GL2.GL_TEXTURE);
gl.glPushMatrix();
gl.glLoadIdentity();

gl.glMatrixPushEXT(GL2.GL_MODELVIEW);
gl.glMatrixPushEXT(GL2.GL_PROJECTION);
gl.glMatrixPushEXT(GL2.GL_TEXTURE);
// inject gl if neccessary
if (this.lastGL != gl) {
Util.injectExternalGL(canvas, gl);
this.lastGL = gl;
}
}
/**
* Called by WorldWind to refresh this layer.
*/
@Override
protected void doRender(DrawContext dc) {
this.beginDraw(dc);

// get the eye point of WW, to set the camera in jPCT
// so that jpct's camera go with ww's eye point
Vec4 eyeLoc = dc.getView().getEyePoint();
this.world.getCamera().setPosition(ww2jpct(eyeLoc));
this.world.getCamera().lookAt(new SimpleVector(0, 0, 0));

// save current gl settings before change it
dc.getView().pushReferenceCenter(dc, eyeLoc);

// jPCT draw its world with the given gl
this.repaint();

// force jPCT to draw on WW's gl.
Util.forceDraw(canvas);

    // restore last gl settings
dc.getView().popReferenceCenter(dc);
this.endDraw(dc);
}

// resets opengl state
protected void endDraw(DrawContext dc) {
GL2 gl = (GL2) dc.getGL();

gl.glMatrixPopEXT(GL2.GL_TEXTURE);
gl.glMatrixPopEXT(GL2.GL_PROJECTION);
gl.glMatrixPopEXT(GL2.GL_MODELVIEW);

gl.glMatrixMode(GL2.GL_TEXTURE);
gl.glPopMatrix();
gl.glMatrixMode(GL2.GL_PROJECTION);
gl.glPopMatrix();
gl.glMatrixMode(GL2.GL_MODELVIEW);//|GL2.GL_PROJECTION|GL2.GL_TEXTURE);
gl.glPopMatrix();

gl.glPopAttrib();
}

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: jPCT dose not support jogl 2.1.5
« Reply #17 on: September 07, 2015, 07:19:51 pm »
No, there's no difference between drawing models from different sources, if that was your question.
To be honest, I've long lost track of what the current state of your experiment is, what works and what doesn't and how you doing the actual rendering. As mentioned, jPCT delays the rendering until the AWT event dispatch thread is running. It's not ensured that this happens after calling draw or before calling your matrix pops. Have you actually implemented an IPaintListener AS I suggested before? If you have (and also if you haven't) I suggest to add some debug output all over the place to log the different operations so that we are getting a log that shows the actual order of operations.

Offline iamfoolberg

  • byte
  • *
  • Posts: 16
    • View Profile
Re: jPCT dose not support jogl 2.1.5
« Reply #18 on: September 12, 2015, 10:43:05 am »
Ok, let's end this thread, since the new version jogl such as 2.1.5 can be used by jPCT as http://www.jpct.net/forum2/index.php/topic,4454.msg30870.html#msg30870 described.

I'd like to open another thread to discuss the integrating of jPCT and WorldWind.

And would you please release the new version supporting higher jogl.