FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

some ongoing work on GLW · GoToLoop/processing@cf23a59 · GitHub

Repository navigation

Commit cf23a59

Browse files
committed
some ongoing work on GLW
1 parent fe0a73e commit cf23a59

2 files changed

Lines changed: 52 additions & 2 deletions

File tree

‎java/libraries/glw/src/processing/glw/PGraphicsGLW.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
import processing.opengl.PGraphicsOpenGL;
2727

2828
/**
29-
* LWJGL renderer.
29+
* GLW renderer.
3030
*
3131
*/
3232
public class PGraphicsGLW extends PGraphicsOpenGL {

‎java/libraries/glw/src/processing/glw/PNEWT.java‎

Lines changed: 51 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,14 @@
2525

2626

2727
import javax.media.opengl.GLCapabilities;
28+
import javax.media.opengl.GLException;
2829
import javax.media.opengl.GLProfile;
2930

3031
import com.jogamp.newt.opengl.GLWindow;
3132
import com.jogamp.newt.event.WindowAdapter;
3233
import com.jogamp.newt.event.WindowEvent;
3334

35+
import processing.core.PGraphics;
3436
import processing.opengl.PGraphicsOpenGL;
3537
import processing.opengl.PJOGL;
3638

@@ -49,9 +51,43 @@ public PNEWT(PGraphicsOpenGL pg) {
4951
}
5052

5153

54+
static public GLWindow getWindow() {
55+
return window;
56+
}
57+
5258
protected void initSurface(int antialias) {
5359
if (profile == null) {
54-
profile = GLProfile.getDefault();
60+
if (PROFILE == 2) {
61+
try {
62+
profile = GLProfile.getGL2ES1();
63+
} catch (GLException ex) {
64+
profile = GLProfile.getMaxFixedFunc(true);
65+
}
66+
} else if (PROFILE == 3) {
67+
try {
68+
profile = GLProfile.getGL2GL3();
69+
} catch (GLException ex) {
70+
profile = GLProfile.getMaxProgrammable(true);
71+
}
72+
if (!profile.isGL3()) {
73+
PGraphics.showWarning("Requested profile GL3 but is not available, got: " + profile);
74+
}
75+
} else if (PROFILE == 4) {
76+
try {
77+
profile = GLProfile.getGL4ES3();
78+
} catch (GLException ex) {
79+
profile = GLProfile.getMaxProgrammable(true);
80+
}
81+
if (!profile.isGL4()) {
82+
PGraphics.showWarning("Requested profile GL4 but is not available, got: " + profile);
83+
}
84+
} else throw new RuntimeException(UNSUPPORTED_GLPROF_ERROR);
85+
86+
if (2 < PROFILE) {
87+
texVertShaderSource = convertVertexSource(texVertShaderSource, 120, 150);
88+
tex2DFragShaderSource = convertFragmentSource(tex2DFragShaderSource, 120, 150);
89+
texRectFragShaderSource = convertFragmentSource(texRectFragShaderSource, 120, 150);
90+
}
5591
} else {
5692
window.removeGLEventListener(listener);
5793
pg.parent.remove(canvasNEWT);
@@ -74,6 +110,8 @@ protected void initSurface(int antialias) {
74110
window = GLWindow.create(caps);
75111
window.setSize(pg.width, pg.height);
76112
window.setVisible(true);
113+
window.setTitle(pg.parent.frame.getTitle());
114+
//window.setUndecorated(true);
77115
pg.parent.frame.setVisible(false);
78116

79117
canvas = canvasNEWT;
@@ -88,6 +126,18 @@ public void windowDestroyNotify(final WindowEvent e) {
88126

89127
registerListeners();
90128
}
129+
130+
protected int getCurrentWidth() {
131+
if (window == null) return 0;
132+
else return window.getWidth();
133+
}
91134

135+
protected int getCurrentHeight() {
136+
if (window == null) return 0;
137+
else return window.getHeight();
138+
}
92139

140+
protected boolean displayable() {
141+
return false;
142+
}
93143
}

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL