本文整理汇总了Java中com.jogamp.opengl.GL4.glUseProgramStages方法的典型用法代码示例。如果您正苦于以下问题:Java GL4.glUseProgramStages方法的具体用法?Java GL4.glUseProgramStages怎么用?Java GL4.glUseProgramStages使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.jogamp.opengl.GL4
的用法示例。
在下文中一共展示了GL4.glUseProgramStages方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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()};
String[] fragmentSourceContent = new String[]{new Scanner(new File(SHADERS_ROOT + "/" + SHADERS_SOURCE
+ ".frag")).useDelimiter("\\A").next()};
programName[Program.VERT] = gl4.glCreateShaderProgramv(GL_VERTEX_SHADER, 1, vertexSourceContent);
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) {
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_420_image_unpack.class.getName()).log(Level.SEVERE, null, ex);
}
return validated && checkError(gl4, "initProgram");
}
示例2: initProgram
import com.jogamp.opengl.GL4; //导入方法依赖的package包/类
private boolean initProgram(GL4 gl4) {
boolean validated = true;
gl4.glGenProgramPipelines(1, pipelineName);
// 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();
gl4.glProgramParameteri(programName, GL_PROGRAM_SEPARABLE, GL_TRUE);
shaderProgram.add(vertShaderCode);
shaderProgram.add(fragShaderCode);
shaderProgram.link(gl4, System.out);
}
if (validated) {
gl4.glUseProgramStages(pipelineName.get(0), GL_VERTEX_SHADER_BIT | GL_FRAGMENT_SHADER_BIT, programName);
}
return validated & checkError(gl4, "initProgram");
}
示例3: initProgram
import com.jogamp.opengl.GL4; //导入方法依赖的package包/类
private boolean initProgram(GL4 gl4) {
boolean validated = true;
gl4.glGenProgramPipelines(1, pipelineName);
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();
gl4.glProgramParameteri(programName, GL_PROGRAM_SEPARABLE, GL_TRUE);
shaderProgram.add(vertShaderCode);
shaderProgram.add(fragShaderCode);
shaderProgram.link(gl4, System.out);
int[] activeUniform = {0};
gl4.glGetProgramiv(programName, GL_ACTIVE_UNIFORMS, activeUniform, 0);
for (int i = 0; i < activeUniform[0]; ++i) {
byte[] name = new byte[128];
int[] length = {0};
gl4.glGetActiveUniformName(programName, i, name.length, length, 0, name, 0);
String stringName = new String(name).trim();
IntBuffer indices = GLBuffers.newDirectIntBuffer(1).put(0, i);
if (stringName.equals("Transform.mvp[0]")) {
gl4.glGetActiveUniformsiv(programName, 1, indices, GL_UNIFORM_ARRAY_STRIDE, uniformArrayStrideMat);
}
if (stringName.equals("Indirection.transform[0]")) {
gl4.glGetActiveUniformsiv(programName, 1, indices, GL_UNIFORM_ARRAY_STRIDE, uniformArrayStrideInt);
}
BufferUtils.destroyDirectBuffer(indices);
}
if (validated) {
gl4.glGenProgramPipelines(1, pipelineName);
gl4.glUseProgramStages(pipelineName.get(0), GL_VERTEX_SHADER_BIT | GL_FRAGMENT_SHADER_BIT, programName);
}
return validated & checkError(gl4, "initProgram");
}
示例4: 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");
}
示例5: 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");
}
示例6: 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");
}
示例7: initProgram
import com.jogamp.opengl.GL4; //导入方法依赖的package包/类
private boolean initProgram(GL4 gl4) {
boolean validated = true;
// Create program
if (validated) {
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 shaderProgram = new ShaderProgram();
shaderProgram.init(gl4);
programName = shaderProgram.program();
gl4.glProgramParameteri(programName, GL_PROGRAM_SEPARABLE, GL_TRUE);
shaderProgram.add(vertShaderCode);
shaderProgram.add(fragShaderCode);
shaderProgram.link(gl4, System.out);
}
if (validated) {
gl4.glGenProgramPipelines(1, pipelineName);
gl4.glUseProgramStages(pipelineName.get(0), GL_VERTEX_SHADER_BIT | GL_FRAGMENT_SHADER_BIT, programName);
}
return validated & checkError(gl4, "initProgram");
}
示例8: initProgram
import com.jogamp.opengl.GL4; //导入方法依赖的package包/类
private boolean initProgram(GL4 gl4) {
boolean validated = true;
if (validated) {
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 shaderProgram = new ShaderProgram();
shaderProgram.init(gl4);
programName = shaderProgram.program();
gl4.glProgramParameteri(programName, GL_PROGRAM_SEPARABLE, GL_TRUE);
shaderProgram.add(vertShaderCode);
shaderProgram.add(fragShaderCode);
shaderProgram.link(gl4, System.out);
}
if (validated) {
gl4.glGenProgramPipelines(1, pipelineName);
gl4.glUseProgramStages(pipelineName.get(0), GL_VERTEX_SHADER_BIT | GL_FRAGMENT_SHADER_BIT, programName);
}
return validated & checkError(gl4, "initProgram");
}
示例9: initProgram
import com.jogamp.opengl.GL4; //导入方法依赖的package包/类
private boolean initProgram(GL4 gl4) {
boolean validated = true;
// Create shaders
if (validated) {
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);
if (validated) {
ShaderProgram shaderProgram = new ShaderProgram();
shaderProgram.init(gl4);
programName = shaderProgram.program();
gl4.glProgramParameteri(programName, GL_PROGRAM_SEPARABLE, GL_TRUE);
shaderProgram.add(vertShaderCode);
shaderProgram.add(fragShaderCode);
shaderProgram.link(gl4, System.out);
}
}
if (validated) {
gl4.glGenProgramPipelines(1, pipelineName);
gl4.glUseProgramStages(pipelineName.get(0), GL_VERTEX_SHADER_BIT | GL_FRAGMENT_SHADER_BIT, programName);
}
return validated & checkError(gl4, "initProgram");
}
示例10: 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();
gl4.glProgramParameteri(programName, GL_PROGRAM_SEPARABLE, GL_TRUE);
shaderProgram.add(vertShaderCode);
shaderProgram.add(fragShaderCode);
shaderProgram.link(gl4, System.out);
}
if (validated) {
gl4.glGenProgramPipelines(1, pipelineName);
gl4.glBindProgramPipeline(pipelineName.get(0));
gl4.glUseProgramStages(pipelineName.get(0), GL_VERTEX_SHADER_BIT | GL_FRAGMENT_SHADER_BIT, programName);
}
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 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();
gl4.glProgramParameteri(programName, GL_PROGRAM_SEPARABLE, GL_TRUE);
shaderProgram.add(vertShaderCode);
shaderProgram.add(fragShaderCode);
shaderProgram.link(gl4, System.out);
}
if (validated) {
gl4.glGenProgramPipelines(1, pipelineName);
gl4.glUseProgramStages(pipelineName.get(0), GL_VERTEX_SHADER_BIT | GL_FRAGMENT_SHADER_BIT, programName);
}
return validated & checkError(gl4, "initProgram");
}
示例12: initProgram
import com.jogamp.opengl.GL4; //导入方法依赖的package包/类
private boolean initProgram(GL4 gl4) {
boolean validated = true;
gl4.glGenProgramPipelines(1, pipelineName);
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();
gl4.glProgramParameteri(programName, GL_PROGRAM_SEPARABLE, GL_TRUE);
shaderProgram.add(vertShaderCode);
shaderProgram.add(fragShaderCode);
shaderProgram.link(gl4, System.out);
}
if (validated) {
gl4.glUseProgramStages(pipelineName.get(0), GL_VERTEX_SHADER_BIT | GL_FRAGMENT_SHADER_BIT, programName);
}
return validated & checkError(gl4, "initProgram");
}
示例13: initProgram
import com.jogamp.opengl.GL4; //导入方法依赖的package包/类
private boolean initProgram(GL4 gl4) {
boolean validated = true;
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 shaderProgram = new ShaderProgram();
shaderProgram.init(gl4);
programName = shaderProgram.program();
gl4.glProgramParameteri(programName, GL_PROGRAM_SEPARABLE, GL_TRUE);
shaderProgram.add(vertShaderCode);
shaderProgram.add(fragShaderCode);
shaderProgram.link(gl4, System.out);
int[] activeUniform = {0};
gl4.glGetProgramiv(programName, GL_ACTIVE_UNIFORMS, activeUniform, 0);
for (int i = 0; i < activeUniform[0]; ++i) {
byte[] name = new byte[128];
int[] length = {0};
gl4.glGetActiveUniformName(programName, i, name.length, length, 0, name, 0);
String stringName = new String(name).trim();
if (stringName.equals("indirection.Transform[0]")) {
gl4.glGetActiveUniformsiv(programName, 1, new int[]{i}, 0, GL_UNIFORM_ARRAY_STRIDE,
uniformArrayStrideInt, 0);
}
}
if (validated) {
gl4.glGenProgramPipelines(1, pipelineName, 0);
gl4.glUseProgramStages(pipelineName[0], GL_VERTEX_SHADER_BIT | GL_FRAGMENT_SHADER_BIT, programName);
}
return validated & checkError(gl4, "initProgram");
}