List of usage examples for org.lwjgl.opengl GL20 glDeleteShader
public static void glDeleteShader(@NativeType("GLuint") int shader)
From source file:ar.com.quark.backend.lwjgl.opengl.DesktopGLES20.java
License:Apache License
/** * {@inheritDoc} */ @Override public void glDeleteShader(int name) { GL20.glDeleteShader(name); }
From source file:br.com.perin.shaders.ShaderProgram.java
public void cleanUp() { stop();/*from w ww .j a v a 2 s. com*/ GL20.glDetachShader(programId, vertexShaderId); GL20.glDetachShader(programId, fragmentShaderId); GL20.glDeleteShader(vertexShaderId); GL20.glDeleteShader(fragmentShaderId); GL20.glDeleteProgram(programId); }
From source file:com.adavr.player.globjects.Shader.java
License:Open Source License
@Override public void destroy() { GL20.glDeleteShader(id); }
From source file:com.auroraengine.opengl.shaders.GLShader.java
License:Open Source License
private void compile() throws GLException { try {/*from w ww. ja v a2 s.co m*/ GL20.glShaderSource(index, code); GLException.checkGL("Sourcing Shader"); GL20.glCompileShader(index); GLException.checkGL("Compiling Shader"); } catch (GLException ex) { GL20.glDeleteShader(index); throw ex; } uniforms.clear(); Matcher m = UNIFORM_PATTERN.matcher(code); while (m.find()) { } }
From source file:com.auroraengine.opengl.shaders.GLShader.java
License:Open Source License
@Override protected void forceDestroy() { if (index != 0) { GL20.glDeleteShader(index); index = 0; } }
From source file:com.badlogic.gdx.backends.jglfw.JglfwGL20.java
License:Apache License
public void glDeleteShader(int shader) { GL20.glDeleteShader(shader); }
From source file:com.flowpowered.caustic.lwjgl.gl20.GL20Shader.java
License:MIT License
@Override public void destroy() { checkCreated();/*from ww w . j av a 2 s.c om*/ // Delete the shader GL20.glDeleteShader(id); // Clear the data type = null; attributeLayouts.clear(); textureLayouts.clear(); // Update the state super.destroy(); // Check for errors LWJGLUtil.checkForGLError(); }
From source file:com.flowpowered.caustic.lwjgl.gl20.GL20Shader.java
License:MIT License
@Override public void setSource(ShaderSource source) { checkCreated();/*ww w. j a v a2 s . c om*/ if (source == null) { throw new IllegalArgumentException("Shader source cannot be null"); } if (!source.isComplete()) { throw new IllegalArgumentException("Shader source isn't complete"); } // If we don't have a previous shader or the type isn't the same, we need to create a new one final ShaderType type = source.getType(); if (id == 0 || this.type != type) { // Delete the old shader GL20.glDeleteShader(id); // Create a shader of the correct type id = GL20.glCreateShader(type.getGLConstant()); // Store the current type this.type = type; } // Upload the new source GL20.glShaderSource(id, source.getSource()); // Set the layouts from the source attributeLayouts.clear(); attributeLayouts.putAll(source.getAttributeLayouts()); textureLayouts.clear(); textureLayouts.putAll(source.getTextureLayouts()); // Check for errors LWJGLUtil.checkForGLError(); }
From source file:com.geekyaubergine.geekyjgameutil.shader.ShaderProgram.java
License:Open Source License
@Override public void unloadResource() { stop();/* www .ja v a 2 s. c om*/ GL20.glDetachShader(programID, vertexShaderID); GL20.glDetachShader(programID, fragmentShaderID); GL20.glDeleteShader(vertexShaderID); GL20.glDeleteShader(fragmentShaderID); GL20.glDeleteProgram(programID); }
From source file:com.github.ryancwilliams.WJ3dPL.graphics.GLUtils.ShaderProgram.java
License:Apache License
/** * Creates a new shader program with the provided vertex and fragment * shader source code.//from w w w .ja v a2 s .c o m * The provided attributes are linked to this program. * @param vertexShaderSource the source code of the vertex shader. * @param fragmentShaderSource the source code of the fragment shader. * @param attributes The Vertex Attributes to bind to this shader program. * @throws LWJGLException If their is a issue compiling the shaders or * creating or binding the program. */ public ShaderProgram(String vertexShaderSource, String fragmentShaderSource, List<VertexAttribute> attributes) throws LWJGLException { //Check if any of the sourcecode paramaters are null if (fragmentShaderSource == null || fragmentShaderSource == null) { //If any of the sourcecode paramaters were null //throw a exception throw new IllegalArgumentException("Shader source may not be null"); } //Check if shaders are not supported if (!ShaderProgram.isSupported()) { //If shaders are not supported //throw a exception throw new LWJGLException("Shaders are not supported on this device"); } //Compile the shaders int vertexShader = ShaderProgram.compileShader(GL20.GL_VERTEX_SHADER, vertexShaderSource); int fragmentShader = ShaderProgram.compileShader(GL20.GL_FRAGMENT_SHADER, fragmentShaderSource); //Create the program this.program = GL20.glCreateProgram(); //Bind the attrib locations //Check if attributes were provided if (attributes != null) { //For each attribute for (VertexAttribute attribute : attributes) { //Check if the attribute is not null if (attribute != null) { //bind the attribute GL20.glBindAttribLocation(this.program, attribute.index, attribute.name); } } } //Attach the shaders GL20.glAttachShader(this.program, vertexShader); GL20.glAttachShader(this.program, fragmentShader); //Link the program GL20.glLinkProgram(this.program); //Get if the program link was good boolean programLink = GL20.glGetProgrami(this.program, GL20.GL_LINK_STATUS) == GL11.GL_TRUE; //Get the log String infoLog = GL20.glGetProgramInfoLog(this.program, GL20.glGetProgrami(this.program, GL20.GL_INFO_LOG_LENGTH)); //Log the log if a log is present if (infoLog != null && infoLog.trim().length() != 0) { Logger.getLogger(ShaderProgram.class.getName()).log(Level.FINEST, infoLog); } //Check if program link is bad if (programLink == false) { throw new LWJGLException("Failure in linking program. Error log:\n" + infoLog); } //detach and delete the shaders which are no longer needed GL20.glDetachShader(this.program, vertexShader); GL20.glDetachShader(this.program, fragmentShader); GL20.glDeleteShader(vertexShader); GL20.glDeleteShader(fragmentShader); }