Summary: | Transformation applied to a texture is also applied to post render graphics | ||
---|---|---|---|
Product: | Java3D | Reporter: | Manu <puybaret> |
Component: | core | Assignee: | Phil Jordan <p.j.nz> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | gouessej, p.j.nz |
Priority: | --- | ||
Version: | unspecified | ||
Hardware: | All | ||
OS: | all | ||
Type: | DEFECT | SCM Refs: | |
Workaround: | --- |
Description
Manu
2014-05-06 14:20:37 CEST
I can confirm this bug, it was killing me for years, I couldn't do a decent HUD. I have a workaround however. The issue (if it's the same as I've had) only occurs when teh transformation is on the last rendered object, the order of rendering being not controlable in normal usage. The work around is to render a trivial object in the postRender call just prior to getting the graphics, in Canvas3D sub class: // For reseting the texture binding in the pipeline private static Shape3D trivialShape = new Cube(0.01f); @Override public void postRender() { // if the last rendered texture on a canvas3d has a transformation // then calls to the J3DGraphics2D will inherit it. Easy way to ensure last texture is plain, render trival cube. getGraphicsContext3D().draw(trivialShape); J3DGraphics2D g = getGraphics2D(); //draw hud etc... } Hope this helps someone somewhere. Thanks for the workaround, it works well. Trying to find a cleaner fix, I found that adding the following lines in JoglPipeline#texturemapping() after the call to gl.glEnable(GL.GL_TEXTURE_2D); would fix the problem: gl.glPushAttrib(GL2.GL_TRANSFORM_BIT); gl.glMatrixMode(GL.GL_TEXTURE); gl.glLoadIdentity(); gl.glPopAttrib(); I'm not sure that calls to gl.glPushAttrib and gl.glPopAttrib are mandatory. I borrowed this code from JoglPipeline#updateTextureAttributes method. Fixed in branch 1.7.0 |