/** * @param shader * @see com.jogamp.opengl.GL2ES2#glCompileShader(int) */ public void glCompileShader(int shader) { try{delegate.glCompileShader(shader);} catch(GLException e){glException(e); throw e;} } /**
@Override public void glCompileShader(int shader) { GLContext.getCurrentGL().getGL3().glCompileShader(shader); }
public void setSource(String source) { GL3 gl = gpu.getGl(); gl.glShaderSource(shaderID, 1, new String[] { source }, (IntBuffer) null); gl.glCompileShader(shaderID); printStatusInfo(gl, shaderID); }// end setSource
public GLShader(final GL pGL, final Class<?> pRootClass, final String pResourceName, final GLShaderType pShaderType) throws IOException { super(); mGL = pGL; final InputStream lResourceAsStream = pRootClass.getResourceAsStream(pResourceName); mShaderSource = new Scanner(lResourceAsStream, "UTF-8").useDelimiter("\\A").next(); mShaderType = pShaderType; mShaderSourcePath = pResourceName; mShaderSourceRootClass = pRootClass; mParameters = new HashMap<>(); Path p = getPath(pRootClass.getResource(pResourceName)); mShaderBasePath = p.getParent(); // preprocess shader final String shaderSourceProcessed = preprocessShader(mShaderSource); mShaderId = pGL.getGL3().glCreateShader(glShaderTypeMapping.get(pShaderType)); mGL.getGL3().glShaderSource(mShaderId, 1, new String[]{shaderSourceProcessed}, null); mGL.getGL3().glCompileShader(mShaderId); }
public GLShader(final GL pGL, final Class<?> pRootClass, final String pResourceName, final GLShaderType pShaderType, final HashMap<String, String> params) throws IOException { super(); mGL = pGL; final InputStream lResourceAsStream = pRootClass.getResourceAsStream(pResourceName); mShaderSource = new Scanner(lResourceAsStream, "UTF-8").useDelimiter("\\A").next(); mShaderType = pShaderType; mShaderSourcePath = pResourceName; mShaderSourceRootClass = pRootClass; mParameters = params; Path p = getPath(pRootClass.getResource(pResourceName)); mShaderBasePath = p.getParent(); // preprocess shader final String shaderSourceProcessed = preprocessShader(mShaderSource); mShaderId = pGL.getGL3().glCreateShader(glShaderTypeMapping.get(pShaderType)); mGL.getGL3().glShaderSource(mShaderId, 1, new String[]{shaderSourceProcessed}, null); mGL.getGL3().glCompileShader(mShaderId); }
g.glCompileShader(vs); g.glGetShaderiv(vs, GL2ES2.GL_COMPILE_STATUS, status);
fragment_lines, fragment_lengths); g.glCompileShader(fs); g.glGetShaderiv(fs, GL2ES2.GL_COMPILE_STATUS, status);
public GLShader(final GL pGL, final String pShaderSourceAsString, final GLShaderType pShaderType) throws IOException { super(); mGL = pGL; mShaderSource = pShaderSourceAsString; mShaderType = pShaderType; mShaderSourceRootClass = null; mShaderSourcePath = null; mParameters = new HashMap<>(); mShaderBasePath = null; // preprocess shader final String shaderSourceProcessed = preprocessShader(mShaderSource); mShaderId = pGL.getGL3().glCreateShader(glShaderTypeMapping.get(pShaderType)); mGL.getGL3().glShaderSource(mShaderId, 1, new String[]{shaderSourceProcessed}, null); mGL.getGL3().glCompileShader(mShaderId); }
public void recompile(final GL pGL) { close(); // preprocess shader final String shaderSourceProcessed = preprocessShader(mShaderSource); mShaderId = pGL.getGL3().glCreateShader(glShaderTypeMapping.get(mShaderType)); mGL.getGL3().glShaderSource(mShaderId, 1, new String[]{shaderSourceProcessed}, null); mGL.getGL3().glCompileShader(mShaderId); }
/** * Implementation for {@link #createGlShader(int, String)}. * * @param shaderType The shader type * @param shaderSource The shader source code * @return The GL shader, or <code>null</code> if it cannot be compiled */ private Integer createGlShaderImpl(int shaderType, String shaderSource) { int glShader = gl.glCreateShader(shaderType); gl.glShaderSource( glShader, 1, new String[]{shaderSource}, null); gl.glCompileShader(glShader); int compileStatus[] = { 0 }; gl.glGetShaderiv(glShader, GL_COMPILE_STATUS, compileStatus, 0); if (compileStatus[0] != GL_TRUE) { printShaderLogInfo(glShader); return null; } return glShader; }
/** * Creates a new shader object. * @param gl gl object * @param code shader code * @param type shader type */ private Shader(final GL3 gl, final String code, final Type type) { this.gl = gl; this.shaderHandle = gl.glCreateShader(type.getGlShaderType()); this.code = code; this.type = type; gl.glShaderSource(this.shaderHandle, 1, new String[]{this.code}, (int[]) null, 0); gl.glCompileShader(this.shaderHandle); String info = getShaderInfoLog(gl, this.shaderHandle); if (!isShaderValid(gl, this.shaderHandle)) { gl.glDeleteShader(this.shaderHandle); this.shaderHandle = 0; throw new RuntimeException(info); } }