com.jogamp.opengl.GL Java Examples
The following examples show how to use
com.jogamp.opengl.GL.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Gl_430_image_store.java From jogl-samples with MIT License | 6 votes |
@Override protected boolean end(GL gl) { GL4 gl4 = (GL4) gl; gl4.glDeleteTextures(1, textureName); BufferUtils.destroyDirectBuffer(textureName); gl4.glDeleteVertexArrays(1, vertexArrayName); BufferUtils.destroyDirectBuffer(vertexArrayName); gl4.glDeleteProgram(programName[Pipeline.READ]); gl4.glDeleteProgram(programName[Pipeline.SAVE]); gl4.glDeleteProgramPipelines(Pipeline.MAX, pipelineName); BufferUtils.destroyDirectBuffer(pipelineName); return true; }
Example #2
Source File: Shader.java From Ultraino with MIT License | 6 votes |
void bindAttribs(GL2 gl, Simulation s, MeshEntity me) { Mesh mesh; if ( me.getMesh().equals(Resources.MESH_CUSTOM) ){ mesh = me.customMesh; }else{ mesh = Resources.get().getMesh( me.getMesh() ); } if (mesh == null) { return; } gl.glVertexAttribPointer(vertexHandle, 3, GL.GL_FLOAT, false, 12, mesh.getPosition()); gl.glVertexAttribPointer(textureCoordHandle, 2, GL2.GL_FLOAT, false, 8, mesh.getTexture()); gl.glVertexAttribPointer(normalHandle, 3, GL2.GL_FLOAT, false, 12, mesh.getNormal()); gl.glEnableVertexAttribArray(vertexHandle); gl.glEnableVertexAttribArray(normalHandle); gl.glEnableVertexAttribArray(textureCoordHandle); }
Example #3
Source File: Gl_320_texture_cube.java From jogl-samples with MIT License | 6 votes |
@Override protected boolean end(GL gl) { GL3 gl3 = (GL3) gl; gl3.glDeleteBuffers(1, bufferName); gl3.glDeleteProgram(programName); gl3.glDeleteTextures(1, textureName); gl3.glDeleteVertexArrays(1, vertexArrayName); BufferUtils.destroyDirectBuffer(bufferName); BufferUtils.destroyDirectBuffer(textureName); BufferUtils.destroyDirectBuffer(vertexArrayName); BufferUtils.destroyDirectBuffer(clearColor); return true; }
Example #4
Source File: Gl_320_fbo_depth_multisample.java From jogl-samples with MIT License | 6 votes |
@Override protected boolean end(GL gl) { GL3 gl3 = (GL3) gl; gl3.glDeleteFramebuffers(Framebuffer.MAX, framebufferName); gl3.glDeleteProgram(programName[Program.SPLASH]); gl3.glDeleteProgram(programName[Program.TEXTURE]); gl3.glDeleteBuffers(Buffer.MAX, bufferName); gl3.glDeleteTextures(Texture.MAX, textureName); gl3.glDeleteVertexArrays(Program.MAX, vertexArrayName); BufferUtils.destroyDirectBuffer(framebufferName); BufferUtils.destroyDirectBuffer(bufferName); BufferUtils.destroyDirectBuffer(textureName); BufferUtils.destroyDirectBuffer(vertexArrayName); BufferUtils.destroyDirectBuffer(clearDepth); return checkError(gl3, "end"); }
Example #5
Source File: Es_300_fbo_srgb.java From jogl-samples with MIT License | 6 votes |
@Override protected boolean begin(GL gl) { GL3ES3 gl3es3 = (GL3ES3) gl; boolean validated = true; if (validated) { validated = initProgram(gl3es3); } if (validated) { validated = initBuffer(gl3es3); } if (validated) { validated = initVertexArray(gl3es3); } if (validated) { validated = initTexture(gl3es3); } if (validated) { validated = initFramebuffer(gl3es3); } return validated; }
Example #6
Source File: Gl_420_transform_feedback_instanced.java From jogl-samples with MIT License | 6 votes |
@Override protected boolean begin(GL gl) { GL4 gl4 = (GL4) gl; boolean validated = true; gl4.glEnable(GL_DEPTH_TEST); if (validated) { validated = initProgram(gl4); } if (validated) { validated = initBuffer(gl4); } if (validated) { validated = initVertexArray(gl4); } if (validated) { validated = initFeedback(gl4); } return validated; }
Example #7
Source File: Gl_430_query_conditional.java From jogl-samples with MIT License | 6 votes |
@Override protected boolean end(GL gl) { GL4 gl4 = (GL4) gl; gl4.glDeleteProgramPipelines(1, pipelineName); BufferUtils.destroyDirectBuffer(pipelineName); gl4.glDeleteProgram(programName); gl4.glDeleteBuffers(Buffer.MAX, bufferName); BufferUtils.destroyDirectBuffer(bufferName); gl4.glDeleteVertexArrays(1, vertexArrayName); BufferUtils.destroyDirectBuffer(vertexArrayName); gl4.glDeleteQueries(1, queryName); BufferUtils.destroyDirectBuffer(queryName); return checkError(gl4, "end"); }
Example #8
Source File: Gl_420_memory_barrier.java From jogl-samples with MIT License | 6 votes |
@Override protected boolean end(GL gl) { GL4 gl4 = (GL4) gl; gl4.glDeleteTextures(Texture.MAX, textureName); gl4.glDeleteFramebuffers(1, framebufferName); gl4.glDeleteProgram(programName[Program.BLIT]); gl4.glDeleteProgram(programName[Program.UPDATE]); gl4.glDeleteVertexArrays(1, vertexArrayName); gl4.glDeleteSamplers(1, samplerName); gl4.glDeleteProgramPipelines(Pipeline.MAX, pipelineName); BufferUtils.destroyDirectBuffer(textureName); BufferUtils.destroyDirectBuffer(framebufferName); BufferUtils.destroyDirectBuffer(vertexArrayName); BufferUtils.destroyDirectBuffer(samplerName); BufferUtils.destroyDirectBuffer(pipelineName); return true; }
Example #9
Source File: Gl_320_test_scissor.java From jogl-samples with MIT License | 6 votes |
@Override protected boolean begin(GL gl) { GL3 gl3 = (GL3) gl; boolean validated = true; if (validated) { validated = initProgram(gl3); } if (validated) { validated = initBuffer(gl3); } if (validated) { validated = initTexture(gl3); } if (validated) { validated = initVertexArray(gl3); } return validated; }
Example #10
Source File: Gl_430_image_store.java From jogl-samples with MIT License | 6 votes |
@Override protected boolean begin(GL gl) { GL4 gl4 = (GL4) gl; boolean validated = true; validated = validated && gl4.isExtensionAvailable("GL_ARB_shader_image_size"); logImplementationDependentLimit(gl4, GL_MAX_TEXTURE_IMAGE_UNITS, "GL_MAX_TEXTURE_IMAGE_UNITS"); if (validated) { validated = initTexture(gl4); } if (validated) { validated = initProgram(gl4); } if (validated) { validated = initVertexArray(gl4); } return validated; }
Example #11
Source File: Gl_420_picking.java From jogl-samples with MIT License | 6 votes |
@Override protected boolean end(GL gl) { GL4 gl4 = (GL4) gl; gl4.glDeleteProgramPipelines(1, pipelineName); gl4.glDeleteProgram(programName); gl4.glDeleteBuffers(Buffer.MAX, bufferName); gl4.glDeleteTextures(Texture.MAX, textureName); gl4.glDeleteVertexArrays(1, vertexArrayName); BufferUtils.destroyDirectBuffer(pipelineName); BufferUtils.destroyDirectBuffer(bufferName); BufferUtils.destroyDirectBuffer(textureName); BufferUtils.destroyDirectBuffer(vertexArrayName); return true; }
Example #12
Source File: Gl_320_transform_feedback_interleaved.java From jogl-samples with MIT License | 6 votes |
@Override protected boolean begin(GL gl) { GL3 gl3 = (GL3) gl; boolean validated = true; if (validated) { validated = initQuery(gl3); } if (validated) { validated = initProgram(gl3); } if (validated) { validated = initBuffer(gl3); } if (validated) { validated = initVertexArray(gl3); } return validated && checkError(gl3, "begin"); }
Example #13
Source File: Gl_440_atomic_counter.java From jogl-samples with MIT License | 6 votes |
@Override protected boolean begin(GL gl) { GL4 gl4 = (GL4) gl; boolean validated = gl4.isExtensionAvailable("GL_ARB_clear_buffer_object"); if (validated) { validated = initBuffer(gl4); } if (validated) { validated = initProgram(gl4); } if (validated) { validated = initVertexArray(gl4); } return validated; }
Example #14
Source File: Gl_410_program_binary.java From jogl-samples with MIT License | 6 votes |
@Override protected boolean end(GL gl) { GL4 gl4 = (GL4) gl; gl4.glDeleteBuffers(Buffer.MAX, bufferName); gl4.glDeleteVertexArrays(1, vertexArrayName); gl4.glDeleteTextures(1, texture2dName); for (int i = 0; i < Program.MAX; ++i) { gl4.glDeleteProgram(programName[i]); } gl4.glDeleteProgramPipelines(1, pipelineName); BufferUtils.destroyDirectBuffer(bufferName); BufferUtils.destroyDirectBuffer(vertexArrayName); BufferUtils.destroyDirectBuffer(pipelineName); return true; }
Example #15
Source File: GltfViewerJogl.java From JglTF with MIT License | 6 votes |
@Override public void init(GLAutoDrawable drawable) { initComplete = false; GL glBase = drawable.getGL(); glBase.setSwapInterval(0); if (!(glBase instanceof GL3)) { logger.severe("Could not obtain a GL3 instance"); logger.severe(createGlContextDebugString(glBase)); return; } initComplete = true; }
Example #16
Source File: FieldDrawer.java From gama with GNU General Public License v3.0 | 6 votes |
public void drawTexturedTriangle(final double w, final double h, final int i, final int j, final ICoordinates vertices) { final double xt = w * i, yt = h * j, xt2 = xt + w, yt2 = yt + h; final double[] texCoords3 = { xt2, yt, xt, yt2, xt, yt }; threePoints.setTo(vertices.at(2), vertices.at(1), vertices.at(0)); gl.setNormal(threePoints, true); gl.drawVertices(GL.GL_TRIANGLES, threePoints, 3, true, texCoords3); texCoords3[0] = xt; texCoords3[1] = yt2; texCoords3[2] = xt2; texCoords3[3] = yt; texCoords3[4] = xt2; texCoords3[5] = yt2; threePoints.setTo(vertices.at(1), vertices.at(2), vertices.at(3)); gl.setNormal(threePoints, false); gl.drawVertices(GL.GL_TRIANGLES, threePoints, 3, false, texCoords3); }
Example #17
Source File: UIGLListener01.java From jogl-samples with MIT License | 6 votes |
@Override public void display(final GLAutoDrawable drawable) { final GL2ES2 gl = drawable.getGL().getGL2ES2(); gl.glClearColor(1.0f, 1.0f, 1.0f, 1.0f); gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); final int[] sampleCount = { 4 }; final float[] translate = button.getTranslate(); final RegionRenderer regionRenderer = getRegionRenderer(); final PMVMatrix pmv = regionRenderer.getMatrix(); pmv.glMatrixMode(GLMatrixFunc.GL_MODELVIEW); pmv.glLoadIdentity(); pmv.glTranslatef(getXTran(), getYTran(), getZoom()); pmv.glRotatef(getAngle(), 0, 1, 0); pmv.glTranslatef(translate[0], translate[1], 0); button.drawShape(gl, regionRenderer, sampleCount); }
Example #18
Source File: Gl_300_fbo_multisample.java From jogl-samples with MIT License | 6 votes |
@Override protected boolean begin(GL gl) { GL3 gl3 = (GL3) gl; boolean validated = true; if (validated) { validated = initProgram(gl3); } if (validated) { validated = initBuffer(gl3); } if (validated) { validated = initVertexArray(gl3); } if (validated) { validated = initTexture(gl3); } if (validated) { validated = initFramebuffer(gl3); } return validated & checkError(gl, "begin"); }
Example #19
Source File: Gl_330_query_conditional.java From jogl-samples with MIT License | 6 votes |
@Override protected boolean begin(GL gl) { GL3 gl3 = (GL3) gl; boolean validated = true; if (validated) { validated = initProgram(gl3); } if (validated) { validated = initBuffer(gl3); } if (validated) { validated = initVertexArray(gl3); } if (validated) { validated = initQuery(gl3); } return validated && checkError(gl3, "begin"); }
Example #20
Source File: Gl_320_transform_feedback_separated.java From jogl-samples with MIT License | 6 votes |
@Override protected boolean begin(GL gl) { GL3 gl3 = (GL3) gl; boolean validated = true; if (validated) { validated = initQuery(gl3); } if (validated) { validated = initProgram(gl3); } if (validated) { validated = initBuffer(gl3); } if (validated) { validated = initVertexArray(gl3); } return validated && checkError(gl3, "begin"); }
Example #21
Source File: Gl_320_primitive_point.java From jogl-samples with MIT License | 6 votes |
@Override protected boolean begin(GL gl) { GL3 gl3 = (GL3) gl; boolean validated = true; if (validated) { validated = initProgram(gl3); } if (validated) { validated = initBuffer(gl3); } if (validated) { validated = initVertexArray(gl3); } gl3.glEnable(GL_DEPTH_TEST); gl3.glDepthFunc(GL_LESS); gl3.glEnable(GL_PROGRAM_POINT_SIZE); //glPointParameteri(GL_POINT_SPRITE_COORD_ORIGIN, GL_LOWER_LEFT); gl3.glPointParameteri(GL_POINT_SPRITE_COORD_ORIGIN, GL_UPPER_LEFT); return validated && checkError(gl3, "begin"); }
Example #22
Source File: Gl_320_draw_range_elements.java From jogl-samples with MIT License | 6 votes |
@Override protected boolean begin(GL gl) { GL3 gl3 = (GL3) gl; boolean validated = true; if (validated) { validated = initTest(gl3); } if (validated) { validated = initProgram(gl3); } if (validated) { validated = initBuffer(gl3); } if (validated) { validated = initVertexArray(gl3); } return validated && checkError(gl3, "begin"); }
Example #23
Source File: Gl_320_fbo_integer.java From jogl-samples with MIT License | 6 votes |
@Override protected boolean end(GL gl) { GL3 gl3 = (GL3) gl; gl3.glDeleteBuffers(1, bufferName); gl3.glDeleteProgram(programName[Program.RENDER]); gl3.glDeleteProgram(programName[Program.SPLASH]); gl3.glDeleteTextures(Texture.MAX, textureName); gl3.glDeleteFramebuffers(1, framebufferName); gl3.glDeleteVertexArrays(1, vertexArrayName); BufferUtils.destroyDirectBuffer(bufferName); BufferUtils.destroyDirectBuffer(textureName); BufferUtils.destroyDirectBuffer(framebufferName); BufferUtils.destroyDirectBuffer(vertexArrayName); return checkError(gl3, "end"); }
Example #24
Source File: GltfViewerJogl.java From JglTF with MIT License | 6 votes |
/** * Create a string with debug information about the given GL instance * * @param glBase The GL instance * @return The string */ private String createGlContextDebugString(GL glBase) { StringBuilder sb = new StringBuilder(); sb.append("GLProfile: " + getGLProfile()).append("\n"); sb.append("Availability:").append("\n"); for (String profile : GLProfile.GL_PROFILE_LIST_ALL) { sb.append(" " + profile + " : " + GLProfile.isAvailable(profile)).append("\n"); } sb.append("Context information:\n" + glBase.getContext().toString()).append("\n"); return sb.toString(); }
Example #25
Source File: Gl_320_transform_feedback_interleaved.java From jogl-samples with MIT License | 6 votes |
@Override protected boolean end(GL gl) { GL3 gl3 = (GL3) gl; for (int i = 0; i < Program.MAX; ++i) { gl3.glDeleteProgram(programName[i]); } gl3.glDeleteVertexArrays(Program.MAX, vertexArrayName); gl3.glDeleteBuffers(Program.MAX, bufferName); gl3.glDeleteQueries(1, queryName); BufferUtils.destroyDirectBuffer(vertexArrayName); BufferUtils.destroyDirectBuffer(bufferName); BufferUtils.destroyDirectBuffer(queryName); return checkError(gl3, "end"); }
Example #26
Source File: Gl_430_program_compute.java From jogl-samples with MIT License | 6 votes |
@Override protected boolean end(GL gl) { GL4 gl4 = (GL4) gl; gl4.glDeleteProgramPipelines(Program.MAX, pipelineName); BufferUtils.destroyDirectBuffer(pipelineName); gl4.glDeleteProgram(programName[Program.GRAPHICS]); gl4.glDeleteProgram(programName[Program.COMPUTE]); gl4.glDeleteBuffers(Buffer.MAX, bufferName); BufferUtils.destroyDirectBuffer(bufferName); gl4.glDeleteTextures(1, textureName); BufferUtils.destroyDirectBuffer(textureName); gl4.glDeleteVertexArrays(1, vertexArrayName); BufferUtils.destroyDirectBuffer(vertexArrayName); return true; }
Example #27
Source File: Gl_440_texture_compressed.java From jogl-samples with MIT License | 5 votes |
@Override protected boolean begin(GL gl) { GL4 gl4 = (GL4) gl; viewport[Texture.RGB8] = new Vec4i(0, 0, windowSize.x >> 1, windowSize.y >> 1); viewport[Texture.RGB10] = new Vec4i(windowSize.x >> 1, 0, windowSize.x >> 1, windowSize.y >> 1); viewport[Texture.BC1] = new Vec4i(windowSize.x >> 1, windowSize.y >> 1, windowSize.x >> 1, windowSize.y >> 1); viewport[Texture.BC3] = new Vec4i(0, windowSize.y >> 1, windowSize.x >> 1, windowSize.y >> 1); boolean validated = gl4.isExtensionAvailable("GL_ARB_multi_bind"); if (validated) { validated = initProgram(gl4); } if (validated) { validated = initBuffer(gl4); } if (validated) { validated = initVertexArray(gl4); } if (validated) { validated = initTexture(gl4); } if (validated) { validated = initSampler(gl4); } return validated; }
Example #28
Source File: Gl_330_texture_swizzle.java From jogl-samples with MIT License | 5 votes |
@Override protected boolean begin(GL gl) { GL3 gl3 = (GL3) gl; viewport[Viewport.V00] = new Vec4i(0, 0, windowSize.x >> 1, windowSize.y >> 1); viewport[Viewport.V10] = new Vec4i(windowSize.x >> 1, 0, windowSize.x >> 1, windowSize.y >> 1); viewport[Viewport.V11] = new Vec4i(windowSize.x >> 1, windowSize.y >> 1, windowSize.x >> 1, windowSize.y >> 1); viewport[Viewport.V01] = new Vec4i(0, windowSize.y >> 1, windowSize.x >> 1, windowSize.y >> 1); boolean validated = true; if (validated) { validated = initProgram(gl3); } if (validated) { validated = initBuffer(gl3); } if (validated) { validated = initTexture(gl3); } if (validated) { validated = initVertexArray(gl3); } return validated && checkError(gl3, "begin"); }
Example #29
Source File: MSAATool.java From jogl-samples with MIT License | 5 votes |
public static boolean glIsEnabled(final GL gl, final int name) { boolean isEnabled = false; try { isEnabled = gl.glIsEnabled(name); final int glerr = gl.glGetError(); if(GL.GL_NO_ERROR != glerr) { System.err.println("glIsEnabled(0x"+Integer.toHexString(name)+") -> error 0x"+Integer.toHexString(glerr)); } } catch (final Exception e) { System.err.println("Caught exception: "+e.getMessage()); // e.printStackTrace(); } return isEnabled; }
Example #30
Source File: TextureCache2.java From gama with GNU General Public License v3.0 | 5 votes |
private Texture buildTexture(final GL gl, final File file) { return buildTexture(gl, ImageUtils.getInstance().getImageFromFile(file, true, true)); // try { // final TextureData data = AWTTextureIO.newTextureData(gl.getGLProfile(), file, true, null); // final Texture texture = new Texture(gl, data); // data.flush(); // return texture; // } catch (final GLException | IOException e) { // e.printStackTrace(); // return null; // } }