Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- System.out.println("Load Shader");
- char sep = File.separatorChar;
- this.spriteVertexShaderID = loadShader("res" + sep + "shader" + sep + "sprite_white_vs.glsl" , GL2.GL_VERTEX_SHADER, gl);
- this.spriteHueFragmentShaderID = loadShader("res" + sep + "shader" + sep + "sprite_white_fs.glsl", GL2.GL_FRAGMENT_SHADER, gl);
- this.spriteProgramID = gl.glCreateProgram();
- gl.glAttachShader(this.spriteProgramID, this.spriteVertexShaderID);
- gl.glAttachShader(this.spriteProgramID, this.spriteHueFragmentShaderID);
- gl.glLinkProgram(this.spriteProgramID);
- gl.glValidateProgram(this.spriteProgramID);
- System.out.println("Error after validation: "+gl.glGetError());
- ByteBuffer cbuffer = ByteBuffer.allocate(512);
- IntBuffer ibuffer = IntBuffer.allocate(16);
- gl.glGetProgramInfoLog(this.spriteProgramID, 512, ibuffer, cbuffer);
- int c = 0;
- boolean written = false;
- for(int i = 0 ; i < 16 ; i++){
- for(int j = ibuffer.get(i) ; j > 0 ; j--){
- char l = (char) cbuffer.get(c);
- c++;
- System.out.print(l);
- written = true;
- }
- if(written){
- System.out.println();
- written = false;
- }
- }
- gl.glGetProgramiv(this.spriteProgramID, GL2.GL_VALIDATE_STATUS, VBO_VAO_ID_BUFFER);
- System.out.println("Validate Status: " + VBO_VAO_ID_BUFFER.get(0));
- gl.glUseProgram(this.spriteProgramID);
- this.positionLoc = gl.glGetUniformLocation(spriteProgramID, "position");
- this.sizeLoc = gl.glGetUniformLocation(spriteProgramID, "size");
- this.colorLoc = gl.glGetUniformLocation(spriteProgramID, "color");
- System.out.println("Position Loc: " + this.positionLoc);
- System.out.println("Size Loc: " + this.sizeLoc);
- System.out.println("Color Loc: " + this.colorLoc);
- System.out.println("Error after getting Uniform Locations: "+ gl.glGetError());
- int vertexLoc = gl.glGetAttribLocation(this.spriteProgramID, "vertex");
- System.out.println("Vertex Loc: "+vertexLoc);
- System.out.println("Error after getting attrib location: "+ gl.glGetError());
- gl.glBindAttribLocation(this.spriteProgramID, 0, "vertex");
Advertisement
Add Comment
Please, Sign In to add comment