1
0
Fork 0

Update Commit

This commit is contained in:
Florian Richer (MrDev023) 2016-01-01 22:01:55 +01:00
parent fa79114e3e
commit ce933acda6
6 changed files with 101 additions and 1 deletions

Binary file not shown.

View file

@ -6,6 +6,7 @@ import static org.lwjgl.opengl.GL11.*;
public class DisplayManager {
public static void clear(){
glClearColor(1,1,1,1);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
}

View file

@ -0,0 +1,89 @@
package mrdev023.opengl;
import static org.lwjgl.opengl.GL15.*;
import static org.lwjgl.opengl.GL11.*;
import static org.lwjgl.opengl.GL30.*;
import java.nio.*;
import org.lwjgl.*;
public class VAO {
public int vao,vertexBuffer,colorBuffer,texBuffer;
public VAO(){
vao = glGenVertexArrays();
vertexBuffer = glGenBuffers();
colorBuffer = glGenBuffers();
texBuffer = glGenBuffers();
}
public void setVertexBuffer(float... a){
FloatBuffer buffer = BufferUtils.createFloatBuffer(8);
for(float c : a)buffer.put(c);
buffer.flip();
glBindVertexArray(vao);
glBindBuffer(GL_ARRAY_BUFFER,vertexBuffer);
glBufferData(GL_ARRAY_BUFFER,buffer,GL_STATIC_DRAW);
glBindBuffer(GL_ARRAY_BUFFER,0);
glBindVertexArray(0);
}
public void setColorBuffer(float... a){
FloatBuffer buffer = BufferUtils.createFloatBuffer(16);
for(float c : a)buffer.put(c);
buffer.flip();
glBindVertexArray(vao);
glBindBuffer(GL_ARRAY_BUFFER,colorBuffer);
glBufferData(GL_ARRAY_BUFFER,buffer,GL_STATIC_DRAW);
glBindBuffer(GL_ARRAY_BUFFER,0);
glBindVertexArray(0);
}
public void setTexBuffer(float... a){
FloatBuffer buffer = BufferUtils.createFloatBuffer(8);
for(float c : a)buffer.put(c);
buffer.flip();
glBindVertexArray(vao);
glBindBuffer(GL_ARRAY_BUFFER,texBuffer);
glBufferData(GL_ARRAY_BUFFER,buffer,GL_STATIC_DRAW);
glBindBuffer(GL_ARRAY_BUFFER,0);
glBindVertexArray(0);
}
public void render(){
glBindVertexArray(vao);
glBindBuffer(GL_ARRAY_BUFFER,vertexBuffer);
glVertexPointer(2, GL_FLOAT, 8, 0);
glBindBuffer(GL_ARRAY_BUFFER,colorBuffer);
glColorPointer(4,GL_FLOAT,16,0);
glBindBuffer(GL_ARRAY_BUFFER,texBuffer);
glTexCoordPointer(2,GL_FLOAT,8,0);
glDrawArrays(GL_QUADS,0,4);
glBindBuffer(GL_ARRAY_BUFFER,0);
glBindVertexArray(0);
}
public void destroy(){
glDeleteBuffers(vertexBuffer);
glDeleteBuffers(colorBuffer);
glDeleteBuffers(texBuffer);
glDeleteVertexArrays(vao);
}
}

View file

@ -0,0 +1,5 @@
package mrdev023.opengl.gui;
public class Button extends GUIComponent{
}

View file

@ -0,0 +1,5 @@
package mrdev023.opengl.gui;
public abstract class GUIComponent {
}

View file

@ -2,7 +2,7 @@ package mrdev023.opengl.gui;
import mrdev023.opengl.*;
public class Message {
public class Message{
public static final int TIME_OUT = 5000;
private long current, previous, time = 0;