diff --git a/resources/textures/testimg.png b/resources/textures/testimg.png deleted file mode 100644 index ffe963e..0000000 Binary files a/resources/textures/testimg.png and /dev/null differ diff --git a/resources/textures/thonk.png b/resources/textures/thonk.png new file mode 100644 index 0000000..a166634 Binary files /dev/null and b/resources/textures/thonk.png differ diff --git a/src/Test.java b/src/Test.java index 45cb36a..71cfeb3 100644 --- a/src/Test.java +++ b/src/Test.java @@ -24,7 +24,7 @@ public class Test { 0, 1, 2, 0, 2, 3 - }, new Material(new Texture("resources/textures/testimg.png"))); + }, new Material(new Texture("resources/textures/thonk.png"))); public void run() throws Exception { setup(); @@ -49,7 +49,7 @@ public class Test { display.create(); shader = new Shader("/resources/shaders/mainVertex.glsl", "/resources/shaders/mainFragment.glsl"); renderer = new Renderer(shader); - display.setBackgroundColor(1F, 0, 0); + display.setBackgroundColor(1F, 1F, 1F); mesh.create(); shader.create(); diff --git a/src/org/hl/engine/graphics/Vertex.java b/src/org/hl/engine/graphics/Vertex.java index 3270b27..99a58d7 100644 --- a/src/org/hl/engine/graphics/Vertex.java +++ b/src/org/hl/engine/graphics/Vertex.java @@ -10,9 +10,10 @@ public class Vertex { private Vector3f color; private Vector2f textureCoords; - public Vertex (Vector3f position, Vector3f color, Vector2f texture) { + public Vertex (Vector3f position, Vector3f color, Vector2f textureCoords) { this.position = position; this.color = color; + this.textureCoords = textureCoords; } public Vector3f getPosition() { diff --git a/src/org/hl/engine/io/Display.java b/src/org/hl/engine/io/Display.java index 47c94bc..5303606 100644 --- a/src/org/hl/engine/io/Display.java +++ b/src/org/hl/engine/io/Display.java @@ -1,5 +1,6 @@ package org.hl.engine.io; import org.hl.engine.math.lalg.Vector3f; +import org.lwjgl.glfw.GLFWErrorCallback; import org.lwjgl.glfw.GLFWVidMode; import org.lwjgl.glfw.GLFWWindowSizeCallback; import org.lwjgl.opengl.GL; @@ -96,6 +97,8 @@ public class Display { // Creates the window (should go in the init() function of your Main program) public void create() throws Exception { + GLFWErrorCallback.createPrint(System.err).set(); + // initializing glfw if (!glfwInit()) { //System.err.println("Failed to initialize GLFW! "); @@ -104,7 +107,7 @@ public class Display { } glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 4); - glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 6); + glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 1); glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL11.GL_TRUE); glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); @@ -190,6 +193,7 @@ public class Display { // Completely DESTROYS the window public void destroy() { resizeCallback.free(); + glfwSetErrorCallback(null).free(); glfwDestroyWindow(window); glfwTerminate(); } diff --git a/src/resources/shaders/mainFragment.glsl b/src/resources/shaders/mainFragment.glsl index 3f034ff..9ad7039 100644 --- a/src/resources/shaders/mainFragment.glsl +++ b/src/resources/shaders/mainFragment.glsl @@ -1,9 +1,9 @@ #version 410 core -in vec3 passColor; -in vec2 passTextureCoord; +layout(location = 0) in vec3 passColor; +layout(location = 1) in vec2 passTextureCoord; -out vec4 outColor; +layout(location = 0) out vec4 outColor; uniform sampler2D tex; diff --git a/src/resources/shaders/mainVertex.glsl b/src/resources/shaders/mainVertex.glsl index 172bf89..3544e06 100644 --- a/src/resources/shaders/mainVertex.glsl +++ b/src/resources/shaders/mainVertex.glsl @@ -1,11 +1,11 @@ #version 410 core -in vec3 position; -in vec3 color; -in vec2 textureCoord; +layout(location = 0) in vec3 position; +layout(location = 1) in vec3 color; +layout(location = 2) in vec2 textureCoord; -out vec3 passColor; -out vec2 passTextureCoord; +layout(location = 0) out vec3 passColor; +layout(location = 1) out vec2 passTextureCoord; void main() { gl_Position = vec4(position, 1.0); diff --git a/src/resources/textures/testimg.png b/src/resources/textures/testimg.png deleted file mode 100644 index ffe963e..0000000 Binary files a/src/resources/textures/testimg.png and /dev/null differ