This commit is contained in:
@@ -30,6 +30,11 @@ public abstract class ShaderProgram implements Closeable {
|
||||
GL30.glUseProgram(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Load the shader program.
|
||||
* @param vertexSource the source code of the vertex shader.
|
||||
* @param fragmentSource the source code of the fragment shader.
|
||||
*/
|
||||
public void LoadProgram(String vertexSource, String fragmentSource) {
|
||||
this.vertexShaderId = LoadShader(vertexSource, GL30.GL_VERTEX_SHADER);
|
||||
this.fragmentShaderId = LoadShader(fragmentSource, GL30.GL_FRAGMENT_SHADER);
|
||||
@@ -47,6 +52,12 @@ public abstract class ShaderProgram implements Closeable {
|
||||
GetAllUniformLocation();
|
||||
}
|
||||
|
||||
/**
|
||||
* Load a shader from source code.
|
||||
* @param source
|
||||
* @param type
|
||||
* @return
|
||||
*/
|
||||
private int LoadShader(String source, int type) {
|
||||
int shaderId = GL30.glCreateShader(type);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user