Advertisement
Guest User

error

a guest
Jun 18th, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.59 KB | None | 0 0
  1. protected int createShader(String shaderCode, int shaderType) throws Exception {
  2.        
  3.         int shaderId = glCreateShader(shaderType);
  4.        
  5.         glShaderSource(shaderId, shaderCode);
  6.         glCompileShader(shaderId);
  7.         glAttachShader(programId, shaderId);
  8.        
  9.         if (glGetShaderi(shaderId, GL_COMPILE_STATUS) == 0) {
  10.            
  11.             throw new Exception("Error compiling Shader code: " + glGetShaderInfoLog(shaderId, 1024));
  12.            
  13.         }
  14.        
  15.        
  16.         if (shaderId == 0) {
  17.            
  18.             throw new Exception("Error creating shader. Type: " + shaderType);
  19.            
  20.         }
  21.        
  22.         return shaderId;
  23.        
  24.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement