From f8a74c9831c65725a699320c27e62161a0378241 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Tue, 14 Jan 2014 19:38:49 +0100 Subject: Revert "Bug 942 - Share GLBufferStateTracker ; Unify GLBufferStateTracker and GLBufferSizeTracker (simplification)" This reverts commit 7c5483d5b20aed9c87c5ce3f6bc840b6546edcd1. --- .../classes/jogamp/opengl/GLContextShareSet.java | 24 ++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'src/jogl/classes/jogamp/opengl/GLContextShareSet.java') diff --git a/src/jogl/classes/jogamp/opengl/GLContextShareSet.java b/src/jogl/classes/jogamp/opengl/GLContextShareSet.java index c057c904c..483767b44 100644 --- a/src/jogl/classes/jogamp/opengl/GLContextShareSet.java +++ b/src/jogl/classes/jogamp/opengl/GLContextShareSet.java @@ -262,6 +262,30 @@ public class GLContextShareSet { return false; } + /** In order to avoid glGet calls for buffer object checks related + to glVertexPointer, etc. calls as well as glMapBuffer calls, we + need to share the same GLBufferSizeTracker object between + contexts sharing textures and display lists. For now we keep + this mechanism orthogonal to the GLObjectTracker to hopefully + keep things easier to understand. (The GLObjectTracker is + currently only needed in a fairly esoteric case, when the + Java2D/JOGL bridge is active, but the GLBufferSizeTracker + mechanism is now always required.) */ + public static void synchronizeBufferObjectSharing(final GLContext olderContextOrNull, final GLContext newContext) { + final GLContextImpl older = (GLContextImpl) olderContextOrNull; + final GLContextImpl newer = (GLContextImpl) newContext; + GLBufferSizeTracker tracker = null; + if (older != null) { + tracker = older.getBufferSizeTracker(); + assert (tracker != null) + : "registerForBufferObjectSharing was not called properly for the older context, or has a bug in it"; + } + if (tracker == null) { + tracker = new GLBufferSizeTracker(); + } + newer.setBufferSizeTracker(tracker); + } + //---------------------------------------------------------------------- // Internals only below this point -- cgit v1.2.3