Java Code Examples for com.jogamp.opengl.GL4#glUseProgramStages()
The following examples show how to use
com.jogamp.opengl.GL4#glUseProgramStages() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Gl_430_draw_without_vertex_attrib.java From jogl-samples with MIT License | 5 votes |
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"); }
Example 2
Source File: Gl_420_texture_storage.java From jogl-samples with MIT License | 5 votes |
private boolean initProgram(GL4 gl4) { boolean validated = true; gl4.glGenProgramPipelines(1, pipelineName); if (validated) { ShaderProgram[] shaderPrograms = {new 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); shaderPrograms[Program.VERTEX].init(gl4); programName[Program.VERTEX] = shaderPrograms[Program.VERTEX].program(); gl4.glProgramParameteri(programName[Program.VERTEX], GL_PROGRAM_SEPARABLE, GL_TRUE); shaderPrograms[Program.VERTEX].add(vertShaderCode); shaderPrograms[Program.VERTEX].link(gl4, System.out); shaderPrograms[Program.FRAGMENT].init(gl4); programName[Program.FRAGMENT] = shaderPrograms[Program.FRAGMENT].program(); gl4.glProgramParameteri(programName[Program.FRAGMENT], GL_PROGRAM_SEPARABLE, GL_TRUE); shaderPrograms[Program.FRAGMENT].add(fragShaderCode); shaderPrograms[Program.FRAGMENT].link(gl4, System.out); } if (validated) { gl4.glUseProgramStages(pipelineName.get(0), GL_VERTEX_SHADER_BIT, programName[Program.VERTEX]); gl4.glUseProgramStages(pipelineName.get(0), GL_FRAGMENT_SHADER_BIT, programName[Program.FRAGMENT]); } return validated & checkError(gl4, "initProgram"); }
Example 3
Source File: Gl_420_image_unpack.java From jogl-samples with MIT License | 5 votes |
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"); }
Example 4
Source File: Gl_430_interface_matching.java From jogl-samples with MIT License | 4 votes |
private boolean initProgram(GL4 gl4) { boolean validated = true; gl4.glGenProgramPipelines(1, pipelineName); // Create program if (validated) { ShaderProgram[] shaderPrograms = new ShaderProgram[]{ new 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); shaderPrograms[Program.VERT].init(gl4); shaderPrograms[Program.FRAG].init(gl4); programName[Program.VERT] = shaderPrograms[Program.VERT].program(); programName[Program.FRAG] = shaderPrograms[Program.FRAG].program(); gl4.glProgramParameteri(programName[Program.VERT], GL_PROGRAM_SEPARABLE, GL_TRUE); gl4.glProgramParameteri(programName[Program.FRAG], GL_PROGRAM_SEPARABLE, GL_TRUE); shaderPrograms[Program.VERT].add(vertShaderCode); shaderPrograms[Program.VERT].add(contShaderCode); shaderPrograms[Program.VERT].add(evalShaderCode); shaderPrograms[Program.VERT].add(geomShaderCode); shaderPrograms[Program.VERT].link(gl4, System.out); shaderPrograms[Program.FRAG].add(fragShaderCode); shaderPrograms[Program.FRAG].link(gl4, System.out); } if (validated) { 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"); }
Example 5
Source File: Gl_410_primitive_tessellation2.java From jogl-samples with MIT License | 4 votes |
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"); }
Example 6
Source File: Gl_430_multi_draw_indirect.java From jogl-samples with MIT License | 4 votes |
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"); }
Example 7
Source File: Gl_420_interface_matching.java From jogl-samples with MIT License | 4 votes |
private boolean initProgram(GL4 gl4) { boolean validated = true; gl4.glGenProgramPipelines(1, pipelineName); // Create program if (validated) { ShaderProgram[] shaderPrograms = new ShaderProgram[Program.MAX]; for (int i = 0; i < Program.MAX; i++) { shaderPrograms[i] = 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); shaderPrograms[Program.VERT].init(gl4); shaderPrograms[Program.FRAG].init(gl4); programName[Program.VERT] = shaderPrograms[Program.VERT].program(); programName[Program.FRAG] = shaderPrograms[Program.FRAG].program(); gl4.glProgramParameteri(programName[Program.VERT], GL_PROGRAM_SEPARABLE, GL_TRUE); gl4.glProgramParameteri(programName[Program.FRAG], GL_PROGRAM_SEPARABLE, GL_TRUE); shaderPrograms[Program.VERT].add(vertShaderCode); shaderPrograms[Program.VERT].add(contShaderCode); shaderPrograms[Program.VERT].add(evalShaderCode); shaderPrograms[Program.VERT].add(geomShaderCode); shaderPrograms[Program.VERT].link(gl4, System.out); shaderPrograms[Program.FRAG].add(fragShaderCode); shaderPrograms[Program.FRAG].link(gl4, System.out); } if (validated) { 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"); }
Example 8
Source File: Gl_420_texture_cube.java From jogl-samples with MIT License | 3 votes |
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"); }
Example 9
Source File: Gl_440_texture_compressed.java From jogl-samples with MIT License | 3 votes |
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"); }
Example 10
Source File: Gl_500_texture_cube_arb.java From jogl-samples with MIT License | 3 votes |
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"); }
Example 11
Source File: Gl_420_clipping.java From jogl-samples with MIT License | 3 votes |
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"); }
Example 12
Source File: Gl_450_culling.java From jogl-samples with MIT License | 3 votes |
private boolean initProgram(GL4 gl4) { boolean validated = true; gl4.glGenProgramPipelines(1, pipelineName); 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.glUseProgramStages(pipelineName.get(0), GL_VERTEX_SHADER_BIT | GL_FRAGMENT_SHADER_BIT, programName); } return validated & checkError(gl4, "initProgram"); }
Example 13
Source File: Gl_450_texture_derivative.java From jogl-samples with MIT License | 3 votes |
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_X, "vert", null, true); ShaderCode fragShaderCode = ShaderCode.create(gl4, GL_FRAGMENT_SHADER, this.getClass(), SHADERS_ROOT, null, SHADERS_SOURCE_X, "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"); }
Example 14
Source File: Gl_420_buffer_uniform.java From jogl-samples with MIT License | 3 votes |
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); } if (validated) { uniformInstance = gl4.glGetUniformLocation(programName, "instance"); } return validated & checkError(gl4, "initProgram"); }
Example 15
Source File: Gl_430_texture_copy.java From jogl-samples with MIT License | 3 votes |
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"); }
Example 16
Source File: Gl_420_texture_compressed.java From jogl-samples with MIT License | 3 votes |
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"); }
Example 17
Source File: Gl_500_texture_bindless_arb.java From jogl-samples with MIT License | 3 votes |
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"); }
Example 18
Source File: Gl_430_texture_fetch_dependent.java From jogl-samples with MIT License | 3 votes |
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"); }
Example 19
Source File: Gl_500_shader_invocation_nv.java From jogl-samples with MIT License | 3 votes |
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"); }
Example 20
Source File: Gl_500_multi_draw_indirect_count_arb.java From jogl-samples with MIT License | 2 votes |
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"); }