Unsure why code isn't working

Started by gravysauce, October 01, 2021, 03:11:30

Previous topic - Next topic

gravysauce

Hello, I am an individual who is still new to Java, and I've been following a tutorial series on LWJGL 2 by ThinMatrix on Youtube. If anyone still knows how LWJGL 2 works, it would be very nice if you could tell my why this code does not work:

public class MainGameLoop {
   
   public static void main (String[] args) {
      
      DisplayManager.createDisplay();
      
      ModelLoader modelLoad = new ModelLoader();
      ModelRenderer modelRender = new ModelRenderer();
      
      StaticShader shader = new StaticShader();
      
      float[] vertices = {
            
            0.6f, 0.8f, 0f, // 0
            -0.6f, 0.8f, 0f, // 1
            -0.6f, -0.8f, 0f, // 2
            0.6f, -0.8f, 0f //3
            
      };
      
      int[] indices = {
            
            0,1,2,
            0,2,3
            
      };

      float[] textureCoords = {
            
            1,0,
            0,0,
            0,1,
            1,1
            
      };
      
      Model model = modelLoad.loadToVAO(vertices, textureCoords, indices);
      
      TexturedModel texturedModel = new TexturedModel(model, new ModelTexture(modelLoad.loadTexture("default_texture")));
      
      Entity entity = new Entity(texturedModel, new Vector3f(-1,0,0),0,0,0,1);
      
      while (!Display.isCloseRequested()) {
         
         entity.increasePosition(0.002f, 0, 0);
         entity.increaseRotation(0, 1, 0);
         
         modelRender.prepare();
         shader.start();
         
         modelRender.render(entity, shader);
         
         shader.stop();
         
         DisplayManager.updateDisplay();
         
      }
      
      shader.cleanUp();
      modelLoad.cleanUp();
      DisplayManager.closeDisplay();
      
   }

}

None of my classes have errors, and it has worked up until now. I modified some code in this class specifically (I can't remember what though) and it didn't work so I reverted it however it still didn't work... The problem is that my quad does not render (just the background, with no errors in the console either). I did manage to get it to move and everything, but I must've done something wrong because it just stopped working out of nowhere even when changing back. If you need me to show the code from the other classes, I will. Again, sorry I'm using LWJGL 2 not 3 but the series is really good so I can't really help it.