Java Code Examples for org.lwjgl.opengl.GL20#glDetachShader()
The following examples show how to use
org.lwjgl.opengl.GL20#glDetachShader() .
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: ShaderProgram.java From LowPolyWater with The Unlicense | 6 votes |
public ShaderProgram(MyFile vertexFile, MyFile geometryFile, MyFile fragmentFile, String... inVariables) { int vertexShaderID = loadShader(vertexFile, GL20.GL_VERTEX_SHADER); int geometryShaderID = loadShader(geometryFile, GL32.GL_GEOMETRY_SHADER); int fragmentShaderID = loadShader(fragmentFile, GL20.GL_FRAGMENT_SHADER); programID = GL20.glCreateProgram(); GL20.glAttachShader(programID, vertexShaderID); GL20.glAttachShader(programID, geometryShaderID); GL20.glAttachShader(programID, fragmentShaderID); bindAttributes(inVariables); GL20.glLinkProgram(programID); GL20.glDetachShader(programID, vertexShaderID); GL20.glDetachShader(programID, geometryShaderID); GL20.glDetachShader(programID, fragmentShaderID); GL20.glDeleteShader(vertexShaderID); GL20.glDeleteShader(geometryShaderID); GL20.glDeleteShader(fragmentShaderID); }
Example 2
Source File: GLShader.java From ldparteditor with MIT License | 6 votes |
public GLShader(final String vertexPath, final String fragmentPath) { final int vertex = createAndCompile(vertexPath, GL20.GL_VERTEX_SHADER); final int fragment = createAndCompile(fragmentPath, GL20.GL_FRAGMENT_SHADER); program = GL20.glCreateProgram(); GL20.glAttachShader(program, fragment); GL20.glAttachShader(program, vertex); GL20.glLinkProgram(program); // FIXME Extract parameter locations // int baseImageLoc = GL20.glGetUniformLocation(program, "colorMap"); //$NON-NLS-1$ if (GL20.glGetProgrami(program, GL20.GL_LINK_STATUS) == GL11.GL_FALSE) { NLogger.error(GLShader.class, "Could not link shader: " + GL20.glGetProgramInfoLog(program, 1024)); //$NON-NLS-1$; } GL20.glDetachShader(program, fragment); GL20.glDetachShader(program, vertex); GL20.glDeleteShader(fragment); GL20.glDeleteShader(vertex); }
Example 3
Source File: OpenGLRenderer20.java From ldparteditor with MIT License | 6 votes |
@Override public void dispose() { GL20.glUseProgram(0); if (pGlossId != -1) { if (vsGlossId != -1) GL20.glDetachShader(pGlossId, vsGlossId); if (fsGlossId != -1) GL20.glDetachShader(pGlossId, fsGlossId); } if (vsGlossId != -1) GL20.glDeleteShader(vsGlossId); if (fsGlossId != -1) GL20.glDeleteShader(fsGlossId); if (pGlossId != -1) GL20.glDeleteProgram(pGlossId); // Dispose all textures for (Iterator<GTexture> it = textureSet.iterator() ; it.hasNext();) { GTexture tex = it.next(); NLogger.debug(getClass(), "Dispose texture: {0}", tex); //$NON-NLS-1$ tex.dispose(this); it.remove(); } }
Example 4
Source File: ShaderProgram.java From LowPolyWater with The Unlicense | 5 votes |
public ShaderProgram(MyFile vertexFile, MyFile fragmentFile, String... inVariables) { int vertexShaderID = loadShader(vertexFile, GL20.GL_VERTEX_SHADER); int fragmentShaderID = loadShader(fragmentFile, GL20.GL_FRAGMENT_SHADER); programID = GL20.glCreateProgram(); GL20.glAttachShader(programID, vertexShaderID); GL20.glAttachShader(programID, fragmentShaderID); bindAttributes(inVariables); GL20.glLinkProgram(programID); GL20.glDetachShader(programID, vertexShaderID); GL20.glDetachShader(programID, fragmentShaderID); GL20.glDeleteShader(vertexShaderID); GL20.glDeleteShader(fragmentShaderID); }
Example 5
Source File: ShaderProgram.java From OpenGL-Animation with The Unlicense | 5 votes |
public ShaderProgram(MyFile vertexFile, MyFile fragmentFile, String... inVariables) { int vertexShaderID = loadShader(vertexFile, GL20.GL_VERTEX_SHADER); int fragmentShaderID = loadShader(fragmentFile, GL20.GL_FRAGMENT_SHADER); programID = GL20.glCreateProgram(); GL20.glAttachShader(programID, vertexShaderID); GL20.glAttachShader(programID, fragmentShaderID); bindAttributes(inVariables); GL20.glLinkProgram(programID); GL20.glDetachShader(programID, vertexShaderID); GL20.glDetachShader(programID, fragmentShaderID); GL20.glDeleteShader(vertexShaderID); GL20.glDeleteShader(fragmentShaderID); }
Example 6
Source File: OpenGL3_TheQuadTextured.java From ldparteditor with MIT License | 5 votes |
private void destroyOpenGL() { // Delete the texture GL11.glDeleteTextures(texIds[0]); GL11.glDeleteTextures(texIds[1]); // Delete the shaders GL20.glUseProgram(0); GL20.glDetachShader(pId, vsId); GL20.glDetachShader(pId, fsId); GL20.glDeleteShader(vsId); GL20.glDeleteShader(fsId); GL20.glDeleteProgram(pId); // Select the VAO GL30.glBindVertexArray(vaoId); // Disable the VBO index from the VAO attributes list GL20.glDisableVertexAttribArray(0); GL20.glDisableVertexAttribArray(1); // Delete the vertex VBO GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, 0); GL15.glDeleteBuffers(vboId); // Delete the index VBO GL15.glBindBuffer(GL15.GL_ELEMENT_ARRAY_BUFFER, 0); GL15.glDeleteBuffers(vboiId); // Delete the VAO GL30.glBindVertexArray(0); GL30.glDeleteVertexArrays(vaoId); this.exitOnGLError("destroyOpenGL"); Display.destroy(); }
Example 7
Source File: LWJGL20DrawContext.java From settlers-remake with MIT License | 4 votes |
private ShaderProgram(String name) { int vertexShader = -1; int fragmentShader; String vname = name; if(name.contains("-")) vname = name.split("-")[0]; try { vertexShader = createShader(vname+".vert", GL20.GL_VERTEX_SHADER); fragmentShader = createShader(name+".frag", GL20.GL_FRAGMENT_SHADER); } catch (IOException e) { e.printStackTrace(); if(vertexShader != -1) GL20.glDeleteShader(vertexShader); throw new Error("could not read shader files", e); } program = GL20.glCreateProgram(); setObjectLabel(KHRDebug.GL_PROGRAM, program, name); GL20.glAttachShader(program, vertexShader); GL20.glAttachShader(program, fragmentShader); GL20.glBindAttribLocation(program, 0, "vertex"); GL20.glBindAttribLocation(program, 1, "texcoord"); GL20.glBindAttribLocation(program, 2, "color"); GL20.glLinkProgram(program); GL20.glValidateProgram(program); GL20.glDetachShader(program, vertexShader); GL20.glDetachShader(program, fragmentShader); GL20.glDeleteShader(vertexShader); GL20.glDeleteShader(fragmentShader); String log = GL20.glGetProgramInfoLog(program); if(debugOutput != null && !log.isEmpty()) System.out.print("info log of " + name + "=====\n" + log + "==== end\n"); if(GL20.glGetProgrami(program, GL20.GL_LINK_STATUS) == 0) { GL20.glDeleteProgram(program); throw new Error("Could not link " + name); } for(int i = 0;i != ufs.length;i++) { int uf = GL20.glGetUniformLocation(program, uniform_names[i]); ufs[i] = uf; } shaders.add(this); }
Example 8
Source File: ShaderHelper.java From OpenModsLib with MIT License | 4 votes |
@Override public void glDetachShader(int program, int shader) { GL20.glDetachShader(program, shader); }