Java-Gaming.org Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (744)
Games in Android Showcase (225)
games submitted by our members
Games in WIP (825)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
   Home   Help   Search   Login   Register   
  Show Posts
Pages: [1] 2 3 4
1  Java Game APIs & Engines / OpenGL Development / Re: Models don't render properly on: 2017-04-02 19:11:28
Ah sorry I fixed the Problem Smiley The solution was that I apply Edge Split in Blender and now everything works fine and yes this is only temporary, I rewrite the OBJ Loader and yes I understand the Wavefront OBJ Format very well Smiley
2  Java Game APIs & Engines / OpenGL Development / Re: Models don't render properly on: 2017-04-02 19:02:15
So what could I do do solve this Problem, because I use this Code from ThinMatrix Tutorials and for him the Loader works.Or is there an option in Blender for this ?
3  Java Game APIs & Engines / OpenGL Development / Re: Models don't render properly on: 2017-04-02 18:05:38
Yeah I thought about that too but what could be wrong ? :/
4  Java Game APIs & Engines / OpenGL Development / Models don't render properly on: 2017-04-02 16:14:25
Hey Guys,
I wrote an OBJ Loader for my Engine but my Models look very weird.I export the models with the following options but they look not the same like in Blender :/

Export Settings:


Engine Look:


OBJ Loader Code:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
82  
83  
84  
85  
86  
87  
88  
89  
90  
91  
92  
public class OBJLoader {

   public static RawModel loadObjModel(String fileName, ModelLoader loader) {
      FileReader fr = null;
      try {
         fr = new FileReader(new File("maps/testMap/" + fileName + ".obj"));
      } catch (FileNotFoundException e) {
         System.out.println("Couldn't load file!");
         e.printStackTrace();
      }
      BufferedReader reader = new BufferedReader(fr);
      String line;
      List<Vector3f> vertices = new ArrayList<Vector3f>();
      List<Vector2f> textures = new ArrayList<Vector2f>();
      List<Vector3f> normals = new ArrayList<Vector3f>();
      List<Integer> indices = new ArrayList<Integer>();
      float[] verticesArray = null;
      float[] normalsArray = null;
      float[] textureArray = null;
      int[] indicesArray = null;
      try {

         while (true) {
            line = reader.readLine();
            String[] currentLine = line.split(" ");
            if (line.startsWith("v ")) {
               Vector3f vertex = new Vector3f(Float.parseFloat(currentLine[1]), Float.parseFloat(currentLine[2]), Float.parseFloat(currentLine[3]));
               vertices.add(vertex);
            } else if (line.startsWith("vt ")) {
               Vector2f texture = new Vector2f(Float.parseFloat(currentLine[1]), Float.parseFloat(currentLine[2]));
               textures.add(texture);
            } else if (line.startsWith("vn ")) {
               Vector3f normal = new Vector3f(Float.parseFloat(currentLine[1]), Float.parseFloat(currentLine[2]), Float.parseFloat(currentLine[3]));
               normals.add(normal);
            } else if (line.startsWith("f ")) {
               textureArray = new float[vertices.size() * 2];
               normalsArray = new float[vertices.size() * 3];
               break;
            }
         }

         while (line != null) {
            if (!line.startsWith("f ")) {
               line = reader.readLine();
               continue;
            }
            String[] currentLine = line.split(" ");
            String[] vertex1 = currentLine[1].split("/");
            String[] vertex2 = currentLine[2].split("/");
            String[] vertex3 = currentLine[3].split("/");

            processVertex(vertex1, indices, textures, normals, textureArray, normalsArray);
            processVertex(vertex2, indices, textures, normals, textureArray, normalsArray);
            processVertex(vertex3, indices, textures, normals, textureArray, normalsArray);
            line = reader.readLine();
         }
         reader.close();

      } catch (Exception e) {
         e.printStackTrace();
      }

      verticesArray = new float[vertices.size() * 3];
      indicesArray = new int[indices.size()];

      int vertexPointer = 0;
      for (Vector3f vertex : vertices) {
         verticesArray[vertexPointer++] = vertex.x;
         verticesArray[vertexPointer++] = vertex.y;
         verticesArray[vertexPointer++] = vertex.z;
      }

      for (int i = 0; i < indices.size(); i++) {
         indicesArray[i] = indices.get(i);
      }
      return loader.loadToVAO(verticesArray, textureArray, indicesArray);

   }

   private static void processVertex(String[] vertexData, List<Integer> indices, List<Vector2f> textures, List<Vector3f> normals, float[] textureArray, float[] normalsArray) {
      int currentVertexPointer = Integer.parseInt(vertexData[0]) - 1;
      indices.add(currentVertexPointer);
      Vector2f currentTex = textures.get(Integer.parseInt(vertexData[1]) - 1);
      textureArray[currentVertexPointer * 2] = currentTex.x;
      textureArray[currentVertexPointer * 2 + 1] = 1 - currentTex.y;
      Vector3f currentNorm = normals.get(Integer.parseInt(vertexData[2]) - 1);
      normalsArray[currentVertexPointer * 3] = currentNorm.x;
      normalsArray[currentVertexPointer * 3 + 1] = currentNorm.y;
      normalsArray[currentVertexPointer * 3 + 2] = currentNorm.z;
   }

}
5  Game Development / Game Mechanics / Re: Level Loading strategy on: 2017-03-29 13:08:52
Yeah I want to keep it simple as possible because I want to understand my Code too.So I want to write some simple code for Levels specially for FPS Games or Racing Games but Racing are another thing Smiley So Should I start with the VMF Page from Valve or where should I start and implementing in my code ? Smiley
6  Game Development / Game Mechanics / Re: Level Loading strategy on: 2017-03-27 20:20:17
So I can use this map Editor to Design a map then save it as a VMF-File and read it in my Engine and render the designed Level ? Smiley
7  Game Development / Game Mechanics / Re: Level Loading strategy on: 2017-03-27 17:26:10
Okay I read the Document from Valve but I don't understand it that much.Are there Entries like these for every model in the Level with its path and position ?

1  
2  
3  
4  
5  
6  
7  
8  
//text
model {
    id 13
    file "unit/soldier.md5"
    pos {
       0.0, 1.2, 1.992
    }
}


EDIT: And are there any Level editors for this format or should I just use Notepad++ ? Smiley
8  Game Development / Game Mechanics / Re: Level Loading strategy on: 2017-03-27 14:34:45
What if I use the BSP format and edit it with something like Blender and write everything into a XML-File ? Smiley
9  Game Development / Game Mechanics / Re: Level Loading strategy on: 2017-03-26 10:26:34
At the moment I just load an image read every pixel and I have defined RGB colors in the image and when I have some defined color I put the defined Mesh at the place for it.Just so:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
public boolean loadLevel(String path)
   {
      BufferedImage img = null;
     
      try {
         img = ImageIO.read(Level.class.getResourceAsStream(path));
      } catch (IOException e) {
         e.printStackTrace();
      }
     
      this.w = img.getWidth();
      this.d = img.getHeight();
     
      for(int i = 0; i < img.getWidth(); i++) {
         for(int j = 0; j < img.getHeight(); j++) {
            Color c = new Color(img.getRGB(i, j));
           
            if(c.getRed() == 255 && c.getGreen() == 255 && c.getBlue() == 255)
            {
               entities.add(new Entity(texturedModel, new Vector3f(i, -2, -j), 0, 0, 0, 1));
               entities.add(new Entity(texturedModel, new Vector3f(i, 2, -j), 0, 0, 0, 1));
            }
           
            if(c.getRed() == 85 && c.getGreen() == 85 && c.getBlue() == 85)
            {
               entities.add(new Entity(texturedModel, new Vector3f(i, -2, -j), 0, 0, 0, 1));
               entities.add(new Entity(texturedModel, new Vector3f(i, -1, -j), 0, 0, 0, 1));
               entities.add(new Entity(texturedModel, new Vector3f(i, 0, -j), 0, 0, 0, 1));
               entities.add(new Entity(texturedModel, new Vector3f(i, 1, -j), 0, 0, 0, 1));
               entities.add(new Entity(texturedModel, new Vector3f(i, 2, -j), 0, 0, 0, 1));
            }
           
            if(c.getRed() == 255 && c.getGreen() == 0 && c.getBlue() == 0)
            {
               entities.add(new Entity(texturedModel, new Vector3f(i, -2, -j), 0, 0, 0, 1));
               entities.add(new Entity(texturedModel, new Vector3f(i, 2, -j), 0, 0, 0, 1));
            }
         }
      }
     
      return true;
   }


I don't understand your method that much but I want to build Levels like you in your FPS Engine for example Smiley
10  Game Development / Game Mechanics / Level Loading strategy on: 2017-03-22 00:30:05
Hello Guys,
Im working on a Game and I want to ask you if somebody know a good technique for loading Levels which is fast and is good for Levels like Archive used it in his 3D Engine with BSP trees Smiley
11  Games Center / WIP games, tools & toy projects / Re: FFP Software Rendered Graphics Engine on: 2017-03-11 08:36:01
Oh okay thanks I will try this OBJ Loader and try to build some Scenes with the Engine and also try to draw some Text out and some other things Smiley
12  Games Center / WIP games, tools & toy projects / Re: FFP Software Rendered Graphics Engine on: 2017-03-10 21:46:44
Okay then I must try to roll my own OBJ Loader and with the not available OpenGL 3.3, I dont know that Cheesy
13  Games Center / WIP games, tools & toy projects / Re: FFP Software Rendered Graphics Engine on: 2017-03-10 20:40:55
I tried out your Engine with the ffpVertex3f Calls so the Immidiate Mode and its very slow and I have low FPS.I have some Questions to your Engine:
1. How can I load OBJ Models ?
2. How can I use OpenGL 3 Functions like glDrawArrays or something ?

But the Engine is very easy to use and when I work longer with it, I think it would be good so build some Games Smiley
14  Games Center / WIP games, tools & toy projects / Re: FFP Software Rendered Graphics Engine on: 2017-03-10 12:55:37
Oh Okay I will try the method with ASCII but are there any tutorials or Introductions for the BSP trees ? Smiley
15  Games Center / WIP games, tools & toy projects / Re: FFP Software Rendered Graphics Engine on: 2017-03-09 21:48:27
Oh Okay because I want to start coding with the Engine again today and I was confused why it was down and I delete the old Engine accidentally Smiley

EDIT: I want to code a simple FPS Level with this Engine could you help me with the Level Loading because you have already a working example Smiley
16  Games Center / WIP games, tools & toy projects / Re: FFP Software Rendered Graphics Engine on: 2017-03-09 18:12:26
Could you reupload the Engine again ? Smiley
17  Games Center / WIP games, tools & toy projects / Re: FFP Software Rendered Graphics Engine on: 2017-02-27 08:46:35
I will try to build some examples later with the Engine and try to unterstand how it Works Smiley
18  Games Center / WIP games, tools & toy projects / Re: FFP Software Rendered - GFX/Game Progress on: 2017-02-21 22:29:00
Sounds interesting and I'm excited to build some 3D examples with the FFP Engine! Smiley
19  Games Center / WIP games, tools & toy projects / Re: FFP Software Rendered - GFX/Game Progress on: 2017-02-15 18:18:42
It looks very nice Smiley But can we use this Engine and create Test Programs with it or how we can we use it ? Cheesy
20  Game Development / Newbie & Debugging Questions / Re: How to learn openGL? on: 2017-02-08 22:24:39
I agree to Orange, Thinmatrix make the best Tutorials with the modern Pipeline but you can watch the Flappy Bird Tutorial from TheCherno he explained it also very good Smiley

EDIT: By the way we can also exchange some Information because I'm currently learning LWJGL too and write a Game Engine I could help you a little bit Smiley
21  Game Development / Newbie & Debugging Questions / Re: Load a GMMOD File on: 2017-02-02 17:33:21
Thanks I will try it out Orange451 Smiley
But first I tried out to model it with Game Maker Model Creator export it as .obj then load it with blender and export it as .obj again with the given Settings from ThinMatrix because I use his OBJ Loader.Now I get an Exception Sad

1  
2  
3  
4  
5  
6  
7  
8  
9  
java.lang.NumberFormatException: For input string: ""
   at java.lang.NumberFormatException.forInputString(Unknown Source)
   at java.lang.Integer.parseInt(Unknown Source)
   at java.lang.Integer.parseInt(Unknown Source)
   at engine.rendering.OBJLoader.processVertex(OBJLoader.java:90)
   at engine.rendering.OBJLoader.loadObjModel(OBJLoader.java:59)
   at Game.engineTester.init(engineTester.java:50)
   at Game.engineTester.run(engineTester.java:60)
   at java.lang.Thread.run(Unknown Source)


OBJ Loader:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
82  
83  
84  
85  
86  
87  
88  
89  
90  
91  
public class OBJLoader {

   public static VBOModel loadObjModel(String fileName, ModelLoader loader) {
      FileReader fr = null;
      try {
         fr = new FileReader(new File("res/Models/" + fileName + ".obj"));
      } catch (FileNotFoundException e) {
         System.err.println("Couldn't load file!");
         e.printStackTrace();
      }
      BufferedReader reader = new BufferedReader(fr);
      String line;
      List<Vector3f> vertices = new ArrayList<Vector3f>();
      List<Vector2f> textures = new ArrayList<Vector2f>();
      List<Vector3f> normals = new ArrayList<Vector3f>();
      List<Integer> indices = new ArrayList<Integer>();
      float[] verticesArray = null;
      float[] normalsArray = null;
      float[] textureArray = null;
      int[] indicesArray = null;
      try {

         while (true) {
            line = reader.readLine();
            String[] currentLine = line.split(" ");
            if (line.startsWith("v ")) {
               Vector3f vertex = new Vector3f(Float.parseFloat(currentLine[1]), Float.parseFloat(currentLine[2]), Float.parseFloat(currentLine[3]));
               vertices.add(vertex);
            } else if (line.startsWith("vt ")) {
               Vector2f texture = new Vector2f(Float.parseFloat(currentLine[1]), Float.parseFloat(currentLine[2]));
               textures.add(texture);
            } else if (line.startsWith("vn ")) {
               Vector3f normal = new Vector3f(Float.parseFloat(currentLine[1]), Float.parseFloat(currentLine[2]), Float.parseFloat(currentLine[3]));
               normals.add(normal);
            } else if (line.startsWith("f ")) {
               textureArray = new float[vertices.size() * 2];
               normalsArray = new float[vertices.size() * 3];
               break;
            }
         }

         while (line != null) {
            if (!line.startsWith("f ")) {
               line = reader.readLine();
               continue;
            }
            String[] currentLine = line.split(" ");
            String[] vertex1 = currentLine[1].split("/");
            String[] vertex2 = currentLine[2].split("/");
            String[] vertex3 = currentLine[3].split("/");

            processVertex(vertex1, indices, textures, normals, textureArray, normalsArray);
            processVertex(vertex2, indices, textures, normals, textureArray, normalsArray);
            processVertex(vertex3, indices, textures, normals, textureArray, normalsArray);
            line = reader.readLine();
         }
         reader.close();

      } catch (Exception e) {
         e.printStackTrace();
      }

      verticesArray = new float[vertices.size() * 3];
      indicesArray = new int[indices.size()];

      int vertexPointer = 0;
      for (Vector3f vertex : vertices) {
         verticesArray[vertexPointer++] = vertex.x1;
         verticesArray[vertexPointer++] = vertex.x2;
         verticesArray[vertexPointer++] = vertex.x3;
      }

      for (int i = 0; i < indices.size(); i++) {
         indicesArray[i] = indices.get(i);
      }
      return loader.loadToVAO(verticesArray, indicesArray, textureArray);

   }

   private static void processVertex(String[] vertexData, List<Integer> indices, List<Vector2f> textures, List<Vector3f> normals, float[] textureArray, float[] normalsArray) {
      int currentVertexPointer = Integer.parseInt(vertexData[0]) - 1;
      indices.add(currentVertexPointer);
      Vector2f currentTex = textures.get(Integer.parseInt(vertexData[1]) - 1);
      textureArray[currentVertexPointer * 2] = currentTex.x1;
      textureArray[currentVertexPointer * 2 + 1] = 1 - currentTex.x2;
      Vector3f currentNorm = normals.get(Integer.parseInt(vertexData[2]) - 1);
      normalsArray[currentVertexPointer * 3] = currentNorm.x1;
      normalsArray[currentVertexPointer * 3 + 1] = currentNorm.x2;
      normalsArray[currentVertexPointer * 3 + 2] = currentNorm.x3;
   }
}


EDIT: It worked I just forget to bind the Texture in Blender
22  Game Development / Newbie & Debugging Questions / Re: Load a GMMOD File on: 2017-02-02 16:37:14
I find this format because I searched on the Internet for an alternative because I don't like Blender that much.So I found the Game Maker Model Creator and I like the Design of it because this Program is very easy to use.So I want to implement a GMMOD Support in my 3D Engine Cheesy
I already tried to use the OBJ Export in Game Make Model Creator but always when I try to load a .obj exported from the Model Creator my Program gives an Error.
23  Game Development / Newbie & Debugging Questions / Load a GMMOD File on: 2017-02-02 13:45:22
Hey Guys,
How can I load an GMMOD File with LWJGL and render it the screen ? :/

24  Game Development / Articles & tutorials / Re: LWJGL 3D Game Engine Series [GERMAN] on: 2017-01-24 22:06:24
Oh Okay I will start a 3D LWJGL Tutorial Series in the Future because I also think this would be more effective Smiley

25  Game Development / Articles & tutorials / Re: LWJGL 3D Game Engine Series [GERMAN] on: 2017-01-24 21:56:07
Yeah I know that I want to start a LWJGL 3 Series too but currently there is not much people that view my Videos but I think about that.Are you German too or do you understand it Cheesy ?
26  Game Development / Articles & tutorials / LWJGL 3D Game Engine Series [GERMAN] on: 2017-01-24 21:06:25
Hey Guys,

I've started a new Tutorial Series about how to create a 3D Game Engine in Java with LWJGL on my Youtube Channel but it is in German.I Know in the forum are some german users so if they are interested in learning LWJGL please check it out Smiley

Channel: https://www.youtube.com/channel/UCAPTnrIto4ryQR6tlXcU_cg
First Video: https://www.youtube.com/watch?v=1wQjePxhNVw
27  Games Center / WIP games, tools & toy projects / Re: First Recon - Small Online First Person Shooter on: 2017-01-16 11:58:09
Thank you that solved the Problem Smiley
28  Games Center / WIP games, tools & toy projects / Re: First Recon - Small Online First Person Shooter on: 2017-01-15 18:00:45
Could anyone download it ? Smiley
29  Games Center / WIP games, tools & toy projects / Re: First Recon - Small Online First Person Shooter on: 2017-01-14 21:14:59
I can't test the Game because my PC don't download it.The Download always abort Sad

EDIT: Any Answer from the Author of the Thread ?
30  Games Center / WIP games, tools & toy projects / Re: Ot - 3D voxel engine on: 2017-01-02 11:36:02
Looks cool and I'm interested how it will change in the Future Smiley
Pages: [1] 2 3 4
 
Ecumene (148 views)
2017-09-30 02:57:34

theagentd (213 views)
2017-09-26 18:23:31

cybrmynd (298 views)
2017-08-02 12:28:51

cybrmynd (285 views)
2017-08-02 12:19:43

cybrmynd (295 views)
2017-08-02 12:18:09

Sralse (290 views)
2017-07-25 17:13:48

Archive (967 views)
2017-04-27 17:45:51

buddyBro (1093 views)
2017-04-05 03:38:00

CopyableCougar4 (1665 views)
2017-03-24 15:39:42

theagentd (1426 views)
2017-03-24 15:32:08
Java Gaming Resources
by philfrei
2017-12-05 19:38:37

Java Gaming Resources
by philfrei
2017-12-05 19:37:39

Java Gaming Resources
by philfrei
2017-12-05 19:36:10

Java Gaming Resources
by philfrei
2017-12-05 19:33:10

List of Learning Resources
by elect
2017-03-13 14:05:44

List of Learning Resources
by elect
2017-03-13 14:04:45

SF/X Libraries
by philfrei
2017-03-02 08:45:19

SF/X Libraries
by philfrei
2017-03-02 08:44:05
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!