/** * Retrieves the location of the shader uniform from the linked shader program. * <p> * No validation is performed within the implementation. * </p> * @param gl * @param program * @return ≥0 denotes a valid uniform location as found and used in the given shader program. * <0 denotes an invalid location, i.e. not found or used in the given shader program. */ public int setLocation(final GL2ES2 gl, final int program) { location = gl.glGetUniformLocation(program, name); return location; }
public DncIconProgramHandles( GL2ES2 gl ) { this.program = createProgram( gl, dncIconVertShader_GLSL, dncIconGeomShader_GLSL, dncIconFragShader_GLSL ); this.AXIS_RECT = gl.glGetUniformLocation( program, "AXIS_RECT" ); this.VIEWPORT_SIZE_PX = gl.glGetUniformLocation( program, "VIEWPORT_SIZE_PX" ); this.ATLAS = gl.glGetUniformLocation( program, "ATLAS" ); this.IMAGE_BOUNDS = gl.glGetUniformLocation( program, "IMAGE_BOUNDS" ); this.IMAGE_SIZE_PX = gl.glGetUniformLocation( program, "IMAGE_SIZE_PX" ); this.IMAGE_ALIGN = gl.glGetUniformLocation( program, "IMAGE_ALIGN" ); this.HIGHLIGHT_SET = gl.glGetUniformLocation( program, "HIGHLIGHT_SET" ); this.HIGHLIGHT_SCALE = gl.glGetUniformLocation( program, "HIGHLIGHT_SCALE" ); this.inIconVertex = gl.glGetAttribLocation( program, "inIconVertex" ); } }
public DncLineProgramHandles( GL2ES2 gl ) { this.program = createProgram( gl, dncLineVertShader_GLSL, dncLineGeomShader_GLSL, dncLineFragShader_GLSL ); this.AXIS_RECT = gl.glGetUniformLocation( program, "AXIS_RECT" ); this.VIEWPORT_SIZE_PX = gl.glGetUniformLocation( program, "VIEWPORT_SIZE_PX" ); this.RGBA = gl.glGetUniformLocation( program, "RGBA" ); this.STIPPLE_ENABLE = gl.glGetUniformLocation( program, "STIPPLE_ENABLE" ); this.STIPPLE_FACTOR = gl.glGetUniformLocation( program, "STIPPLE_FACTOR" ); this.STIPPLE_PATTERN = gl.glGetUniformLocation( program, "STIPPLE_PATTERN" ); this.LINE_THICKNESS_PX = gl.glGetUniformLocation( program, "LINE_THICKNESS_PX" ); this.FEATHER_THICKNESS_PX = gl.glGetUniformLocation( program, "FEATHER_THICKNESS_PX" ); this.HIGHLIGHT_SET = gl.glGetUniformLocation( program, "HIGHLIGHT_SET" ); this.HIGHLIGHT_EXTRA_THICKNESS_PX = gl.glGetUniformLocation( program, "HIGHLIGHT_EXTRA_THICKNESS_PX" ); this.inLineVertex = gl.glGetAttribLocation( program, "inLineVertex" ); } }
public DncAreaProgramHandles( GL2ES2 gl ) { this.program = createProgram( gl, dncAreaVertShader_GLSL, null, dncAreaFragShader_GLSL ); this.AXIS_RECT = gl.glGetUniformLocation( program, "AXIS_RECT" ); this.RGBA = gl.glGetUniformLocation( program, "RGBA" ); this.HIGHLIGHT_SET = gl.glGetUniformLocation( program, "HIGHLIGHT_SET" ); this.inAreaVertex = gl.glGetAttribLocation( program, "inAreaVertex" ); } }
public DncLabelProgramHandles( GL2ES2 gl ) { this.program = createProgram( gl, dncLabelVertShader_GLSL, dncLabelGeomShader_GLSL, dncLabelFragShader_GLSL ); this.AXIS_RECT = gl.glGetUniformLocation( program, "AXIS_RECT" ); this.VIEWPORT_SIZE_PX = gl.glGetUniformLocation( program, "VIEWPORT_SIZE_PX" ); this.ATLAS = gl.glGetUniformLocation( program, "ATLAS" ); this.ATLAS_SIZE_PX = gl.glGetUniformLocation( program, "ATLAS_SIZE_PX" ); this.HIGHLIGHT_SET = gl.glGetUniformLocation( program, "HIGHLIGHT_SET" ); this.HIGHLIGHT_SCALE = gl.glGetUniformLocation( program, "HIGHLIGHT_SCALE" ); this.inLabelVertex = gl.glGetAttribLocation( program, "inLabelVertex" ); this.inImageAlign = gl.glGetAttribLocation( program, "inImageAlign" ); this.inImageBounds = gl.glGetAttribLocation( program, "inImageBounds" ); } }
public CursorLabelProgramHandles( GL2ES2 gl ) { this.program = createProgram( gl, cursorLabelVertShader_GLSL, null, cursorLabelFragShader_GLSL ); this.VIEWPORT_SIZE_PX = gl.glGetUniformLocation( program, "VIEWPORT_SIZE_PX" ); this.IMAGE = gl.glGetUniformLocation( program, "IMAGE" ); this.inSt = gl.glGetAttribLocation( program, "inSt" ); this.inXy = gl.glGetAttribLocation( program, "inXy" ); } }
/** * Update variableID for uniform shadervariable if needed. * * @param variable * shadervaribale to update ID on * @param programID * shader program context ID */ public static void updateUniformLocation(final ShaderVariable variable, final int programID) { final GL gl = GLContext.getCurrentGL(); if (variable.variableID == -1) { variable.variableID = gl.getGL2ES2().glGetUniformLocation(programID, variable.name); // TODO Check // variable.name if (variable.variableID == -1 && !variable.errorLogged) { logger.severe("Shader uniform [" + variable.name + "] could not be located in shader"); variable.errorLogged = true; } } }
if(0>location) { if(!shaderProgram.linked()) throw new GLException("Program is not linked"); location = gl.glGetUniformLocation(shaderProgram.program(), name); if(0<=location) { activeUniformLocationMap.put(name, Integer.valueOf(location));