Skip to content

Commit cbc9717

Browse files
committed
fixed demo
1 parent 2403764 commit cbc9717

File tree

5 files changed

+68
-6
lines changed

5 files changed

+68
-6
lines changed

build.gradle

+15
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ dependencies
6565

6666

6767
compile ('org.jogamp.jogl:jogl-all:2.3.1'){transitive = true}
68+
compile ('org.jogamp.jogl:jogl-all-main:2.3.1'){transitive = true}
6869
compile ('org.jogamp.jogl:jogl-all:2.3.1:natives-macosx-universal'){transitive = true}
6970
compile ('org.jogamp.jogl:jogl-all:2.3.1:natives-windows-amd64'){transitive = true}
7071
compile ('org.jogamp.jogl:jogl-all:2.3.1:natives-linux-amd64'){transitive = true}
@@ -105,6 +106,20 @@ if (JavaVersion.current().isJava8Compatible()) {
105106
}
106107
}
107108

109+
//***********************************************************************************
110+
// BINTRAY PUBLISHING
111+
112+
task TestProgFatJar(type:Jar) {
113+
archiveName = "TestProg.jar"
114+
from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
115+
with jar
116+
117+
manifest {
118+
attributes("Class-Path": ".", 'Main-Class': 'cleargl.testprog.JOGLTestProgram')
119+
}
120+
}
121+
122+
108123

109124

110125
//***********************************************************************************

src/java/cleargl/ClearGLDefaultEventListener.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,12 @@ private void setDebugPipeline(GLAutoDrawable pDrawable)
6161

6262
final GL lGL = pDrawable.getGL();
6363
lGL.getContext()
64-
.setGL(GLPipelineFactory.create("javax.media.opengl.Debug",
64+
.setGL(GLPipelineFactory.create("com.jogamp.opengl.Debug",
6565
null,
6666
lGL,
6767
null));
6868

69+
6970
mAlreadyInDebugMode = true;
7071
}
7172

src/java/cleargl/ClearGLWindow.java

+17-4
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,19 @@ public ClearGLWindow( String pWindowTitle,
112112
int pDefaultWidth,
113113
int pDefaultHeight,
114114
ClearGLEventListener pClearGLWindowEventListener)
115+
{
116+
this( pWindowTitle,
117+
pDefaultWidth,
118+
pDefaultHeight,
119+
16,
120+
pClearGLWindowEventListener);
121+
}
122+
123+
public ClearGLWindow( String pWindowTitle,
124+
int pDefaultWidth,
125+
int pDefaultHeight,
126+
int pNumberOfSamples,
127+
ClearGLEventListener pClearGLWindowEventListener)
115128
{
116129
super();
117130
mWindowTitle = pWindowTitle;
@@ -126,14 +139,14 @@ public ClearGLWindow( String pWindowTitle,
126139
+ lProfile);
127140
final GLCapabilities lCapabilities = new GLCapabilities(lProfile);
128141

129-
lCapabilities.setSampleBuffers(true);
130-
lCapabilities.setNumSamples(16);
142+
lCapabilities.setSampleBuffers(pNumberOfSamples > 1);
143+
lCapabilities.setNumSamples(pNumberOfSamples);
131144

132-
final GLCapabilitiesChooser multisampleChooser = new MultisampleChooser();
145+
final GLCapabilitiesChooser lMultisampleChooser = new MultisampleChooser();
133146

134147
mWindow = NewtFactory.createWindow(lCapabilities);
135148
mGlWindow = GLWindow.create(mWindow);
136-
mGlWindow.setCapabilitiesChooser(multisampleChooser);
149+
mGlWindow.setCapabilitiesChooser(lMultisampleChooser);
137150
mGlWindow.setTitle(pWindowTitle);
138151

139152
pClearGLWindowEventListener.setClearGLWindow(this);

src/java/cleargl/demo/ClearGLDemo.java

+6-1
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,9 @@ public void reshape(GLAutoDrawable pDrawable,
201201
public void display(GLAutoDrawable pDrawable)
202202
{
203203
super.display(pDrawable);
204+
204205
final GL lGL = pDrawable.getGL();
206+
205207
lGL.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
206208

207209
getClearGLWindow().lookAt(0f, 0f, 1, 0f, 0f, -1, 0, 1, 0);
@@ -284,7 +286,10 @@ public ClearGLDisplayable getClearGLWindow()
284286
// lClearGLWindow.disableClose();
285287
lClearGLWindow.setVisible(true);
286288

287-
Thread.sleep(2000);
289+
while (lClearGLWindow.isVisible())
290+
{
291+
Thread.sleep(100);
292+
}
288293
}
289294

290295
/*try (ClearGLJPanel lClearGLJPanel = new ClearGLJPanel(lClearGLWindowEventListener))
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
package cleargl.testprog;
2+
3+
import cleargl.demo.ClearGLDemo;
4+
5+
import com.jogamp.nativewindow.AbstractGraphicsDevice;
6+
import com.jogamp.opengl.GLCapabilities;
7+
import com.jogamp.opengl.GLProfile;
8+
9+
public class JOGLTestProgram
10+
{
11+
12+
13+
public static void main(String[] args) throws InterruptedException
14+
{
15+
final AbstractGraphicsDevice lDefaultDevice = GLProfile.getDefaultDevice();
16+
final GLProfile lProfile = GLProfile.getMaxProgrammable(true);
17+
final GLCapabilities lCapabilities = new GLCapabilities(lProfile);
18+
19+
System.out.println("Device: " + lDefaultDevice);
20+
System.out.println("Capabilities: " + lCapabilities);
21+
System.out.println("Profile: " + lProfile);
22+
23+
final ClearGLDemo lClearGLDemo = new ClearGLDemo();
24+
lClearGLDemo.demo();
25+
26+
}
27+
28+
}

0 commit comments

Comments
 (0)