Skip to content

Instantly share code, notes, and snippets.

@ra4king
Created August 10, 2012 05:51
Show Gist options
  • Save ra4king/3311471 to your computer and use it in GitHub Desktop.
Save ra4king/3311471 to your computer and use it in GitHub Desktop.
public void readShader(String filePath, int shaderType)
{
try(BufferedReader reader = new BufferedReader(new InputStreamReader(getClass().getResourceAsStream(vShaderPath))))
{
StringBuilder str = new StringBuilder();
String line;
while ((line = reader.readLine()) != null)
{
str.append(line).append("\n");
}
if(shaderType == GL_VERTEX_SHADER)
vShader = str.toString();
if(shaderType == GL_FRAGMENT_SHADER)
fShader = str.toString();
}
catch (Exception e)
{
e.printStackTrace();
throw new RuntimeException("Failure to load vertex shader", e);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment