made pom work with linux and fixed some file stuff for shaders

This commit is contained in:
0x01FE committed 2024-09-23 11:34:35 -05:00
1 parent 71f51f41f2
commit 82a654f9fa
3 files changed
+52 -15

No files matched your search

+14 -2
View File
@@ -35,10 +35,14 @@ public class Entity
model.getTexCoords().size(),
model.getObjects().size()));
} catch (Exception e) {
System.out.println("ERROR Parsing obj");
e.printStackTrace();
System.exit(1);
}
vaoId = 0;
vboId = 0;
// Load Shaders
try {
this.shader = new ShaderProgram();
@@ -48,7 +52,7 @@ public class Entity
}
try {
String vertex_shader_code = new Scanner(new File(vertex_shader_path)).useDelimiter("\\Z").next();
String vertex_shader_code = new Scanner(this.getClass().getResourceAsStream(vertex_shader_path)).useDelimiter("\\Z").next();
this.shader.createVertexShader(vertex_shader_code);
} catch (Exception e) {
System.out.println("ERROR Initializing the vertex shader");
@@ -56,7 +60,7 @@ public class Entity
}
try {
String fragment_shader_code = new Scanner(new File(fragment_shader_path)).useDelimiter("\\Z").next();
String fragment_shader_code = new Scanner(this.getClass().getResourceAsStream(fragment_shader_path)).useDelimiter("\\Z").next();
this.shader.createFragmentShader(fragment_shader_code);
} catch (Exception e)
{
@@ -64,4 +68,12 @@ public class Entity
e.printStackTrace();
}
}
public int getVaoId() {
return vaoId;
}
public int getVboId() {
return vboId;
}
}
+1 -1
View File
@@ -100,7 +100,7 @@ public class Game
glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
// Add stuff to world
world.addEntity(new Entity("/obs/cube.obj", "/shaders/shader.fraq", "/shaders/shader.vert"));
world.addEntity(new Entity("/objs/cube.obj", "/shaders/shader.frag", "/shaders/shader.vert"));
// Main loop or something
while ( !glfwWindowShouldClose(window) )