Java Code Examples for org.lwjgl.opengl.GL20#glValidateProgram()
The following examples show how to use
org.lwjgl.opengl.GL20#glValidateProgram() .
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: OpenGL3_TheQuadTextured.java From ldparteditor with MIT License | 6 votes |
private void setupShaders() { // Load the vertex shader vsId = this.loadShader("src/thequad/vertex_textured.glsl", GL20.GL_VERTEX_SHADER); // Load the fragment shader fsId = this.loadShader("src/thequad/fragment_textured.glsl", GL20.GL_FRAGMENT_SHADER); // Create a new shader program that links both shaders pId = GL20.glCreateProgram(); GL20.glAttachShader(pId, vsId); GL20.glAttachShader(pId, fsId); // Position information will be attribute 0 GL20.glBindAttribLocation(pId, 0, "in_Position"); // Color information will be attribute 1 GL20.glBindAttribLocation(pId, 1, "in_Color"); // Textute information will be attribute 2 GL20.glBindAttribLocation(pId, 2, "in_TextureCoord"); GL20.glLinkProgram(pId); GL20.glValidateProgram(pId); this.exitOnGLError("setupShaders"); }
Example 2
Source File: ShaderProgram.java From LowPolyWater with The Unlicense | 4 votes |
protected void storeAllUniformLocations(Uniform... uniforms){ for(Uniform uniform : uniforms){ uniform.storeUniformLocation(programID); } GL20.glValidateProgram(programID); }
Example 3
Source File: ShaderProgram.java From LowPolyWater with The Unlicense | 4 votes |
protected void validateProgram(){ GL20.glValidateProgram(programID); }
Example 4
Source File: ShaderProgram.java From OpenGL-Animation with The Unlicense | 4 votes |
protected void storeAllUniformLocations(Uniform... uniforms){ for(Uniform uniform : uniforms){ uniform.storeUniformLocation(programID); } GL20.glValidateProgram(programID); }
Example 5
Source File: OpenGLRenderer20.java From ldparteditor with MIT License | 4 votes |
/** * Initializes the Scene and gives OpenGL-Hints */ @Override public void init() { // MARK OpenGL Hints and Initialization GL11.glDepthMask(true); GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glDepthFunc(GL11.GL_LESS); GL11.glClearDepth(1.0f); GL11.glClearColor(View.background_Colour_r[0], View.background_Colour_g[0], View.background_Colour_b[0], 1.0f); GL11.glHint(GL11.GL_PERSPECTIVE_CORRECTION_HINT, GL11.GL_NICEST); GL11.glPointSize(5); // GL11.glLineWidth(2); GL11.glEnable(GL11.GL_LIGHTING); GL11.glShadeModel(GL11.GL_SMOOTH); GL11.glEnable(GL11.GL_NORMALIZE); GL11.glEnable(GL11.GL_LIGHT0); GL11.glEnable(GL11.GL_LIGHT1); GL11.glEnable(GL11.GL_LIGHT2); GL11.glEnable(GL11.GL_LIGHT3); GL11.glLightModelfv(GL11.GL_LIGHT_MODEL_AMBIENT, BufferFactory.floatBuffer(new float[] { 0.1f, 0.1f, 0.1f, 1f })); GL11.glLightfv(GL11.GL_LIGHT0, GL11.GL_DIFFUSE, BufferFactory.floatBuffer(new float[] { View.light1_Colour_r[0], View.light1_Colour_g[0], View.light1_Colour_b[0], 1f })); GL11.glLightfv(GL11.GL_LIGHT0, GL11.GL_SPECULAR, BufferFactory.floatBuffer(new float[] { View.light1_specular_Colour_r[0], View.light1_specular_Colour_g[0], View.light1_specular_Colour_b[0], 1f })); GL11.glLightf(GL11.GL_LIGHT0, GL11.GL_LINEAR_ATTENUATION, .001f); GL11.glLightfv(GL11.GL_LIGHT1, GL11.GL_DIFFUSE, BufferFactory.floatBuffer(new float[] { View.light2_Colour_r[0], View.light2_Colour_g[0], View.light2_Colour_b[0], 1f })); GL11.glLightfv(GL11.GL_LIGHT1, GL11.GL_SPECULAR, BufferFactory.floatBuffer(new float[] { View.light2_specular_Colour_r[0], View.light2_specular_Colour_g[0], View.light2_specular_Colour_b[0], 1f })); GL11.glLightf(GL11.GL_LIGHT1, GL11.GL_LINEAR_ATTENUATION, .001f); GL11.glLightfv(GL11.GL_LIGHT2, GL11.GL_DIFFUSE, BufferFactory.floatBuffer(new float[] { View.light3_Colour_r[0], View.light3_Colour_g[0], View.light3_Colour_b[0], 1f })); GL11.glLightfv(GL11.GL_LIGHT2, GL11.GL_SPECULAR, BufferFactory.floatBuffer(new float[] { View.light3_specular_Colour_r[0], View.light3_specular_Colour_g[0], View.light3_specular_Colour_b[0], 1f })); GL11.glLightf(GL11.GL_LIGHT2, GL11.GL_LINEAR_ATTENUATION, .001f); GL11.glLightfv(GL11.GL_LIGHT3, GL11.GL_DIFFUSE, BufferFactory.floatBuffer(new float[] { View.light4_Colour_r[0], View.light4_Colour_g[0], View.light4_Colour_b[0], 1f })); GL11.glLightfv(GL11.GL_LIGHT3, GL11.GL_SPECULAR, BufferFactory.floatBuffer(new float[] { View.light4_specular_Colour_r[0], View.light4_specular_Colour_g[0], View.light4_specular_Colour_b[0], 1f })); GL11.glLightf(GL11.GL_LIGHT3, GL11.GL_LINEAR_ATTENUATION, .001f); GL11.glEnable(GL11.GL_COLOR_MATERIAL); GL11.glColorMaterial(GL11.GL_FRONT, GL11.GL_AMBIENT_AND_DIFFUSE); GL11.glMaterialfv(GL11.GL_FRONT, GL11.GL_SPECULAR, BufferFactory.floatBuffer(new float[] { 1.0f, 1.0f, 1.0f, 1.0f })); GL11.glMaterialf(GL11.GL_FRONT, GL11.GL_SHININESS, 128f); GL11.glEnableClientState(GL11.GL_VERTEX_ARRAY); if (fsGlossId == -1) { vsGlossId = loadGlossVertexShader(); fsGlossId = loadGlossFragmentShader(); if (pGlossId == -1 && vsGlossId != -1 && fsGlossId != -1) { pGlossId = GL20.glCreateProgram(); GL20.glAttachShader(pGlossId, vsGlossId); GL20.glAttachShader(pGlossId, fsGlossId); GL20.glLinkProgram(pGlossId); GL20.glValidateProgram(pGlossId); baseImageLoc = GL20.glGetUniformLocation(pGlossId, "colorMap"); //$NON-NLS-1$ glossMapLoc = GL20.glGetUniformLocation(pGlossId, "glossMap"); //$NON-NLS-1$ cubeMapLoc = GL20.glGetUniformLocation(pGlossId, "cubeMap"); //$NON-NLS-1$ cubeMapMatteLoc = GL20.glGetUniformLocation(pGlossId, "cubeMapMatte"); //$NON-NLS-1$ cubeMapMetalLoc = GL20.glGetUniformLocation(pGlossId, "cubeMapMetal"); //$NON-NLS-1$ alphaSwitchLoc = GL20.glGetUniformLocation(pGlossId, "alphaSwitch"); //$NON-NLS-1$ normalSwitchLoc = GL20.glGetUniformLocation(pGlossId, "normalSwitch"); //$NON-NLS-1$ noTextureSwitch = GL20.glGetUniformLocation(pGlossId, "noTextureSwitch"); //$NON-NLS-1$ noGlossMapSwitch = GL20.glGetUniformLocation(pGlossId, "noGlossMapSwitch"); //$NON-NLS-1$ cubeMapSwitch = GL20.glGetUniformLocation(pGlossId, "cubeMapSwitch"); //$NON-NLS-1$ noLightSwitch = GL20.glGetUniformLocation(pGlossId, "noLightSwitch"); //$NON-NLS-1$ } } }
Example 6
Source File: LWJGL20DrawContext.java From settlers-remake with MIT License | 4 votes |
private ShaderProgram(String name) { int vertexShader = -1; int fragmentShader; String vname = name; if(name.contains("-")) vname = name.split("-")[0]; try { vertexShader = createShader(vname+".vert", GL20.GL_VERTEX_SHADER); fragmentShader = createShader(name+".frag", GL20.GL_FRAGMENT_SHADER); } catch (IOException e) { e.printStackTrace(); if(vertexShader != -1) GL20.glDeleteShader(vertexShader); throw new Error("could not read shader files", e); } program = GL20.glCreateProgram(); setObjectLabel(KHRDebug.GL_PROGRAM, program, name); GL20.glAttachShader(program, vertexShader); GL20.glAttachShader(program, fragmentShader); GL20.glBindAttribLocation(program, 0, "vertex"); GL20.glBindAttribLocation(program, 1, "texcoord"); GL20.glBindAttribLocation(program, 2, "color"); GL20.glLinkProgram(program); GL20.glValidateProgram(program); GL20.glDetachShader(program, vertexShader); GL20.glDetachShader(program, fragmentShader); GL20.glDeleteShader(vertexShader); GL20.glDeleteShader(fragmentShader); String log = GL20.glGetProgramInfoLog(program); if(debugOutput != null && !log.isEmpty()) System.out.print("info log of " + name + "=====\n" + log + "==== end\n"); if(GL20.glGetProgrami(program, GL20.GL_LINK_STATUS) == 0) { GL20.glDeleteProgram(program); throw new Error("Could not link " + name); } for(int i = 0;i != ufs.length;i++) { int uf = GL20.glGetUniformLocation(program, uniform_names[i]); ufs[i] = uf; } shaders.add(this); }
Example 7
Source File: ShaderHelper.java From OpenModsLib with MIT License | 4 votes |
@Override public void glValidateProgram(int program) { GL20.glValidateProgram(program); }