diff options
author | Harvey Harrison <[email protected]> | 2012-11-22 23:04:08 -0800 |
---|---|---|
committer | Harvey Harrison <[email protected]> | 2012-11-23 20:18:55 -0800 |
commit | aeaf36684124a82eb30ab13de3d4f6ceff071bd4 (patch) | |
tree | 6cdb3fc31c5e5e0aaa28c9578e549f85c6771018 /src/classes | |
parent | 4a8f681b98081ac1b8c25919fe34518e11119955 (diff) |
j3dcore: grab the maxFixedFunction profile once in the JOGLPipeline initialization
Doing it here will improve the chances it comes from a non-AWT thread which can
lead to deadlock.
Signed-off-by: Harvey Harrison <[email protected]>
Diffstat (limited to 'src/classes')
-rw-r--r-- | src/classes/share/javax/media/j3d/JoglPipeline.java | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/src/classes/share/javax/media/j3d/JoglPipeline.java b/src/classes/share/javax/media/j3d/JoglPipeline.java index 4a5df2c..e3d7415 100644 --- a/src/classes/share/javax/media/j3d/JoglPipeline.java +++ b/src/classes/share/javax/media/j3d/JoglPipeline.java @@ -95,6 +95,7 @@ class JoglPipeline extends Pipeline { // Configurable constant just in case we want to change this later private static final int MIN_FRAME_SIZE = 1; + private GLProfile profile; /** * Constructor for singleton JoglPipeline instance */ @@ -112,6 +113,7 @@ class JoglPipeline extends Pipeline { // Java3D maintains strict control over which threads perform OpenGL work Threading.disableSingleThreading(); + profile = GLProfile.getMaxFixedFunc(true); // TODO: finish this with any other needed initialization } @@ -6175,7 +6177,7 @@ class JoglPipeline extends Pipeline { config.getGLCapabilities(), indexChooser, awtGraphicsScreen, VisualIDHolder.VID_UNDEFINED); NativeWindow nativeWindow = NativeWindowFactory.getNativeWindow(cv, awtGraphicsConfiguration); - draw = GLDrawableFactory.getFactory(getDefaultProfile()).createGLDrawable(nativeWindow); + draw = GLDrawableFactory.getFactory(profile).createGLDrawable(nativeWindow); cv.drawable = new JoglDrawable(draw); } else { draw = drawable(cv.drawable); @@ -6244,10 +6246,6 @@ class JoglPipeline extends Pipeline { return ctx; } - private GLProfile getDefaultProfile() { - return GLProfile.getMaxFixedFunc(true); - } - void createQueryContext(Canvas3D cv, Drawable drawable, boolean offScreen, int width, int height) { if (VERBOSE) System.err.println("JoglPipeline.createQueryContext()"); @@ -6261,7 +6259,7 @@ class JoglPipeline extends Pipeline { Frame f = new Frame(); f.setUndecorated(true); f.setLayout(new BorderLayout()); - GLCapabilities caps = new GLCapabilities(getDefaultProfile()); + GLCapabilities caps = new GLCapabilities(profile); ContextQuerier querier = new ContextQuerier(cv); // FIXME: should know what GraphicsDevice on which to create // this Canvas / Frame, and this should probably be known from @@ -6311,7 +6309,7 @@ class JoglPipeline extends Pipeline { GLCapabilities caps = jcfg.getGLCapabilities(); //FIXME use the real AWTGraphicsDevice - GLPbuffer pbuffer = GLDrawableFactory.getFactory(getDefaultProfile()).createGLPbuffer(GLDrawableFactory.getDesktopFactory().getDefaultDevice() ,caps, null,width, height, GLContext.getCurrent()); + GLPbuffer pbuffer = GLDrawableFactory.getFactory(profile).createGLPbuffer(GLDrawableFactory.getDesktopFactory().getDefaultDevice() ,caps, null,width, height, GLContext.getCurrent()); return new JoglDrawable(pbuffer); } @@ -7903,7 +7901,7 @@ void swapBuffers(Canvas3D cv, Context ctx, Drawable drawable) { */ // Create a GLCapabilities based on the GraphicsConfigTemplate3D - GLCapabilities caps = new GLCapabilities(getDefaultProfile()); + GLCapabilities caps = new GLCapabilities(profile); caps.setDoubleBuffered(gct.getDoubleBuffer() <= GraphicsConfigTemplate.PREFERRED); caps.setStereo (gct.getStereo() <= GraphicsConfigTemplate.PREFERRED); caps.setDepthBits (gct.getDepthSize()); @@ -8180,7 +8178,7 @@ void swapBuffers(Canvas3D cv, Context ctx, Drawable drawable) { // for Canvas. super(unwrap(awtGraphicsConfiguration)); NativeWindow nativeWindow = NativeWindowFactory.getNativeWindow(this, awtGraphicsConfiguration); - drawable = GLDrawableFactory.getFactory(getDefaultProfile()).createGLDrawable(nativeWindow); + drawable = GLDrawableFactory.getFactory(profile).createGLDrawable(nativeWindow); this.chooser = chooser; } |