本文整理汇总了Java中com.jogamp.opengl.GL4.glGetUniformLocation方法的典型用法代码示例。如果您正苦于以下问题:Java GL4.glGetUniformLocation方法的具体用法?Java GL4.glGetUniformLocation怎么用?Java GL4.glGetUniformLocation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.jogamp.opengl.GL4
的用法示例。
在下文中一共展示了GL4.glGetUniformLocation方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: Program
import com.jogamp.opengl.GL4; //导入方法依赖的package包/类
public Program(GL4 gl4) {
super(gl4, Application.SHADERS_ROOT, SHADERS_SRC);
matrixUL = gl4.glGetUniformLocation(name, "matrix");
gl4.glUseProgram(name);
gl4.glUniform1i(
gl4.glGetUniformLocation(name, "myTexture"),
Semantic.Sampler.MY_TEXTURE);
gl4.glUseProgram(0);
}
示例2: Program
import com.jogamp.opengl.GL4; //导入方法依赖的package包/类
public Program(GL4 gl4) {
super(gl4, Application.SHADERS_ROOT, SHADERS_SRC);
matrixUL = gl4.glGetUniformLocation(name, "matrix");
gl4.glUseProgram(name);
gl4.glUniform1i(
gl4.glGetUniformLocation(name, "diffuse"),
Semantic.Sampler.DIFFUSE);
gl4.glUseProgram(0);
}
示例3: initProgram
import com.jogamp.opengl.GL4; //导入方法依赖的package包/类
private boolean initProgram(GL4 gl4) {
boolean validated = true;
// Create program
if (validated) {
ShaderProgram shaderProgram = new ShaderProgram();
ShaderCode vertShaderCode = ShaderCode.create(gl4, GL_VERTEX_SHADER, this.getClass(), SHADERS_ROOT, null,
SHADERS_SOURCE, "vert", null, true);
ShaderCode fragShaderCode = ShaderCode.create(gl4, GL_FRAGMENT_SHADER, this.getClass(), SHADERS_ROOT, null,
SHADERS_SOURCE, "frag", null, true);
shaderProgram.init(gl4);
shaderProgram.add(vertShaderCode);
shaderProgram.add(fragShaderCode);
programName = shaderProgram.program();
shaderProgram.link(gl4, System.out);
}
// Get variables locations
if (validated) {
uniformMvp = gl4.glGetUniformLocation(programName, "mvp");
uniformDXT1 = gl4.glGetUniformLocation(programName, "diffuseDXT1");
uniformRGB8 = gl4.glGetUniformLocation(programName, "diffuseRGB8");
uniformDisplacement = gl4.glGetUniformLocation(programName, "displacement");
subroutineId.put(Subroutine.DXT1, gl4.glGetSubroutineIndex(programName, GL_FRAGMENT_SHADER, "diffuseLQ"));
subroutineId.put(Subroutine.RGB8, gl4.glGetSubroutineIndex(programName, GL_FRAGMENT_SHADER, "diffuseHQ"));
}
return validated & checkError(gl4, "initProgram");
}
示例4: initProgram
import com.jogamp.opengl.GL4; //导入方法依赖的package包/类
private boolean initProgram(GL4 gl4) {
boolean validated = true;
if (validated) {
ShaderProgram shaderProgram = new ShaderProgram();
ShaderCode vertShaderCode = ShaderCode.create(gl4, GL_VERTEX_SHADER, this.getClass(), SHADERS_ROOT,
null, SHADERS_SOURCE, "vert", null, true);
ShaderCode contShaderCode = ShaderCode.create(gl4, GL_TESS_CONTROL_SHADER, this.getClass(), SHADERS_ROOT,
null, SHADERS_SOURCE, "cont", null, true);
ShaderCode evalShaderCode = ShaderCode.create(gl4, GL_TESS_EVALUATION_SHADER, this.getClass(), SHADERS_ROOT,
null, SHADERS_SOURCE, "eval", null, true);
ShaderCode geomShaderCode = ShaderCode.create(gl4, GL_GEOMETRY_SHADER, this.getClass(), SHADERS_ROOT,
null, SHADERS_SOURCE, "geom", null, true);
ShaderCode fragShaderCode = ShaderCode.create(gl4, GL_FRAGMENT_SHADER, this.getClass(), SHADERS_ROOT,
null, SHADERS_SOURCE, "frag", null, true);
shaderProgram.init(gl4);
shaderProgram.add(vertShaderCode);
shaderProgram.add(geomShaderCode);
shaderProgram.add(contShaderCode);
shaderProgram.add(evalShaderCode);
shaderProgram.add(fragShaderCode);
programName = shaderProgram.program();
shaderProgram.link(gl4, System.out);
}
if (validated) {
uniformMvp = gl4.glGetUniformLocation(programName, "mvp");
}
return validated & checkError(gl4, "initProgram");
}
示例5: initProgram
import com.jogamp.opengl.GL4; //导入方法依赖的package包/类
private boolean initProgram(GL4 gl4) {
boolean validated = true;
// Create program
if (validated) {
ShaderProgram program = new ShaderProgram();
ShaderCode vertShaderCode = ShaderCode.create(gl4, GL_VERTEX_SHADER, this.getClass(), SHADERS_ROOT, null,
VERT_SHADER_SOURCE, "vert", null, true);
ShaderCode fragShaderCode1 = ShaderCode.create(gl4, GL_FRAGMENT_SHADER, this.getClass(), SHADERS_ROOT, null,
FRAG_SHADER_SOURCE1, "frag", null, true);
ShaderCode fragShaderCode2 = ShaderCode.create(gl4, GL_FRAGMENT_SHADER, this.getClass(), SHADERS_ROOT, null,
FRAG_SHADER_SOURCE2, "frag", null, true);
program.init(gl4);
programName = program.program();
program.add(vertShaderCode);
program.add(fragShaderCode1);
program.add(fragShaderCode2);
gl4.glBindAttribLocation(programName, Semantic.Attr.POSITION, "position");
gl4.glBindAttribLocation(programName, Semantic.Attr.TEXCOORD, "texCoord");
gl4.glBindFragDataLocation(programName, Semantic.Frag.COLOR, "color");
program.link(gl4, System.out);
}
// Get variables locations
if (validated) {
uniformTransform = gl4.glGetUniformBlockIndex(programName, "Transform");
uniformDiffuse = gl4.glGetUniformLocation(programName, "diffuse");
}
return validated & checkError(gl4, "initProgram");
}
示例6: initProgram
import com.jogamp.opengl.GL4; //导入方法依赖的package包/类
private boolean initProgram(GL4 gl4) {
boolean validated = true;
// Create program
if (validated) {
ShaderProgram shaderProgram = new ShaderProgram();
ShaderCode vertShaderCode = ShaderCode.create(gl4, GL_VERTEX_SHADER, this.getClass(), SHADERS_ROOT, null,
SHADERS_SOURCE, "vert", null, true);
ShaderCode fragShaderCode = ShaderCode.create(gl4, GL_FRAGMENT_SHADER, this.getClass(), SHADERS_ROOT, null,
SHADERS_SOURCE, "frag", null, true);
shaderProgram.init(gl4);
programName = shaderProgram.program();
shaderProgram.add(vertShaderCode);
shaderProgram.add(fragShaderCode);
shaderProgram.link(gl4, System.out);
}
if (validated) {
uniformMvp = gl4.glGetUniformLocation(programName, "mvp");
uniformDiffuse = gl4.glGetUniformLocation(programName, "diffuse");
}
return validated & checkError(gl4, "initProgram");
}
示例7: initProgram
import com.jogamp.opengl.GL4; //导入方法依赖的package包/类
private boolean initProgram(GL4 gl4) {
boolean validated = true;
// Create program
if (validated) {
ShaderProgram shaderProgram = new ShaderProgram();
ShaderCode vertexShaderCode = ShaderCode.create(gl4, GL_VERTEX_SHADER, this.getClass(),
SHADERS_ROOT, null, SHADERS_SOURCE, "vert", null, true);
ShaderCode controlShaderCode = ShaderCode.create(gl4, GL_TESS_CONTROL_SHADER, this.getClass(),
SHADERS_ROOT, null, SHADERS_SOURCE, "cont", null, true);
ShaderCode evaluationShaderCode = ShaderCode.create(gl4, GL_TESS_EVALUATION_SHADER, this.getClass(),
SHADERS_ROOT, null, SHADERS_SOURCE, "eval", null, true);
ShaderCode geometryShaderCode = ShaderCode.create(gl4, GL_GEOMETRY_SHADER, this.getClass(),
SHADERS_ROOT, null, SHADERS_SOURCE, "geom", null, true);
ShaderCode fragmentShaderCode = ShaderCode.create(gl4, GL_FRAGMENT_SHADER, this.getClass(),
SHADERS_ROOT, null, SHADERS_SOURCE, "frag", null, true);
shaderProgram.init(gl4);
shaderProgram.add(vertexShaderCode);
shaderProgram.add(controlShaderCode);
shaderProgram.add(evaluationShaderCode);
shaderProgram.add(geometryShaderCode);
shaderProgram.add(fragmentShaderCode);
programName = shaderProgram.program();
shaderProgram.link(gl4, System.out);
}
// Get variables locations
if (validated) {
uniformMvp = gl4.glGetUniformLocation(programName, "mvp");
}
return validated & checkError(gl4, "initProgram");
}
示例8: initSeparateProgram
import com.jogamp.opengl.GL4; //导入方法依赖的package包/类
private boolean initSeparateProgram(GL4 gl4) {
boolean validated = true;
try {
if (validated) {
String[] vertexSourceContent = new String[]{new Scanner(new File(SHADERS_ROOT + "/" + SHADERS_SOURCE
+ ".vert")).useDelimiter("\\A").next()};
separateProgramName[Program.VERTEX] = gl4.glCreateShaderProgramv(GL_VERTEX_SHADER, 1, vertexSourceContent);
}
if (validated) {
String[] fragmentSourceContent = new String[]{new Scanner(new File(SHADERS_ROOT + "/" + SHADERS_SOURCE
+ ".frag")).useDelimiter("\\A").next()};
separateProgramName[Program.FRAGMENT] = gl4.glCreateShaderProgramv(GL_FRAGMENT_SHADER, 1, fragmentSourceContent);
}
if (validated) {
validated = validated
&& framework.Compiler.checkProgram(gl4, separateProgramName[Program.VERTEX]);
validated = validated
&& framework.Compiler.checkProgram(gl4, separateProgramName[Program.FRAGMENT]);
}
if (validated) {
gl4.glGenProgramPipelines(1, pipelineName);
gl4.glUseProgramStages(pipelineName.get(0), GL_VERTEX_SHADER_BIT, separateProgramName[Program.VERTEX]);
gl4.glUseProgramStages(pipelineName.get(0), GL_FRAGMENT_SHADER_BIT, separateProgramName[Program.FRAGMENT]);
}
if (validated) {
separateUniformMvp = gl4.glGetUniformLocation(separateProgramName[Program.VERTEX], "mvp");
separateUniformDiffuse = gl4.glGetUniformLocation(separateProgramName[Program.FRAGMENT], "diffuse");
}
} catch (FileNotFoundException ex) {
Logger.getLogger(Gl_410_program_64.class.getName()).log(Level.SEVERE, null, ex);
}
return validated && checkError(gl4, "initProgram");
}
示例9: initProgram
import com.jogamp.opengl.GL4; //导入方法依赖的package包/类
private boolean initProgram(GL4 gl4) {
boolean validated = true;
gl4.glGenProgramPipelines(1, pipelineName);
gl4.glBindProgramPipeline(pipelineName.get(0));
gl4.glBindProgramPipeline(0);
// Create program
if (validated) {
ShaderProgram[] shaderPrograms = new ShaderProgram[Program.MAX];
ShaderCode[] shaderCodes = new ShaderCode[]{
ShaderCode.create(gl4, GL_VERTEX_SHADER, this.getClass(), SHADERS_ROOT, null, SHADERS_SOURCE,
"vert", null, true),
ShaderCode.create(gl4, GL_TESS_CONTROL_SHADER, this.getClass(), SHADERS_ROOT, null, SHADERS_SOURCE,
"cont", null, true),
ShaderCode.create(gl4, GL_TESS_EVALUATION_SHADER, this.getClass(), SHADERS_ROOT, null, SHADERS_SOURCE,
"eval", null, true),
ShaderCode.create(gl4, GL_GEOMETRY_SHADER, this.getClass(), SHADERS_ROOT, null, SHADERS_SOURCE,
"geom", null, true),
ShaderCode.create(gl4, GL_FRAGMENT_SHADER, this.getClass(), SHADERS_ROOT, null, SHADERS_SOURCE,
"frag", null, true)};
for (int i = 0; i < Program.MAX; i++) {
shaderPrograms[i] = new ShaderProgram();
shaderPrograms[i].init(gl4);
shaderPrograms[i].add(shaderCodes[i]);
programName[i] = shaderPrograms[i].program();
gl4.glProgramParameteri(programName[i], GL_PROGRAM_SEPARABLE, GL_TRUE);
shaderPrograms[i].link(gl4, System.out);
}
}
if (validated) {
gl4.glUseProgramStages(pipelineName.get(0), GL_VERTEX_SHADER_BIT, programName[Program.VERT]);
gl4.glUseProgramStages(pipelineName.get(0), GL_TESS_CONTROL_SHADER_BIT, programName[Program.CONT]);
gl4.glUseProgramStages(pipelineName.get(0), GL_TESS_EVALUATION_SHADER_BIT, programName[Program.EVAL]);
gl4.glUseProgramStages(pipelineName.get(0), GL_GEOMETRY_SHADER_BIT, programName[Program.GEOM]);
gl4.glUseProgramStages(pipelineName.get(0), GL_FRAGMENT_SHADER_BIT, programName[Program.FRAG]);
}
// Get variables locations
if (validated) {
uniformMvp = gl4.glGetUniformLocation(programName[Program.VERT], "mvp");
}
return validated & checkError(gl4, "initProgram");
}
示例10: initProgram
import com.jogamp.opengl.GL4; //导入方法依赖的package包/类
private boolean initProgram(GL4 gl4) {
boolean validated = true;
gl4.glGenProgramPipelines(1, pipelineName);
// Create program
if (validated) {
ShaderProgram vertProgram = new ShaderProgram();
ShaderProgram fragProgram = new ShaderProgram();
ShaderCode vertexShaderCode = ShaderCode.create(gl4, GL_VERTEX_SHADER, this.getClass(), SHADERS_ROOT,
null, SHADERS_SOURCE, "vert", null, true);
ShaderCode geometryShaderCode = ShaderCode.create(gl4, GL_GEOMETRY_SHADER, this.getClass(), SHADERS_ROOT,
null, SHADERS_SOURCE, "geom", null, true);
ShaderCode fragmentShaderCode = ShaderCode.create(gl4, GL_FRAGMENT_SHADER, this.getClass(), SHADERS_ROOT,
null, SHADERS_SOURCE, "frag", null, true);
vertProgram.init(gl4);
fragProgram.init(gl4);
vertProgram.add(vertexShaderCode);
vertProgram.add(geometryShaderCode);
fragProgram.add(fragmentShaderCode);
programName[Program.VERT] = vertProgram.program();
programName[Program.FRAG] = fragProgram.program();
gl4.glProgramParameteri(programName[Program.VERT], GL_PROGRAM_SEPARABLE, GL_TRUE);
gl4.glProgramParameteri(programName[Program.FRAG], GL_PROGRAM_SEPARABLE, GL_TRUE);
vertProgram.link(gl4, System.out);
fragProgram.link(gl4, System.out);
}
if (validated) {
gl4.glUseProgramStages(pipelineName.get(0), GL_VERTEX_SHADER_BIT | GL_GEOMETRY_SHADER_BIT,
programName[Program.VERT]);
gl4.glUseProgramStages(pipelineName.get(0), GL_FRAGMENT_SHADER_BIT, programName[Program.FRAG]);
}
// Get variables locations
if (validated) {
uniformMvp = gl4.glGetUniformLocation(programName[Program.VERT], "mvp");
uniformDiffuse = gl4.glGetUniformLocation(programName[Program.FRAG], "diffuse");
}
return validated & checkError(gl4, "initProgram");
}
示例11: initProgram
import com.jogamp.opengl.GL4; //导入方法依赖的package包/类
private boolean initProgram(GL4 gl4) {
boolean validated = true;
// Create program
if (validated) {
ShaderProgram vertProgram = new ShaderProgram();
ShaderProgram fragProgram = new ShaderProgram();
ShaderCode vertShaderCode = ShaderCode.create(gl4, GL_VERTEX_SHADER, this.getClass(), SHADERS_ROOT,
null, SHADERS_SOURCE, "vert", null, true);
ShaderCode contShaderCode = ShaderCode.create(gl4, GL_TESS_CONTROL_SHADER, this.getClass(), SHADERS_ROOT,
null, SHADERS_SOURCE, "cont", null, true);
ShaderCode evalShaderCode = ShaderCode.create(gl4, GL_TESS_EVALUATION_SHADER, this.getClass(), SHADERS_ROOT,
null, SHADERS_SOURCE, "eval", null, true);
ShaderCode geomShaderCode = ShaderCode.create(gl4, GL_GEOMETRY_SHADER, this.getClass(), SHADERS_ROOT,
null, SHADERS_SOURCE, "geom", null, true);
ShaderCode fragShaderCode = ShaderCode.create(gl4, GL_FRAGMENT_SHADER, this.getClass(), SHADERS_ROOT,
null, SHADERS_SOURCE, "frag", null, true);
vertProgram.init(gl4);
fragProgram.init(gl4);
vertProgram.add(vertShaderCode);
vertProgram.add(contShaderCode);
vertProgram.add(evalShaderCode);
vertProgram.add(geomShaderCode);
fragProgram.add(fragShaderCode);
programName[Program.VERT] = vertProgram.program();
programName[Program.FRAG] = fragProgram.program();
gl4.glProgramParameteri(programName[Program.VERT], GL_PROGRAM_SEPARABLE, GL_TRUE);
gl4.glProgramParameteri(programName[Program.FRAG], GL_PROGRAM_SEPARABLE, GL_TRUE);
vertProgram.link(gl4, System.out);
fragProgram.link(gl4, System.out);
}
if (validated) {
uniformMvp = gl4.glGetUniformLocation(programName[Program.VERT], "mvp");
validated = validated && (uniformMvp != -1);
}
// Get variables locations
if (validated) {
gl4.glGenProgramPipelines(1, pipelineName);
gl4.glUseProgramStages(pipelineName.get(0), GL_VERTEX_SHADER_BIT | GL_TESS_CONTROL_SHADER_BIT
| GL_TESS_EVALUATION_SHADER_BIT | GL_GEOMETRY_SHADER_BIT, programName[Program.VERT]);
gl4.glUseProgramStages(pipelineName.get(0), GL_FRAGMENT_SHADER_BIT, programName[Program.FRAG]);
}
return validated & checkError(gl4, "initProgram");
}
示例12: initProgram
import com.jogamp.opengl.GL4; //导入方法依赖的package包/类
private boolean initProgram(GL4 gl4) {
boolean validated = true;
try {
if (validated) {
String[] vertexSourceContent = new String[]{new Scanner(new File(SHADERS_ROOT + "/" + SHADERS_SOURCE
+ ".vert")).useDelimiter("\\A").next()};
programName[Program.VERT] = gl4.glCreateShaderProgramv(GL_VERTEX_SHADER, 1, vertexSourceContent);
}
if (validated) {
String[] fragmentSourceContent = new String[]{new Scanner(new File(SHADERS_ROOT + "/" + SHADERS_SOURCE
+ ".frag")).useDelimiter("\\A").next()};
programName[Program.FRAG] = gl4.glCreateShaderProgramv(GL_FRAGMENT_SHADER, 1, fragmentSourceContent);
}
if (validated) {
validated = validated && framework.Compiler.checkProgram(gl4, programName[Program.VERT]);
validated = validated && framework.Compiler.checkProgram(gl4, programName[Program.FRAG]);
}
if (validated) {
uniformMvp = gl4.glGetUniformLocation(programName[Program.VERT], "mvp");
uniformDiffuse = gl4.glGetUniformLocation(programName[Program.FRAG], "diffuse");
}
if (validated) {
gl4.glGenProgramPipelines(1, pipelineName);
gl4.glBindProgramPipeline(pipelineName.get(0));
gl4.glUseProgramStages(pipelineName.get(0), GL_VERTEX_SHADER_BIT, programName[Program.VERT]);
gl4.glUseProgramStages(pipelineName.get(0), GL_FRAGMENT_SHADER_BIT, programName[Program.FRAG]);
}
} catch (FileNotFoundException ex) {
Logger.getLogger(Gl_410_program_64.class.getName()).log(Level.SEVERE, null, ex);
}
return validated && checkError(gl4, "initProgram");
}
示例13: initProgram
import com.jogamp.opengl.GL4; //导入方法依赖的package包/类
private boolean initProgram(GL4 gl4) {
boolean validated = true;
gl4.glGenProgramPipelines(1, pipelineName);
programName[Program.VERT] = gl4.glCreateProgram();
gl4.glProgramParameteri(programName[Program.VERT], GL_PROGRAM_SEPARABLE, GL_TRUE);
gl4.glProgramParameteri(programName[Program.VERT], GL_PROGRAM_BINARY_RETRIEVABLE_HINT, GL_TRUE);
programName[Program.GEOM] = gl4.glCreateProgram();
gl4.glProgramParameteri(programName[Program.GEOM], GL_PROGRAM_SEPARABLE, GL_TRUE);
gl4.glProgramParameteri(programName[Program.GEOM], GL_PROGRAM_BINARY_RETRIEVABLE_HINT, GL_TRUE);
programName[Program.FRAG] = gl4.glCreateProgram();
gl4.glProgramParameteri(programName[Program.FRAG], GL_PROGRAM_SEPARABLE, GL_TRUE);
gl4.glProgramParameteri(programName[Program.FRAG], GL_PROGRAM_BINARY_RETRIEVABLE_HINT, GL_TRUE);
int[] numProgramBinaryFormats = {0};
gl4.glGetIntegerv(GL_NUM_PROGRAM_BINARY_FORMATS, numProgramBinaryFormats, 0);
int[] programBinaryFormats = new int[numProgramBinaryFormats[0]];
gl4.glGetIntegerv(GL_PROGRAM_BINARY_FORMATS, programBinaryFormats, 0);
validated = validated && numProgramBinaryFormats[0] > 0;
try {
validated = validated && loadShader(gl4, GL_VERTEX_SHADER);
validated = validated && loadShader(gl4, GL_GEOMETRY_SHADER);
validated = validated && loadShader(gl4, GL_FRAGMENT_SHADER);
// validated = validated && loadVertexShader(gl4);
//
// validated = validated && loadGeometryShader(gl4);
//
// validated = validated && loadFragmentShader(gl4);
} catch (IOException ex) {
Logger.getLogger(Gl_410_program_binary.class.getName()).log(Level.SEVERE, null, ex);
}
if (validated) {
gl4.glUseProgramStages(pipelineName.get(0), GL_VERTEX_SHADER_BIT, programName[Program.VERT]);
gl4.glUseProgramStages(pipelineName.get(0), GL_GEOMETRY_SHADER_BIT, programName[Program.GEOM]);
gl4.glUseProgramStages(pipelineName.get(0), GL_FRAGMENT_SHADER_BIT, programName[Program.FRAG]);
validated = validated && checkError(gl4, "initProgram - stage");
}
if (validated) {
uniformMvp = gl4.glGetUniformLocation(programName[Program.VERT], "mvp");
uniformDiffuse = gl4.glGetUniformLocation(programName[Program.FRAG], "diffuse");
}
return validated && checkError(gl4, "initProgram");
}
示例14: initUnifiedProgram
import com.jogamp.opengl.GL4; //导入方法依赖的package包/类
private boolean initUnifiedProgram(GL4 gl4) {
boolean validated = true;
// Create program
if (validated) {
ShaderProgram shaderProgram = new ShaderProgram();
ShaderCode vertShaderCode = ShaderCode.create(gl4, GL_VERTEX_SHADER, this.getClass(), SHADERS_ROOT, null,
SHADERS_SOURCE, "vert", null, true);
ShaderCode fragShaderCode = ShaderCode.create(gl4, GL_FRAGMENT_SHADER, this.getClass(), SHADERS_ROOT, null,
SHADERS_SOURCE, "frag", null, true);
shaderProgram.init(gl4);
shaderProgram.add(vertShaderCode);
shaderProgram.add(fragShaderCode);
unifiedProgramName = shaderProgram.program();
shaderProgram.link(gl4, System.out);
}
// Get variables locations
if (validated) {
unifiedUniformMvp = gl4.glGetUniformLocation(unifiedProgramName, "mvp");
unifiedUniformDiffuse = gl4.glGetUniformLocation(unifiedProgramName, "diffuse");
}
return validated & checkError(gl4, "initProgram");
}
示例15: initProgram
import com.jogamp.opengl.GL4; //导入方法依赖的package包/类
private boolean initProgram(GL4 gl4) {
boolean validated = true;
// Create program
if (validated) {
ShaderProgram shaderProgram = new ShaderProgram();
ShaderCode vertShaderCode = ShaderCode.create(gl4, GL_VERTEX_SHADER, this.getClass(), SHADERS_ROOT, null,
SHADERS_SOURCE, "vert", null, true);
ShaderCode fragShaderCode = ShaderCode.create(gl4, GL_FRAGMENT_SHADER, this.getClass(), SHADERS_ROOT, null,
SHADERS_SOURCE, "frag", null, true);
shaderProgram.init(gl4);
shaderProgram.add(vertShaderCode);
shaderProgram.add(fragShaderCode);
programName = shaderProgram.program();
shaderProgram.link(gl4, System.out);
}
if (validated) {
uniformDiffuse = gl4.glGetUniformLocation(programName, "diffuse");
uniformLayer = gl4.glGetUniformLocation(programName, "layer");
}
return validated & checkError(gl4, "initProgram");
}