made pom work with linux and fixed some file stuff for shaders
This commit is contained in:
1 parent
71f51f41f2
commit
82a654f9fa
3 files changed
+52
-15
No files matched your search
@@ -13,7 +13,6 @@
|
||||
<maven.compiler.target>22</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<lwjgl.version>3.3.4</lwjgl.version>
|
||||
<lwjgl.natives>natives-windows</lwjgl.natives>
|
||||
</properties>
|
||||
|
||||
<repositories>
|
||||
@@ -23,6 +22,34 @@
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>lwjgl-natives-linux-amd64</id>
|
||||
<activation>
|
||||
<os>
|
||||
<family>unix</family>
|
||||
<name>linux</name>
|
||||
<arch>amd64</arch>
|
||||
</os>
|
||||
</activation>
|
||||
<properties>
|
||||
<lwjgl.natives>natives-linux</lwjgl.natives>
|
||||
</properties>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>lwjgl-natives-windows-amd64</id>
|
||||
<activation>
|
||||
<os>
|
||||
<family>windows</family>
|
||||
<arch>amd64</arch>
|
||||
</os>
|
||||
</activation>
|
||||
<properties>
|
||||
<lwjgl.natives>natives-windows</lwjgl.natives>
|
||||
</properties>
|
||||
</profile>
|
||||
</profiles>
|
||||
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
@@ -36,8 +63,6 @@
|
||||
</dependencyManagement>
|
||||
|
||||
<dependencies>
|
||||
<!-- Bunch of Graphics stuff LWJGL -->
|
||||
|
||||
<dependency>
|
||||
<groupId>org.lwjgl</groupId>
|
||||
<artifactId>lwjgl</artifactId>
|
||||
@@ -162,10 +187,10 @@
|
||||
<groupId>org.lwjgl</groupId>
|
||||
<artifactId>lwjgl-opus</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.lwjgl</groupId>
|
||||
<artifactId>lwjgl-ovr</artifactId>
|
||||
</dependency>
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>org.lwjgl</groupId>-->
|
||||
<!-- <artifactId>lwjgl-ovr</artifactId>-->
|
||||
<!-- </dependency>-->
|
||||
<dependency>
|
||||
<groupId>org.lwjgl</groupId>
|
||||
<artifactId>lwjgl-par</artifactId>
|
||||
@@ -351,11 +376,11 @@
|
||||
<artifactId>lwjgl-opus</artifactId>
|
||||
<classifier>${lwjgl.natives}</classifier>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.lwjgl</groupId>
|
||||
<artifactId>lwjgl-ovr</artifactId>
|
||||
<classifier>${lwjgl.natives}</classifier>
|
||||
</dependency>
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>org.lwjgl</groupId>-->
|
||||
<!-- <artifactId>lwjgl-ovr</artifactId>-->
|
||||
<!-- <classifier>${lwjgl.natives}</classifier>-->
|
||||
<!-- </dependency>-->
|
||||
<dependency>
|
||||
<groupId>org.lwjgl</groupId>
|
||||
<artifactId>lwjgl-par</artifactId>
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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) )
|
||||
|
||||
Reference in new issue
Block a user