MCPcopy Index your code
hub / github.com/processing/processing / initGL

Method initGL

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

Source from the content-addressed store, hash-verified

179
180
181 protected void initGL() {
182// System.out.println("*******************************");
183 if (profile == null) {
184 if (PJOGL.profile == 1) {
185 try {
186 profile = GLProfile.getGL2ES1();
187 } catch (GLException ex) {
188 profile = GLProfile.getMaxFixedFunc(true);
189 }
190 } else if (PJOGL.profile == 2) {
191 try {
192 profile = GLProfile.getGL2ES2();
193
194 // workaround for https://jogamp.org/bugzilla/show_bug.cgi?id=1347
195 if (!profile.isHardwareRasterizer()) {
196 GLProfile hardware = GLProfile.getMaxProgrammable(true);
197 if (hardware.isGL2ES2()) {
198 profile = hardware;
199 }
200 }
201
202 } catch (GLException ex) {
203 profile = GLProfile.getMaxProgrammable(true);
204 }
205 } else if (PJOGL.profile == 3) {
206 try {
207 profile = GLProfile.getGL2GL3();
208 } catch (GLException ex) {
209 profile = GLProfile.getMaxProgrammable(true);
210 }
211 if (!profile.isGL3()) {
212 PGraphics.showWarning("Requested profile GL3 but is not available, got: " + profile);
213 }
214 } else if (PJOGL.profile == 4) {
215 try {
216 profile = GLProfile.getGL4ES3();
217 } catch (GLException ex) {
218 profile = GLProfile.getMaxProgrammable(true);
219 }
220 if (!profile.isGL4()) {
221 PGraphics.showWarning("Requested profile GL4 but is not available, got: " + profile);
222 }
223 } else throw new RuntimeException(PGL.UNSUPPORTED_GLPROF_ERROR);
224 }
225
226 // Setting up the desired capabilities;
227 GLCapabilities caps = new GLCapabilities(profile);
228 caps.setAlphaBits(PGL.REQUESTED_ALPHA_BITS);
229 caps.setDepthBits(PGL.REQUESTED_DEPTH_BITS);
230 caps.setStencilBits(PGL.REQUESTED_STENCIL_BITS);
231
232// caps.setPBuffer(false);
233// caps.setFBO(false);
234
235// pgl.reqNumSamples = PGL.smoothToSamples(graphics.smooth);
236 caps.setSampleBuffers(true);
237 caps.setNumSamples(PGL.smoothToSamples(graphics.smooth));
238 caps.setBackgroundOpaque(true);

Callers 1

initFrameMethod · 0.95

Calls 3

showWarningMethod · 0.95
smoothToSamplesMethod · 0.95
setCapsMethod · 0.80

Tested by

no test coverage detected