Bugzilla – Attachment 526 Details for
Bug 776
Allow sharing a GLContext w/ GLAutoDrawable more conveniently
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch of to get fixed version of JOGLTabbedPaneUsage w/ annotations
JOGLTabbedPaneUsage.fix.patch (text/plain), 4.44 KB, created by
Sven Gothel
on 2013-10-25 07:06:12 CEST
(
hide
)
Description:
Patch of to get fixed version of JOGLTabbedPaneUsage w/ annotations
Filename:
MIME Type:
Creator:
Sven Gothel
Created:
2013-10-25 07:06:12 CEST
Size:
4.44 KB
patch
obsolete
>--- JOGLTabbedPaneUsage.java 2013-10-25 05:27:27.291184500 +0200 >+++ JOGLTabbedPaneUsageFixed.java 2013-10-25 07:02:13.936633975 +0200 >@@ -2,6 +2,11 @@ > * Copyright (C) 2013 United States Government as represented by the Administrator of the > * National Aeronautics and Space Administration. > * All Rights Reserved. >+ * >+ * Copyright (C) 2013 JogAmp Community. All rights reserved. >+ * >+ * If you guys send me code w/o further declaration it is >+ * under the 'BSD License' ! > */ > > // package gov.nasa.worldwindx.examples.multiwindow; >@@ -18,7 +23,7 @@ > * @author tag > * @version $Id$ > */ >-public class JOGLTabbedPaneUsage extends JFrame >+public class JOGLTabbedPaneUsageFixed extends JFrame > { > int[] bufferId; > >@@ -28,7 +33,9 @@ > > public WWPanel(GLCanvas shareWith, int width, int height) > { >- canvas = shareWith != null ? new GLCanvas(getCaps(), shareWith.getContext()) : new GLCanvas(); >+ GLContext sharedCtx = shareWith != null ? shareWith.getContext() : null; >+ System.err.println("XXX WWPanel: shareWith "+shareWith+", sharedCtx "+sharedCtx); >+ canvas = new GLCanvas(getCaps(), sharedCtx); // same caps for 1st and 2nd shared ctx ! > canvas.setSize(new java.awt.Dimension(width, height)); > > setLayout(new BorderLayout(5, 5)); >@@ -42,7 +49,12 @@ > @Override > public void init(GLAutoDrawable glAutoDrawable) > { >-// glAutoDrawable.setGL(new DebugGL2(glAutoDrawable.getGL().getGL2())); >+ if (bufferId == null) { >+ makeVBO(glAutoDrawable); >+ System.err.println("XXX Create Buffer "+bufferId[0]); >+ } else { >+ System.err.println("XXX Reuse Buffer "+bufferId[0]); >+ } > } > > @Override >@@ -53,9 +65,6 @@ > @Override > public void display(GLAutoDrawable glAutoDrawable) > { >- if (bufferId == null) >- makeVBO(glAutoDrawable); >- > drawFrame(glAutoDrawable); > glAutoDrawable.swapBuffers(); > } >@@ -88,8 +97,8 @@ > gl.glColor3f(1, 1, 1); > > gl.glEnableClientState(GL2.GL_VERTEX_ARRAY); >- gl.glVertexPointer(3, GL2.GL_FLOAT, 0, 0); >- gl.glBindBuffer(GL2.GL_ARRAY_BUFFER, bufferId[0]); >+ gl.glBindBuffer(GL2.GL_ARRAY_BUFFER, bufferId[0]); // 1st bind the VBO >+ gl.glVertexPointer(3, GL2.GL_FLOAT, 0, 0); // 2nd use it - duh! > gl.glDrawArrays(GL2.GL_LINES, 0, 2); > > gl.glFlush(); >@@ -110,20 +119,24 @@ > gl.glBufferData(GL2.GL_ARRAY_BUFFER, vertices.capacity() * 4, vertices.rewind(), GL2.GL_STATIC_DRAW); > } > >- public JOGLTabbedPaneUsage() >+ public JOGLTabbedPaneUsageFixed() > { > try > { >+ GLProfile.initSingleton(); // Lets have init debug messages above below marker >+ System.err.println("XXX START DEMO XXX"); >+ > // Create the application frame and the tabbed pane and add the pane to the frame. > JTabbedPane tabbedPanel = new JTabbedPane(); > this.add(tabbedPanel, BorderLayout.CENTER); > > // Create two World Windows that share resources. > WWPanel wwpA = new WWPanel(null, 600, 600); >- WWPanel wwpB = new WWPanel(wwpA.canvas, wwpA.getWidth(), wwpA.getHeight()); >+ // ctx of wwpA is 'born' @ addNotify ! >+ // WWPanel wwpB = new WWPanel(wwpA.canvas, wwpA.getWidth(), wwpA.getHeight()); > > tabbedPanel.add(wwpA, "Window A"); >- tabbedPanel.add(wwpB, "Window B"); >+ // tabbedPanel.add(wwpB, "Window B"); > > // Add the card panel to the frame. > this.add(tabbedPanel, BorderLayout.CENTER); >@@ -133,7 +146,14 @@ > setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); > pack(); > setResizable(true); >+ System.err.println("XXX SetVisible XXX"); > setVisible(true); >+ >+ // Now we shall be ready for wwpB - Assuming all sequential on EDT >+ WWPanel wwpB = new WWPanel(wwpA.canvas, wwpA.getWidth(), wwpA.getHeight()); >+ tabbedPanel.add(wwpB, "Window B"); >+ pack(); >+ validate(); > } > catch (Exception e) > { >@@ -161,7 +181,7 @@ > { > public void run() > { >- new JOGLTabbedPaneUsage(); >+ new JOGLTabbedPaneUsageFixed(); > } > }); > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 776
:
492
|
525
| 526 |
527
|
528