MCPcopy Create free account
hub / github.com/benfry/processing4 / initGL

Method initGL

core/src/processing/opengl/PSurfaceJOGL.java:213–279  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

211
212
213 protected void initGL() {
214 if (profile == null) {
215 if (PJOGL.profile == 1) {
216 try {
217 profile = GLProfile.getGL2ES1();
218 } catch (GLException ex) {
219 profile = GLProfile.getMaxFixedFunc(true);
220 }
221 } else if (PJOGL.profile == 2) {
222 try {
223 profile = GLProfile.getGL2ES2();
224
225 // workaround for https://jogamp.org/bugzilla/show_bug.cgi?id=1347
226 if (!profile.isHardwareRasterizer()) {
227 GLProfile hardware = GLProfile.getMaxProgrammable(true);
228 if (hardware.isGL2ES2()) {
229 profile = hardware;
230 }
231 }
232
233 } catch (GLException ex) {
234 profile = GLProfile.getMaxProgrammable(true);
235 }
236 } else if (PJOGL.profile == 3) {
237 try {
238 profile = GLProfile.getGL2GL3();
239 } catch (GLException ex) {
240 profile = GLProfile.getMaxProgrammable(true);
241 }
242 if (!profile.isGL3()) {
243 PGraphics.showWarning("Requested profile GL3 but is not available, got: " + profile);
244 }
245 } else if (PJOGL.profile == 4) {
246 try {
247 profile = GLProfile.getGL4ES3();
248 } catch (GLException ex) {
249 profile = GLProfile.getMaxProgrammable(true);
250 }
251 if (!profile.isGL4()) {
252 PGraphics.showWarning("Requested profile GL4 but is not available, got: " + profile);
253 }
254 } else throw new RuntimeException(PGL.UNSUPPORTED_GLPROF_ERROR);
255 }
256
257 // Setting up the desired capabilities;
258 GLCapabilities caps = new GLCapabilities(profile);
259 caps.setAlphaBits(PGL.REQUESTED_ALPHA_BITS);
260 caps.setDepthBits(PGL.REQUESTED_DEPTH_BITS);
261 caps.setStencilBits(PGL.REQUESTED_STENCIL_BITS);
262
263// caps.setPBuffer(false);
264// caps.setFBO(false);
265
266// pgl.reqNumSamples = PGL.smoothToSamples(graphics.smooth);
267 caps.setSampleBuffers(true);
268 caps.setNumSamples(PGL.smoothToSamples(graphics.smooth));
269 caps.setBackgroundOpaque(true);
270 caps.setOnscreen(true);

Callers 1

initFrameMethod · 0.95

Calls 4

showWarningMethod · 0.95
smoothToSamplesMethod · 0.95
setCapsMethod · 0.80
displayMethod · 0.80

Tested by

no test coverage detected