Ajout de classe primitive
This commit is contained in:
parent
e2b43446c8
commit
b5d18197ff
@ -40,8 +40,8 @@ public class Engine {
|
||||
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE); //Compatible MAC
|
||||
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); //Le core profile est l'interface 'avancé' d'openGL
|
||||
|
||||
int width = 1280;
|
||||
int height = 720;
|
||||
int width = 800;
|
||||
int height = 600;
|
||||
this.window = glfwCreateWindow(width, height, "Boulevard Combattant", NULL, NULL);
|
||||
assert this.window != NULL;
|
||||
|
||||
@ -63,8 +63,7 @@ public class Engine {
|
||||
glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
|
||||
System.out.println("OpenGL: " + glGetString(GL_VERSION));
|
||||
|
||||
|
||||
this.scene = new Scene();
|
||||
this.scene = new Scene("shaders/vert.vert", "shaders/frag.frag", Primitive.triangle);
|
||||
|
||||
}
|
||||
|
||||
|
11
src/engine/Primitive.java
Normal file
11
src/engine/Primitive.java
Normal file
@ -0,0 +1,11 @@
|
||||
package engine;
|
||||
|
||||
public class Primitive {
|
||||
|
||||
public static float[] triangle = new float[] {
|
||||
0.0f, 0.5f, 0.0f,
|
||||
0.5f, -0.5f, 0.0f,
|
||||
-0.5f, -0.5f, 0.0f,
|
||||
};
|
||||
|
||||
}
|
@ -7,13 +7,9 @@ public class Scene {
|
||||
VertexArray vertexArray;
|
||||
Shader shader;
|
||||
|
||||
public Scene(){
|
||||
this.vertices = new float[] {
|
||||
-0.5f, -0.5f, 0.0f, //left
|
||||
0.5f, -0.5f, 0.0f, //right
|
||||
0.0f, 0.5f, 0.0f //top
|
||||
};
|
||||
this.shader = new Shader("shaders/vert.vert", "shaders/frag.frag");
|
||||
public Scene(String vertPath, String fragPath, float[] vertices){
|
||||
this.vertices = vertices;
|
||||
this.shader = new Shader(vertPath, fragPath);
|
||||
this.vertexArray = new VertexArray(this.vertices);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user