Skip to content

Commit 6c8dc0c

Browse files
Added buildProgram(GL, HashMap<GLShaderType, String>) method to GLProgram
1 parent 28292f1 commit 6c8dc0c

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

src/main/java/cleargl/GLProgram.java

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,16 @@ public static GLProgram buildProgram(final GL pGL,
8787
return lGLProgram;
8888
}
8989

90+
public static GLProgram buildProgram(final GL pGL,
91+
final HashMap<GLShaderType, String> shaders) throws IOException {
92+
final GLProgram lGLProgram = new GLProgram(pGL,
93+
shaderPipelineFromStrings(pGL, shaders));
94+
95+
lGLProgram.printProgramInfoLog();
96+
97+
return lGLProgram;
98+
}
99+
90100
public void recompileProgram(final GL pGL) {
91101

92102
final long start = System.nanoTime();
@@ -191,6 +201,23 @@ private static HashMap<GLShaderType, GLShader> shaderPipelineFromFilenames(final
191201
return pipeline;
192202
}
193203

204+
private static HashMap<GLShaderType, GLShader> shaderPipelineFromStrings(final GL pGL,
205+
final HashMap<GLShaderType, String> shaders) throws IOException {
206+
207+
final HashMap<GLShaderType, GLShader> pipeline = new HashMap<>();
208+
209+
for(final GLShaderType type: shaders.keySet()) {
210+
final GLShader shader = new GLShader(pGL,
211+
shaders.get(type),
212+
type);
213+
214+
System.out.println(shader.getShaderInfoLog());
215+
pipeline.put(type, shader);
216+
}
217+
218+
return pipeline;
219+
}
220+
194221
public GLProgram(final GLShader pVerteShader, final GLShader pFragmentShader) {
195222
super();
196223
mVertexShader = pVerteShader;

0 commit comments

Comments
 (0)