com.jogamp.opengl.GL3 Java Examples
The following examples show how to use
com.jogamp.opengl.GL3.
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_320_texture_compressed_ext.java From jogl-samples with MIT License | 6 votes |
private boolean initVertexArray(GL3 gl3) { gl3.glGenVertexArrays(1, vertexArrayName); gl3.glBindVertexArray(vertexArrayName.get(0)); { gl3.glBindBuffer(GL_ARRAY_BUFFER, bufferName.get(0)); gl3.glVertexAttribPointer(Semantic.Attr.POSITION, 2, GL_FLOAT, false, glf.Vertex_v2fv2f.SIZE, 0); gl3.glVertexAttribPointer(Semantic.Attr.TEXCOORD, 2, GL_FLOAT, false, glf.Vertex_v2fv2f.SIZE, Vec2.SIZE); gl3.glBindBuffer(GL_ARRAY_BUFFER, 0); gl3.glEnableVertexAttribArray(Semantic.Attr.POSITION); gl3.glEnableVertexAttribArray(Semantic.Attr.TEXCOORD); } gl3.glBindVertexArray(0); return true; }
Example #2
Source File: Gl_320_program.java From jogl-samples with MIT License | 6 votes |
private boolean initVertexArray(GL3 gl3) { gl3.glGenVertexArrays(1, vertexArrayName); gl3.glBindVertexArray(vertexArrayName.get(0)); { gl3.glBindBuffer(GL_ARRAY_BUFFER, bufferName.get(Buffer.VERTEX)); gl3.glVertexAttribPointer(Semantic.Attr.POSITION, 2, GL_FLOAT, false, 0, 0); gl3.glEnableVertexAttribArray(Semantic.Attr.POSITION); gl3.glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, bufferName.get(Buffer.ELEMENT)); } gl3.glBindVertexArray(0); return checkError(gl3, "initVertexArray"); }
Example #3
Source File: Gl_320_fbo_shadow.java From jogl-samples with MIT License | 6 votes |
private boolean initVertexArray(GL3 gl3) { gl3.glGenVertexArrays(Program.MAX, vertexArrayName); gl3.glBindVertexArray(vertexArrayName.get(Program.RENDER)); { gl3.glBindBuffer(GL_ARRAY_BUFFER, bufferName.get(Buffer.VERTEX)); gl3.glVertexAttribPointer(Semantic.Attr.POSITION, 3, GL_FLOAT, false, Vertex_v3fv4u8.SIZE, 0); gl3.glVertexAttribPointer(Semantic.Attr.COLOR, 4, GL_UNSIGNED_BYTE, true, Vertex_v3fv4u8.SIZE, Vec3.SIZE); gl3.glBindBuffer(GL_ARRAY_BUFFER, 0); gl3.glEnableVertexAttribArray(Semantic.Attr.POSITION); gl3.glEnableVertexAttribArray(Semantic.Attr.COLOR); gl3.glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, bufferName.get(Buffer.ELEMENT)); } gl3.glBindVertexArray(0); return true; }
Example #4
Source File: Gl_320_fbo_rtt_texture_array.java From jogl-samples with MIT License | 6 votes |
private boolean initFramebuffer(GL3 gl3) { gl3.glGenFramebuffers(1, framebufferName); gl3.glBindFramebuffer(GL_FRAMEBUFFER, framebufferName.get(0)); int[] drawBuffers = new int[3]; drawBuffers[0] = GL_COLOR_ATTACHMENT0; drawBuffers[1] = GL_COLOR_ATTACHMENT1; drawBuffers[2] = GL_COLOR_ATTACHMENT2; gl3.glDrawBuffers(3, drawBuffers, 0); for (int i = Texture.RED; i <= Texture.BLUE; ++i) { gl3.glFramebufferTextureLayer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0 + (i - Texture.RED), textureName.get(0), 0, i); } if (!isFramebufferComplete(gl3, framebufferName.get(0))) { return false; } gl3.glBindFramebuffer(GL_FRAMEBUFFER, 0); return checkError(gl3, "initFramebuffer"); }
Example #5
Source File: Gl_330_draw_instanced_array.java From jogl-samples with MIT License | 6 votes |
private boolean initBuffer(GL3 gl3) { FloatBuffer positionBuffer = GLBuffers.newDirectFloatBuffer(positionData); FloatBuffer colorBuffer = GLBuffers.newDirectFloatBuffer(colorData); gl3.glGenBuffers(Buffer.MAX, bufferName); gl3.glBindBuffer(GL_ARRAY_BUFFER, bufferName.get(Buffer.POSITION)); gl3.glBufferData(GL_ARRAY_BUFFER, positionSize, positionBuffer, GL_STATIC_DRAW); gl3.glBindBuffer(GL_ARRAY_BUFFER, 0); gl3.glBindBuffer(GL_ARRAY_BUFFER, bufferName.get(Buffer.COLOR)); gl3.glBufferData(GL_ARRAY_BUFFER, colorSize, colorBuffer, GL_STATIC_DRAW); gl3.glBindBuffer(GL_ARRAY_BUFFER, 0); BufferUtils.destroyDirectBuffer(positionBuffer); BufferUtils.destroyDirectBuffer(colorBuffer); return checkError(gl3, "initBuffer"); }
Example #6
Source File: Gl_320_sync.java From jogl-samples with MIT License | 6 votes |
@Override protected boolean end(GL gl) { GL3 gl3 = (GL3) gl; gl3.glDeleteSync(syncName); gl3.glDeleteBuffers(Buffer.MAX, 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 #7
Source File: Gl_320_texture_offset.java From jogl-samples with MIT License | 6 votes |
@Override protected boolean end(GL gl) { GL3 gl3 = (GL3) gl; gl3.glDeleteBuffers(Buffer.MAX, bufferName); for (int i = 0; i < Program.MAX; ++i) { gl3.glDeleteProgram(programName[i]); } gl3.glDeleteTextures(1, textureName); gl3.glDeleteVertexArrays(1, vertexArrayName); BufferUtils.destroyDirectBuffer(bufferName); BufferUtils.destroyDirectBuffer(textureName); BufferUtils.destroyDirectBuffer(vertexArrayName); return true; }
Example #8
Source File: Gl_320_fbo_layered.java From jogl-samples with MIT License | 6 votes |
private boolean initBuffer(GL3 gl3) { ShortBuffer elementBuffer = GLBuffers.newDirectShortBuffer(elementData); FloatBuffer vertexBuffer = GLBuffers.newDirectFloatBuffer(vertexData); gl3.glGenBuffers(Buffer.MAX, bufferName); gl3.glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, bufferName.get(Buffer.ELEMENT)); gl3.glBufferData(GL_ELEMENT_ARRAY_BUFFER, elementSize, elementBuffer, GL_STATIC_DRAW); gl3.glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); gl3.glBindBuffer(GL_ARRAY_BUFFER, bufferName.get(Buffer.VERTEX)); gl3.glBufferData(GL_ARRAY_BUFFER, vertexSize, vertexBuffer, GL_STATIC_DRAW); gl3.glBindBuffer(GL_ARRAY_BUFFER, 0); BufferUtils.destroyDirectBuffer(elementBuffer); BufferUtils.destroyDirectBuffer(vertexBuffer); return checkError(gl3, "initBuffer"); }
Example #9
Source File: Gl_320_buffer_update.java From jogl-samples with MIT License | 6 votes |
@Override protected boolean begin(GL gl) { boolean validated = true; GL3 gl3 = (GL3) gl; if (validated) { validated = initProgram(gl3); } if (validated) { validated = initBuffer(gl3); } if (validated) { validated = initVertexArray(gl3); } return validated && checkError(gl, "begin"); }
Example #10
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 #11
Source File: BlazeBatcher.java From constellation with Apache License 2.0 | 6 votes |
@Override public void drawBatch(final GL3 gl, final Camera camera, final Matrix44f mvMatrix, final Matrix44f pMatrix) { if (batch.isDrawable()) { gl.glUseProgram(shader); gl.glUniformMatrix4fv(shaderMVMatrix, 1, false, mvMatrix.a, 0); gl.glUniformMatrix4fv(shaderPMatrix, 1, false, pMatrix.a, 0); gl.glUniform1f(shaderVisibilityLow, camera.getVisibilityLow()); gl.glUniform1f(shaderVisibilityHigh, camera.getVisibilityHigh()); gl.glUniform1f(shaderMorphMix, camera.getMix()); gl.glUniform1i(shaderXyzTexture, TextureUnits.VERTICES); gl.glUniform1i(shaderImagesTexture, TextureUnits.ICONS); gl.glUniform1f(shaderScale, blazeSize); gl.glUniform1f(shaderOpacity, blazeOpacity); gl.glDisable(GL3.GL_DEPTH_TEST); batch.draw(gl); gl.glEnable(GL3.GL_DEPTH_TEST); } }
Example #12
Source File: Gl_330_draw_instanced_array.java From jogl-samples with MIT License | 6 votes |
@Override protected boolean render(GL gl) { GL3 gl3 = (GL3) gl; Mat4 projection = glm.perspective_((float) Math.PI * 0.25f, 4.0f / 3.0f, 0.1f, 100.0f); Mat4 model = new Mat4(1.0f); Mat4 mvp = projection.mul(viewMat4()).mul(model); gl3.glViewport(0, 0, windowSize.x, windowSize.y); float[] depth = {1.0f}; gl3.glClearBufferfv(GL_DEPTH, 0, depth, 0); gl3.glClearBufferfv(GL_COLOR, 0, clearColor.put(0, 0).put(1, 0).put(2, 0).put(3, 1)); gl3.glUseProgram(programName); gl3.glUniformMatrix4fv(uniformMvp, 1, false, mvp.toFa_(), 0); gl3.glBindVertexArray(vertexArrayName.get(0)); gl3.glDrawArraysInstanced(GL_TRIANGLES, 0, vertexCount, 10); return true; }
Example #13
Source File: Gl_320_fbo_integer_blit.java From jogl-samples with MIT License | 6 votes |
private boolean initVertexArray(GL3 gl3) { gl3.glGenVertexArrays(1, vertexArrayName); gl3.glBindVertexArray(vertexArrayName.get(0)); { gl3.glBindBuffer(GL_ARRAY_BUFFER, bufferName.get(0)); gl3.glVertexAttribPointer(Semantic.Attr.POSITION, 2, GL_FLOAT, false, glf.Vertex_v2fv2f.SIZE, 0); gl3.glVertexAttribPointer(Semantic.Attr.TEXCOORD, 2, GL_FLOAT, false, glf.Vertex_v2fv2f.SIZE, Vec2.SIZE); gl3.glBindBuffer(GL_ARRAY_BUFFER, 0); gl3.glEnableVertexAttribArray(Semantic.Attr.POSITION); gl3.glEnableVertexAttribArray(Semantic.Attr.TEXCOORD); } gl3.glBindVertexArray(0); return checkError(gl3, "initVertexArray"); }
Example #14
Source File: Gl_330_fbo_multisample_explicit_nv.java From jogl-samples with MIT License | 6 votes |
private boolean initSampler(GL3 gl3) { FloatBuffer clearColor = GLBuffers.newDirectFloatBuffer(new float[]{0.0f, 0.0f, 0.0f, 0.0f}); gl3.glGenSamplers(1, samplerName); gl3.glSamplerParameteri(samplerName.get(0), GL_TEXTURE_MIN_FILTER, GL_NEAREST); gl3.glSamplerParameteri(samplerName.get(0), GL_TEXTURE_MAG_FILTER, GL_NEAREST); gl3.glSamplerParameteri(samplerName.get(0), GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); gl3.glSamplerParameteri(samplerName.get(0), GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); gl3.glSamplerParameteri(samplerName.get(0), GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE); gl3.glSamplerParameterfv(samplerName.get(0), GL_TEXTURE_BORDER_COLOR, clearColor); gl3.glSamplerParameterf(samplerName.get(0), GL_TEXTURE_MIN_LOD, -1000.f); gl3.glSamplerParameterf(samplerName.get(0), GL_TEXTURE_MAX_LOD, 1000.f); gl3.glSamplerParameterf(samplerName.get(0), GL_TEXTURE_LOD_BIAS, 0.0f); gl3.glSamplerParameteri(samplerName.get(0), GL_TEXTURE_COMPARE_MODE, GL_NONE); gl3.glSamplerParameteri(samplerName.get(0), GL_TEXTURE_COMPARE_FUNC, GL_LEQUAL); return checkError(gl3, "initSampler"); }
Example #15
Source File: Gl_330_blend_rtt.java From jogl-samples with MIT License | 6 votes |
private boolean initBlend(GL3 gl3) { gl3.glBlendEquationSeparate(GL_FUNC_ADD, GL_FUNC_ADD); gl3.glBlendFuncSeparate(GL_ONE, GL_ONE, GL_ONE, GL_ONE); gl3.glEnablei(GL_BLEND, 0); gl3.glEnablei(GL_BLEND, 1); gl3.glEnablei(GL_BLEND, 2); gl3.glEnablei(GL_BLEND, 3); gl3.glColorMaski(0, true, true, true, false); gl3.glColorMaski(1, true, false, false, false); gl3.glColorMaski(2, true, false, false, false); gl3.glColorMaski(3, true, false, false, false); return checkError(gl3, "initBlend"); }
Example #16
Source File: Gl_320_texture_derivative.java From jogl-samples with MIT License | 6 votes |
@Override protected boolean end(GL gl) { GL3 gl3 = (GL3) gl; gl3.glDeleteBuffers(Buffer.MAX, 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 #17
Source File: GPUBarnesHutNBodySimulation.java From gpu-nbody with MIT License | 6 votes |
@Override public void initGLBuffers(final GL3 gl, final int positionVBO, final int velocityVBO) { if (gl != null) { gl.glBindBuffer(GL_ARRAY_BUFFER, positionVBO); positionBuffer = context.createFromGLBuffer(CL_MEM_WRITE_ONLY, positionVBO); gl.glBindBuffer(GL_ARRAY_BUFFER, velocityVBO); velocityBuffer = context.createFromGLBuffer(CL_MEM_WRITE_ONLY, velocityVBO); } else { final int size = nbodies * 4 * Sizeof.cl_float; positionBuffer = context.createEmptyBuffer(CL_MEM_WRITE_ONLY, size); velocityBuffer = context.createEmptyBuffer(CL_MEM_WRITE_ONLY, size); } copyVertices.setArguments( bodiesXBuffer, bodiesYBuffer, bodiesZBuffer, positionBuffer, velXBuffer, velYBuffer, velZBuffer, velocityBuffer); }
Example #18
Source File: Gl_320_fbo.java From jogl-samples with MIT License | 6 votes |
private boolean initVertexArray(GL3 gl3) { gl3.glGenVertexArrays(Program.MAX, vertexArrayName); gl3.glBindVertexArray(vertexArrayName.get(Program.TEXTURE)); { gl3.glBindBuffer(GL_ARRAY_BUFFER, bufferName.get(Buffer.VERTEX)); gl3.glVertexAttribPointer(Semantic.Attr.POSITION, 2, GL_FLOAT, false, Vertex_v2fv2f.SIZE, 0); gl3.glVertexAttribPointer(Semantic.Attr.TEXCOORD, 2, GL_FLOAT, false, Vertex_v2fv2f.SIZE, Vec2.SIZE); gl3.glBindBuffer(GL_ARRAY_BUFFER, 0); gl3.glEnableVertexAttribArray(Semantic.Attr.POSITION); gl3.glEnableVertexAttribArray(Semantic.Attr.TEXCOORD); gl3.glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, bufferName.get(Buffer.ELEMENT)); } gl3.glBindVertexArray(0); gl3.glBindVertexArray(vertexArrayName.get(Program.SPLASH)); gl3.glBindVertexArray(0); return true; }
Example #19
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 #20
Source File: Gl_320_fbo_depth.java From jogl-samples with MIT License | 6 votes |
private boolean initVertexArray(GL3 gl3) { gl3.glGenVertexArrays(Program.MAX, vertexArrayName); gl3.glBindVertexArray(vertexArrayName.get(Program.TEXTURE)); { gl3.glBindBuffer(GL_ARRAY_BUFFER, bufferName.get(Buffer.VERTEX)); gl3.glVertexAttribPointer(Semantic.Attr.POSITION, 2, GL_FLOAT, false, glf.Vertex_v2fv2f.SIZE, 0); gl3.glVertexAttribPointer(Semantic.Attr.TEXCOORD, 2, GL_FLOAT, false, glf.Vertex_v2fv2f.SIZE, Vec2.SIZE); gl3.glBindBuffer(GL_ARRAY_BUFFER, 0); gl3.glEnableVertexAttribArray(Semantic.Attr.POSITION); gl3.glEnableVertexAttribArray(Semantic.Attr.TEXCOORD); gl3.glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, bufferName.get(Buffer.ELEMENT)); } gl3.glBindVertexArray(0); gl3.glBindVertexArray(vertexArrayName.get(Program.SPLASH)); gl3.glBindVertexArray(0); return true; }
Example #21
Source File: Gl_330_texture_integer_rgb10a2ui.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 = initTexture(gl3); } if (validated) { validated = initProgram(gl3); } if (validated) { validated = initBuffer(gl3); } if (validated) { validated = initVertexArray(gl3); } return validated; }
Example #22
Source File: Gl_320_sync.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 = initTexture(gl3); } if (validated) { validated = initProgram(gl3); } if (validated) { validated = initBuffer(gl3); } if (validated) { validated = initVertexArray(gl3); } return validated; }
Example #23
Source File: Gl_320_texture_format.java From jogl-samples with MIT License | 6 votes |
private boolean initVertexArray(GL3 gl3) { gl3.glGenVertexArrays(1, vertexArrayName); gl3.glBindVertexArray(vertexArrayName.get(0)); { gl3.glBindBuffer(GL_ARRAY_BUFFER, bufferName.get(0)); gl3.glVertexAttribPointer(Semantic.Attr.POSITION, 2, GL_FLOAT, false, Vertex_v2fv2f.SIZE, 0); gl3.glVertexAttribPointer(Semantic.Attr.TEXCOORD, 2, GL_FLOAT, false, Vertex_v2fv2f.SIZE, Vec2.SIZE); gl3.glBindBuffer(GL_ARRAY_BUFFER, 0); gl3.glEnableVertexAttribArray(Semantic.Attr.POSITION); gl3.glEnableVertexAttribArray(Semantic.Attr.TEXCOORD); } gl3.glBindVertexArray(0); return checkError(gl3, "initVertexArray"); }
Example #24
Source File: Check_Amd_Extensions.java From jogl-samples with MIT License | 6 votes |
@Override protected boolean begin(GL gl) { GL3 gl3 = (GL3) gl; boolean validated = true; String[] extensions = { "GL_AMD_performance_monitor", "GL_AMD_blend_minmax_factor", "GL_AMD_pinned_memory", "GL_AMD_vertex_shader_viewport_index", "GL_AMD_vertex_shader_layer", "GL_AMD_sample_positions", "GL_AMD_depth_clamp_separate", "GL_AMD_sparse_texture" }; for (String extension : extensions) { System.out.println(extension + ": "+gl3.isExtensionAvailable(extension)); } return validated; }
Example #25
Source File: Gl_330_sampler_anisotropy_ext.java From jogl-samples with MIT License | 6 votes |
private boolean initSampler(GL3 gl3) { gl3.glGenSamplers(Viewport.MAX, samplerName); for (int i = 0; i < Viewport.MAX; ++i) { gl3.glSamplerParameteri(samplerName.get(i), GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); gl3.glSamplerParameteri(samplerName.get(i), GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); gl3.glSamplerParameteri(samplerName.get(i), GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE); gl3.glSamplerParameteri(samplerName.get(i), GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); gl3.glSamplerParameteri(samplerName.get(i), GL_TEXTURE_MAG_FILTER, GL_LINEAR); } gl3.glSamplerParameterf(samplerName.get(Viewport.V00), GL_TEXTURE_MAX_ANISOTROPY_EXT, 1.0f); gl3.glSamplerParameterf(samplerName.get(Viewport.V10), GL_TEXTURE_MAX_ANISOTROPY_EXT, 2.0f); gl3.glSamplerParameterf(samplerName.get(Viewport.V11), GL_TEXTURE_MAX_ANISOTROPY_EXT, 4.0f); gl3.glSamplerParameterf(samplerName.get(Viewport.V01), GL_TEXTURE_MAX_ANISOTROPY_EXT, 16.0f); return checkError(gl3, "initSampler"); }
Example #26
Source File: JCudaDriverSimpleJOGL.java From jcuda-samples with MIT License | 6 votes |
/** * Initialize the shaders and the shader program * * @param gl The GL context */ private void initShaders(GL3 gl) { shaderProgramID = gl.glCreateProgram(); int vertexShaderID = gl.glCreateShader(GL_VERTEX_SHADER); gl.glShaderSource(vertexShaderID, 1, new String[]{vertexShaderSource}, null); gl.glCompileShader(vertexShaderID); gl.glAttachShader(shaderProgramID, vertexShaderID); gl.glDeleteShader(vertexShaderID); int fragmentShaderID = gl.glCreateShader(GL_FRAGMENT_SHADER); gl.glShaderSource(fragmentShaderID, 1, new String[]{fragmentShaderSource}, null); gl.glCompileShader(fragmentShaderID); gl.glAttachShader(shaderProgramID, fragmentShaderID); gl.glDeleteShader(fragmentShaderID); gl.glLinkProgram(shaderProgramID); gl.glValidateProgram(shaderProgramID); }
Example #27
Source File: DwGLFrameBuffer.java From PixelFlow with MIT License | 6 votes |
public void unbind(){ for(int i = 0; i < bind_color_attachments.length; i++){ if(bind_targets == null && gl3 != null) { gl3.glFramebufferTexture(GL3.GL_FRAMEBUFFER, bind_color_attachments[i], 0, 0); } else { if( bind_targets[i] == GL2.GL_TEXTURE_2D_ARRAY || bind_targets[i] == GL2.GL_TEXTURE_3D){ gl.glFramebufferTexture3D(GL2ES2.GL_FRAMEBUFFER, bind_color_attachments[i], bind_targets[i], 0, 0, 0); } else { gl.glFramebufferTexture2D(GL2ES2.GL_FRAMEBUFFER, bind_color_attachments[i], bind_targets[i], 0, 0); } } } bind_color_attachments = new int[0]; unbindFBO(); IS_ACTIVE = false; }
Example #28
Source File: Gl_330_sampler_object.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 = initSampler(gl3); } if (validated) { validated = initVertexArray(gl3); } return validated; }
Example #29
Source File: Gl_330_sampler_wrap.java From jogl-samples with MIT License | 6 votes |
private boolean initVertexArray(GL3 gl3) { gl3.glGenVertexArrays(1, vertexArrayName); gl3.glBindVertexArray(vertexArrayName.get(0)); { gl3.glBindBuffer(GL_ARRAY_BUFFER, bufferName.get(0)); gl3.glVertexAttribPointer(Semantic.Attr.POSITION, 2, GL_FLOAT, false, Vertex_v2fv2f.SIZE, 0); gl3.glVertexAttribPointer(Semantic.Attr.TEXCOORD, 2, GL_FLOAT, false, Vertex_v2fv2f.SIZE, Vec2.SIZE); gl3.glBindBuffer(GL_ARRAY_BUFFER, 0); gl3.glEnableVertexAttribArray(Semantic.Attr.POSITION); gl3.glEnableVertexAttribArray(Semantic.Attr.TEXCOORD); } gl3.glBindVertexArray(0); return checkError(gl3, "initVertexArray"); }
Example #30
Source File: Gl_320_fbo_integer_blit.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(Framebuffer.MAX, framebufferName); gl3.glDeleteVertexArrays(1, vertexArrayName); BufferUtils.destroyDirectBuffer(bufferName); BufferUtils.destroyDirectBuffer(textureName); BufferUtils.destroyDirectBuffer(framebufferName); BufferUtils.destroyDirectBuffer(vertexArrayName); return checkError(gl3, "end"); }