Java Code Examples for org.lwjgl.opengl.GL20#glGetProgramInfoLog()
The following examples show how to use
org.lwjgl.opengl.GL20#glGetProgramInfoLog() .
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: GenericShader.java From LWJGUI with MIT License | 6 votes |
protected static int createProgram(int vertexShaderId, int[] fragmentShaderIds, String[] attrs, int[] indices) { // build the shader program int id = GL20.glCreateProgram(); GL20.glAttachShader(id, vertexShaderId); for (int fragmentShaderId : fragmentShaderIds) { GL20.glAttachShader(id, fragmentShaderId); } assert (attrs.length == indices.length); for (int i=0; i<attrs.length; i++) { GL20.glBindAttribLocation(id, indices[i], attrs[i]); } GL20.glLinkProgram(id); boolean isSuccess = GL20.glGetProgrami(id, GL20.GL_LINK_STATUS) == GL11.GL_TRUE; if (!isSuccess) { throw new RuntimeException("Shader program did not link:\n" + GL20.glGetProgramInfoLog(id, 4096)); } return id; }
Example 2
Source File: ShaderProgram.java From CodeChickenLib with GNU Lesser General Public License v2.1 | 6 votes |
/** * Binds this shader for use, Lazily allocates, links * and compiles all {@link ShaderObject}s. */ public void use() { if (bound) { throw new IllegalStateException("Already bound."); } if (programId == -1 || shaders.stream().anyMatch(ShaderObject::isDirty)) { shaders.forEach(ShaderObject::alloc); if (programId == -1) { programId = GL20.glCreateProgram(); if (programId == 0) { throw new IllegalStateException("Allocation of ShaderProgram has failed."); } shaders.forEach(shader -> GL20.glAttachShader(programId, shader.getShaderID())); } GL20.glLinkProgram(programId); if (GL20.glGetProgrami(programId, GL20.GL_LINK_STATUS) == GL11.GL_FALSE) { throw new RuntimeException("ShaderProgram linkage failure. \n" + GL20.glGetProgramInfoLog(programId)); } shaders.forEach(shader -> shader.onLink(programId)); uniformCache.onLink(); } GL20.glUseProgram(programId); bound = true; }
Example 3
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 4
Source File: ShaderHelper.java From OpenModsLib with MIT License | 4 votes |
@Override public String getProgramLogInfo(int program) { return GL20.glGetProgramInfoLog(program, glGetProgrami(program, GL20.GL_INFO_LOG_LENGTH)); }