Java Code Examples for com.jogamp.opengl.GL3#glGetUniformLocation()
The following examples show how to use
com.jogamp.opengl.GL3#glGetUniformLocation() .
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: BlazeBatcher.java From constellation with Apache License 2.0 | 6 votes |
@Override public void createShader(GL3 gl) throws IOException { // Create the shader shader = SharedDrawable.getBlazeShader(gl, colorTarget, COLOR_SHADER_NAME, infoTarget, BLAZE_INFO_SHADER_NAME); // Set up uniform locations in the shader shaderMVMatrix = gl.glGetUniformLocation(shader, "mvMatrix"); shaderPMatrix = gl.glGetUniformLocation(shader, "pMatrix"); shaderVisibilityLow = gl.glGetUniformLocation(shader, "visibilityLow"); shaderVisibilityHigh = gl.glGetUniformLocation(shader, "visibilityHigh"); shaderMorphMix = gl.glGetUniformLocation(shader, "morphMix"); shaderXyzTexture = gl.glGetUniformLocation(shader, "xyzTexture"); shaderImagesTexture = gl.glGetUniformLocation(shader, "images"); shaderScale = gl.glGetUniformLocation(shader, "scale"); shaderOpacity = gl.glGetUniformLocation(shader, "opacity"); }
Example 2
Source File: PlanesRenderable.java From constellation with Apache License 2.0 | 6 votes |
@Override public void init(final GLAutoDrawable drawable) { final GL3 gl = drawable.getGL().getGL3(); String vs = null; String gs = null; String fs = null; try { vs = GLTools.loadFile(GLVisualProcessor.class, "shaders/Plane.vs"); gs = GLTools.loadFile(GLVisualProcessor.class, "shaders/Plane.gs"); fs = GLTools.loadFile(GLVisualProcessor.class, "shaders/Plane.fs"); } catch (IOException ex) { Logger.getLogger(PlanesRenderable.class.getName()).log(Level.SEVERE, null, ex); } shader = GLTools.loadShaderSourceWithAttributes(gl, "Plane", vs, gs, fs, ShaderManager.ATTRIBUTE_DATAA, "data", ShaderManager.ATTRIBUTE_VERTEX, "vertex", ShaderManager.FRAG_BASE, "fragColor"); shaderMVPMatrix = gl.glGetUniformLocation(shader, "mvpMatrix"); shaderImages = gl.glGetUniformLocation(shader, "images"); textureName = BUFFER_UNUSED; }
Example 3
Source File: Gl_320_glsl_precision.java From jogl-samples with MIT License | 5 votes |
private boolean initProgram(GL3 gl3) { boolean validated = true; if (validated) { ShaderCode vertShaderCode = ShaderCode.create(gl3, GL_VERTEX_SHADER, this.getClass(), SHADERS_ROOT, null, SHADERS_SOURCE, "vert", null, true); ShaderCode fragShaderCode = ShaderCode.create(gl3, GL_FRAGMENT_SHADER, this.getClass(), SHADERS_ROOT, null, SHADERS_SOURCE, "frag", null, true); ShaderProgram shaderProgram = new ShaderProgram(); shaderProgram.add(vertShaderCode); shaderProgram.add(fragShaderCode); shaderProgram.init(gl3); programName = shaderProgram.program(); gl3.glBindAttribLocation(programName, Semantic.Attr.POSITION, "position"); gl3.glBindAttribLocation(programName, Semantic.Attr.TEXCOORD, "texCoord"); gl3.glBindFragDataLocation(programName, Semantic.Frag.COLOR, "color"); shaderProgram.link(gl3, System.out); } if (validated) { uniformTransform = gl3.glGetUniformBlockIndex(programName, "Transform"); uniformDiffuse = gl3.glGetUniformLocation(programName, "diffuse"); } return validated & checkError(gl3, "initProgram"); }
Example 4
Source File: Gl_320_texture_streaming.java From jogl-samples with MIT License | 5 votes |
private boolean initProgram(GL3 gl3) { boolean validated = true; if (validated) { ShaderCode vertShaderCode = ShaderCode.create(gl3, GL_VERTEX_SHADER, this.getClass(), SHADERS_ROOT, null, SHADERS_SOURCE, "vert", null, true); ShaderCode fragShaderCode = ShaderCode.create(gl3, GL_FRAGMENT_SHADER, this.getClass(), SHADERS_ROOT, null, SHADERS_SOURCE, "frag", null, true); ShaderProgram shaderProgram = new ShaderProgram(); shaderProgram.add(vertShaderCode); shaderProgram.add(fragShaderCode); shaderProgram.init(gl3); programName = shaderProgram.program(); gl3.glBindAttribLocation(programName, Semantic.Attr.POSITION, "position"); gl3.glBindAttribLocation(programName, Semantic.Attr.TEXCOORD, "texCoord"); gl3.glBindFragDataLocation(programName, Semantic.Frag.COLOR, "color"); shaderProgram.link(gl3, System.out); } if (validated) { uniformTransform = gl3.glGetUniformBlockIndex(programName, "Transform"); uniformDiffuse = gl3.glGetUniformLocation(programName, "diffuse"); } return validated & checkError(gl3, "initProgram"); }
Example 5
Source File: Gl_320_fbo_blit.java From jogl-samples with MIT License | 5 votes |
private boolean initProgram(GL3 gl3) { boolean validated = true; // Create program if (validated) { ShaderCode vertShader = ShaderCode.create(gl3, GL_VERTEX_SHADER, this.getClass(), SHADERS_ROOT, null, SHADERS_SOURCE, "vert", null, true); ShaderCode fragShader = ShaderCode.create(gl3, GL_FRAGMENT_SHADER, this.getClass(), SHADERS_ROOT, null, SHADERS_SOURCE, "frag", null, true); ShaderProgram program = new ShaderProgram(); program.add(vertShader); program.add(fragShader); program.init(gl3); programName = program.program(); gl3.glBindAttribLocation(programName, Semantic.Attr.POSITION, "position"); gl3.glBindAttribLocation(programName, Semantic.Attr.TEXCOORD, "texCoord"); gl3.glBindFragDataLocation(programName, Semantic.Frag.COLOR, "color"); program.link(gl3, System.out); } if (validated) { uniformMvp = gl3.glGetUniformLocation(programName, "mvp"); uniformDiffuse = gl3.glGetUniformLocation(programName, "diffuse"); } return validated & checkError(gl3, "initProgram"); }
Example 6
Source File: Gl_320_glsl_input_struct.java From jogl-samples with MIT License | 5 votes |
private boolean initProgram(GL3 gl3) { boolean validated = true; if (validated) { ShaderCode vertShaderCode = ShaderCode.create(gl3, GL_VERTEX_SHADER, this.getClass(), SHADERS_ROOT, null, SHADERS_SOURCE, "vert", null, true); ShaderCode fragShaderCode = ShaderCode.create(gl3, GL_FRAGMENT_SHADER, this.getClass(), SHADERS_ROOT, null, SHADERS_SOURCE, "frag", null, true); ShaderProgram shaderProgram = new ShaderProgram(); shaderProgram.add(vertShaderCode); shaderProgram.add(fragShaderCode); shaderProgram.init(gl3); programName = shaderProgram.program(); gl3.glBindAttribLocation(programName, Semantic.Attr.POSITION, "vertex.position"); gl3.glBindAttribLocation(programName, Semantic.Attr.TEXCOORD, "vertex.texCoord"); gl3.glBindFragDataLocation(programName, Semantic.Frag.COLOR, "color"); shaderProgram.link(gl3, System.out); } if (validated) { uniformTransform = gl3.glGetUniformBlockIndex(programName, "Transform"); uniformDiffuse = gl3.glGetUniformLocation(programName, "diffuse"); } return validated & checkError(gl3, "initProgram"); }
Example 7
Source File: SelectionBoxRenderable.java From constellation with Apache License 2.0 | 5 votes |
@Override public void init(final GLAutoDrawable drawable) { final GL3 gl = drawable.getGL().getGL3(); String vs = null; String gs = null; String fs = null; try { vs = GLTools.loadFile(GLVisualProcessor.class, "shaders/PassThru.vs"); gs = GLTools.loadFile(GLVisualProcessor.class, "shaders/PassThruTriangle.gs"); fs = GLTools.loadFile(GLVisualProcessor.class, "shaders/PassThru.fs"); } catch (IOException ex) { Logger.getLogger(SelectionBoxRenderable.class.getName()).log(Level.SEVERE, null, ex); } shader = GLTools.loadShaderSourceWithAttributes(gl, "PassThru selection", vs, gs, fs, vertexTarget, "vertex", colorTarget, "color", ShaderManager.FRAG_BASE, "fragColor"); shaderMvp = gl.glGetUniformLocation(shader, "mvpMatrix"); batch.initialise(NUMBER_OF_VERTICES); for (int i = 0; i < NUMBER_OF_VERTICES; i++) { batch.stage(vertexTarget, ZERO_3F); batch.stage(colorTarget, SELECTION_COLOR); } batch.finalise(gl); }
Example 8
Source File: Gl_320_texture_pixel_store.java From jogl-samples with MIT License | 5 votes |
private boolean initProgram(GL3 gl3) { boolean validated = true; if (validated) { ShaderCode vertShaderCode = ShaderCode.create(gl3, GL_VERTEX_SHADER, this.getClass(), SHADERS_ROOT, null, SHADERS_SOURCE, "vert", null, true); ShaderCode fragShaderCode = ShaderCode.create(gl3, GL_FRAGMENT_SHADER, this.getClass(), SHADERS_ROOT, null, SHADERS_SOURCE, "frag", null, true); ShaderProgram shaderProgram = new ShaderProgram(); shaderProgram.add(vertShaderCode); shaderProgram.add(fragShaderCode); shaderProgram.init(gl3); programName = shaderProgram.program(); gl3.glBindAttribLocation(programName, Semantic.Attr.POSITION, "position"); gl3.glBindAttribLocation(programName, Semantic.Attr.TEXCOORD, "texCoord"); gl3.glBindFragDataLocation(programName, Semantic.Frag.COLOR, "color"); shaderProgram.link(gl3, System.out); } if (validated) { uniformTransform = gl3.glGetUniformBlockIndex(programName, "Transform"); uniformDiffuse = gl3.glGetUniformLocation(programName, "diffuse"); } return validated & checkError(gl3, "initProgram"); }
Example 9
Source File: NBodyVisualizer.java From gpu-nbody with MIT License | 4 votes |
/** * Implementation of GLEventListener: Called when the given GLAutoDrawable is to be displayed. */ @Override public void display(final GLAutoDrawable drawable) { if (!initialized) { return; } final GL3 gl = (GL3) drawable.getGL(); // run computation // Map OpenGL buffer object for writing from OpenCL gl.glFinish(); simulation.step(); gl.glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Activate the shader program gl.glUseProgram(shaderProgramID); // Set the current projection matrix final int projectionMatrixLocation = gl.glGetUniformLocation(shaderProgramID, "projectionMatrix"); gl.glUniformMatrix4fv(projectionMatrixLocation, 1, false, projectionMatrix, 0); // Set the current modelview matrix final int modelviewMatrixLocation = gl.glGetUniformLocation(shaderProgramID, "modelviewMatrix"); gl.glUniformMatrix4fv(modelviewMatrixLocation, 1, false, modelviewMatrix, 0); final int screenSizeLocation = gl.glGetUniformLocation(shaderProgramID, "screenSize"); gl.glUniform2f(screenSizeLocation, glComponent.getWidth(), glComponent.getHeight()); final int spriteSizeLocation = gl.glGetUniformLocation(shaderProgramID, "spriteSize"); gl.glUniform1f(spriteSizeLocation, 0.1f); bodyTexture.enable(gl); bodyTexture.bind(gl); final int textureLocation = gl.glGetUniformLocation(shaderProgramID, "tex"); gl.glUniform1i(textureLocation, bodyTexture.getTarget()); // Render the VBO gl.glEnable(GL_TEXTURE_2D); gl.glEnable(GL_BLEND); gl.glBlendFunc(GL_SRC_ALPHA, GL_ONE); final int velLocation = gl.glGetAttribLocation(shaderProgramID, "inVelocity"); gl.glBindBuffer(GL_ARRAY_BUFFER, velocityVBO); gl.glEnableVertexAttribArray(velLocation); gl.glVertexAttribPointer(velLocation, 4, GL3.GL_FLOAT, false, 0, 0); final int inVertexLocation = gl.glGetAttribLocation(shaderProgramID, "inVertex"); gl.glBindBuffer(GL_ARRAY_BUFFER, positionVBO); gl.glEnableVertexAttribArray(inVertexLocation); gl.glVertexAttribPointer(inVertexLocation, 4, GL3.GL_FLOAT, false, 0, 0); gl.glDrawArrays(GL_POINTS, 0, simulation.getNumberOfBodies()); }
Example 10
Source File: JCudaDriverSimpleJOGL.java From jcuda-samples with MIT License | 4 votes |
@Override public void display(GLAutoDrawable drawable) { GL3 gl = drawable.getGL().getGL3(); if (useCUDA) { // Run the CUDA kernel to generate new vertex positions. runCuda(gl); } else { // Run the Java method to generate new vertex positions. runJava(gl); } gl.glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Activate the shader program gl.glUseProgram(shaderProgramID); // Set the current projection matrix int projectionMatrixLocation = gl.glGetUniformLocation(shaderProgramID, "projectionMatrix"); gl.glUniformMatrix4fv( projectionMatrixLocation, 1, false, simpleInteraction.getProjectionMatrix(), 0); // Set the current modelview matrix int modelviewMatrixLocation = gl.glGetUniformLocation(shaderProgramID, "modelviewMatrix"); gl.glUniformMatrix4fv( modelviewMatrixLocation, 1, false, simpleInteraction.getModelviewMatrix(), 0); // Render the VBO gl.glBindBuffer(GL_ARRAY_BUFFER, vertexBufferObject); gl.glDrawArrays(GL_POINTS, 0, meshWidth * meshHeight); // Update FPS information in main frame title step++; long currentTime = System.nanoTime(); if (prevTimeNS == -1) { prevTimeNS = currentTime; } long diff = currentTime - prevTimeNS; if (diff > 1e9) { double fps = (diff / 1e9) * step; String t = "JCuda / JOGL interaction sample - "; t += useCUDA ? "JCuda" : "Java"; t += " mode: " + String.format("%.2f", fps) + " FPS"; frame.setTitle(t); prevTimeNS = currentTime; step = 0; } animationState += 0.01; }
Example 11
Source File: Gl_330_fbo_multisample_explicit_nv.java From jogl-samples with MIT License | 3 votes |
private boolean initProgram(GL3 gl3) { boolean validated = true; ShaderCode[] shaderCodes = new ShaderCode[Shader.MAX]; shaderCodes[Shader.VERT] = ShaderCode.create(gl3, GL_VERTEX_SHADER, this.getClass(), SHADERS_ROOT, null, VERT_SHADER_SOURCE, "vert", null, true); for (int i = 0; i < Program.MAX; i++) { shaderCodes[Shader.FRAG_THROUGH + i] = ShaderCode.create(gl3, GL_FRAGMENT_SHADER, this.getClass(), SHADERS_ROOT, null, FRAG_SHADER_SOURCE[i], "frag", null, true); } for (int i = 0; i < Program.MAX; i++) { ShaderProgram shaderProgram = new ShaderProgram(); shaderProgram.add(shaderCodes[Shader.VERT]); shaderProgram.add(shaderCodes[Shader.FRAG_THROUGH + i]); shaderProgram.init(gl3); programName[i] = shaderProgram.program(); shaderProgram.link(gl3, System.out); uniformMvp[i] = gl3.glGetUniformLocation(programName[i], "mvp"); uniformDiffuse[i] = gl3.glGetUniformLocation(programName[i], "diffuse"); } return validated & checkError(gl3, "initProgram"); }
Example 12
Source File: Gl_330_query_time.java From jogl-samples with MIT License | 3 votes |
private boolean initProgram(GL3 gl3) { boolean validated = true; if (validated) { ShaderProgram shaderProgram = new ShaderProgram(); ShaderCode vertShaderCode = ShaderCode.create(gl3, GL_VERTEX_SHADER, this.getClass(), SHADERS_ROOT, null, SHADERS_SOURCE, "vert", null, true); ShaderCode fragShaderCode = ShaderCode.create(gl3, GL_FRAGMENT_SHADER, this.getClass(), SHADERS_ROOT, null, SHADERS_SOURCE, "frag", null, true); shaderProgram.init(gl3); shaderProgram.add(vertShaderCode); shaderProgram.add(fragShaderCode); programName = shaderProgram.program(); shaderProgram.link(gl3, System.out); } // Get variables locations if (validated) { uniformMvp = gl3.glGetUniformLocation(programName, "mvp"); uniformColor = gl3.glGetUniformLocation(programName, "diffuse"); } return validated & checkError(gl3, "initProgram"); }
Example 13
Source File: Gl_330_buffer_type.java From jogl-samples with MIT License | 3 votes |
private boolean initProgram(GL3 gl3) { boolean validated = true; if (validated) { ShaderCode vertShaderCode = ShaderCode.create(gl3, GL_VERTEX_SHADER, this.getClass(), SHADERS_ROOT, null, SHADERS_SOURCE, "vert", null, true); ShaderCode fragShaderCode = ShaderCode.create(gl3, GL_FRAGMENT_SHADER, this.getClass(), SHADERS_ROOT, null, SHADERS_SOURCE, "frag", null, true); ShaderProgram shaderProgram = new ShaderProgram(); shaderProgram.add(vertShaderCode); shaderProgram.add(fragShaderCode); shaderProgram.init(gl3); programName = shaderProgram.program(); shaderProgram.link(gl3, System.out); } // Get variables locations if (validated) { uniformMvp = gl3.glGetUniformLocation(programName, "mvp"); uniformDiffuse = gl3.glGetUniformLocation(programName, "diffuse"); } return validated & checkError(gl3, "initProgram"); }
Example 14
Source File: Gl_330_texture_integer_rgb10a2ui.java From jogl-samples with MIT License | 3 votes |
private boolean initProgram(GL3 gl3) { boolean validated = true; if (validated) { ShaderProgram shaderProgram = new ShaderProgram(); ShaderCode vertShaderCode = ShaderCode.create(gl3, GL_VERTEX_SHADER, this.getClass(), SHADERS_ROOT, null, VERT_SHADER_SOURCE, "vert", null, true); ShaderCode fragShaderCode = ShaderCode.create(gl3, GL_FRAGMENT_SHADER, this.getClass(), SHADERS_ROOT, null, FRAG_SHADER_SOURCE, "frag", null, true); shaderProgram.init(gl3); shaderProgram.add(vertShaderCode); shaderProgram.add(fragShaderCode); programName = shaderProgram.program(); shaderProgram.link(gl3, System.out); } // Get variables locations if (validated) { uniformMvp = gl3.glGetUniformLocation(programName, "MVP"); uniformDiffuse = gl3.glGetUniformLocation(programName, "Diffuse"); } return validated & checkError(gl3, "initProgram"); }
Example 15
Source File: Gl_330_blend_index.java From jogl-samples with MIT License | 3 votes |
private boolean initProgram(GL3 gl3) { boolean validated = true; ShaderCode vertShaderCode = ShaderCode.create(gl3, GL_VERTEX_SHADER, this.getClass(), SHADERS_ROOT, null, SHADERS_SOURCE, "vert", null, true); ShaderCode fragShaderCode = ShaderCode.create(gl3, GL_FRAGMENT_SHADER, this.getClass(), SHADERS_ROOT, null, SHADERS_SOURCE, "frag", null, true); if (validated) { ShaderProgram shaderProgram = new ShaderProgram(); shaderProgram.add(vertShaderCode); shaderProgram.add(fragShaderCode); shaderProgram.init(gl3); programName = shaderProgram.program(); shaderProgram.link(gl3, System.out); } if (validated) { uniformMvp = gl3.glGetUniformLocation(programName, "mvp"); uniformDiffuse = gl3.glGetUniformLocation(programName, "diffuse"); } return validated & checkError(gl3, "initProgram"); }
Example 16
Source File: Gl_330_sampler_anisotropy_ext.java From jogl-samples with MIT License | 3 votes |
private boolean initProgram(GL3 gl3) { boolean validated = true; if (validated) { ShaderProgram shaderProgram = new ShaderProgram(); ShaderCode vertShaderCode = ShaderCode.create(gl3, GL_VERTEX_SHADER, this.getClass(), SHADERS_ROOT, null, SHADERS_SOURCE, "vert", null, true); ShaderCode fragShaderCode = ShaderCode.create(gl3, GL_FRAGMENT_SHADER, this.getClass(), SHADERS_ROOT, null, SHADERS_SOURCE, "frag", null, true); shaderProgram.init(gl3); shaderProgram.add(vertShaderCode); shaderProgram.add(fragShaderCode); programName = shaderProgram.program(); shaderProgram.link(gl3, System.out); } // Get variables locations if (validated) { uniformMvp = gl3.glGetUniformLocation(programName, "mvp"); uniformDiffuse = gl3.glGetUniformLocation(programName, "diffuse"); } return validated & checkError(gl3, "initProgram"); }
Example 17
Source File: Gl_320_texture_lod.java From jogl-samples with MIT License | 3 votes |
private boolean initProgram(GL3 gl3) { boolean validated = true; if (validated) { ShaderCode vertShaderCode = ShaderCode.create(gl3, GL_VERTEX_SHADER, this.getClass(), SHADERS_ROOT, null, SHADERS_SOURCE, "vert", null, true); ShaderCode fragShaderCode = ShaderCode.create(gl3, GL_FRAGMENT_SHADER, this.getClass(), SHADERS_ROOT, null, SHADERS_SOURCE, "frag", null, true); ShaderProgram shaderProgram = new ShaderProgram(); shaderProgram.add(vertShaderCode); shaderProgram.add(fragShaderCode); shaderProgram.init(gl3); programName = shaderProgram.program(); gl3.glBindAttribLocation(programName, Semantic.Attr.POSITION, "position"); gl3.glBindAttribLocation(programName, Semantic.Attr.TEXCOORD, "texCoord"); gl3.glBindFragDataLocation(programName, Semantic.Frag.COLOR, "color"); shaderProgram.link(gl3, System.out); } if (validated) { uniformMvp = gl3.glGetUniformLocation(programName, "mvp"); uniformDiffuse = gl3.glGetUniformLocation(programName, "diffuse"); } return validated & checkError(gl3, "initProgram"); }
Example 18
Source File: Gl_330_draw_instanced_array.java From jogl-samples with MIT License | 3 votes |
private boolean initProgram(GL3 gl3) { boolean validated = true; if (validated) { ShaderCode vertShaderCode = ShaderCode.create(gl3, GL_VERTEX_SHADER, this.getClass(), SHADERS_ROOT, null, SHADERS_SOURCE, "vert", null, true); ShaderCode fragShaderCode = ShaderCode.create(gl3, GL_FRAGMENT_SHADER, this.getClass(), SHADERS_ROOT, null, SHADERS_SOURCE, "frag", null, true); ShaderProgram shaderProgram = new ShaderProgram(); shaderProgram.add(vertShaderCode); shaderProgram.add(fragShaderCode); shaderProgram.init(gl3); programName = shaderProgram.program(); shaderProgram.link(gl3, System.out); } // Get variables locations if (validated) { uniformMvp = gl3.glGetUniformLocation(programName, "mvp"); } return validated & checkError(gl3, "initProgram"); }
Example 19
Source File: Gl_330_texture_swizzle.java From jogl-samples with MIT License | 3 votes |
private boolean initProgram(GL3 gl3) { boolean validated = true; if (validated) { ShaderProgram shaderProgram = new ShaderProgram(); ShaderCode vertShaderCode = ShaderCode.create(gl3, GL_VERTEX_SHADER, this.getClass(), SHADERS_ROOT, null, SHADERS_SOURCE, "vert", null, true); ShaderCode fragShaderCode = ShaderCode.create(gl3, GL_FRAGMENT_SHADER, this.getClass(), SHADERS_ROOT, null, SHADERS_SOURCE, "frag", null, true); shaderProgram.init(gl3); shaderProgram.add(vertShaderCode); shaderProgram.add(fragShaderCode); programName = shaderProgram.program(); shaderProgram.link(gl3, System.out); } // Get variables locations if (validated) { uniformMvp = gl3.glGetUniformLocation(programName, "mvp"); uniformDiffuse = gl3.glGetUniformLocation(programName, "diffuse"); } return validated & checkError(gl3, "initProgram"); }
Example 20
Source File: Gl_320_texture_3d.java From jogl-samples with MIT License | 3 votes |
private boolean initProgram(GL3 gl3) { boolean validated = true; if (validated) { ShaderCode vertShaderCode = ShaderCode.create(gl3, GL_VERTEX_SHADER, this.getClass(), SHADERS_ROOT, null, SHADERS_SOURCE, "vert", null, true); ShaderCode fragShaderCode = ShaderCode.create(gl3, GL_FRAGMENT_SHADER, this.getClass(), SHADERS_ROOT, null, SHADERS_SOURCE, "frag", null, true); ShaderProgram shaderProgram = new ShaderProgram(); shaderProgram.add(vertShaderCode); shaderProgram.add(fragShaderCode); shaderProgram.init(gl3); programName = shaderProgram.program(); gl3.glBindFragDataLocation(programName, Semantic.Frag.COLOR, "color"); shaderProgram.link(gl3, System.out); } if (validated) { uniformTextureMatrix = gl3.glGetUniformLocation(programName, "orientation"); uniformDiffuse = gl3.glGetUniformLocation(programName, "diffuse"); } return validated & checkError(gl3, "initProgram"); }