Isometric tile rendering

Started by CodeWizz, June 12, 2022, 09:34:48

Previous topic - Next topic

CodeWizz

Hey everyone :)
I have been learning LWJGL & OpenGL. I'm trying to make an isometric game (See screenshots) But I can't get the rendering to work. I need my tiles to render from top to bottom and not from bottom to top so that the textures overlap. The tutorial series I was following said that they are rendered in the same order that they are added to the game, but this doesn't seem to be true. Can anyone help me get this rendering right?

(Screenshot as I want it: https://imgur.com/a/ZovUXYg This is from my old but slow engine)
(Screenshot as it is: https://imgur.com/a/OInJ4J0)

If you need any classes/code snippets, please ask!
Window setup:
GLFWErrorCallback.createPrint(System.err).set();
		
		// INIT GLFW
		if(!glfwInit()) {
			throw new IllegalStateException("Uh oh no GLFW init oops");
		}
		
		// CONFIGURE GLFW
		glfwDefaultWindowHints();
		glfwWindowHint(GLFW_VISIBLE, GLFW_FALSE);
		glfwWindowHint(GLFW_RESIZABLE, GLFW_TRUE);
		glfwWindowHint(GLFW_MAXIMIZED, GLFW_TRUE);
		
		// CREATE WINDOW
		glfwWindow = glfwCreateWindow(this.width, this.height, this.title, NULL, NULL);
		if(glfwWindow == NULL) {
			throw new IllegalStateException("WAVING THRU NO WINDOW");
		}
		
		glfwSetCursorPosCallback(glfwWindow, MouseListener::mousePosCallback);
		glfwSetMouseButtonCallback(glfwWindow, MouseListener::mouseButtonCallback);
		glfwSetScrollCallback(glfwWindow, MouseListener::mouseScrollCallback);
		glfwSetKeyCallback(glfwWindow, KeyListener::keyCallback);
		
		// MAKE OPENGL
		glfwMakeContextCurrent(glfwWindow);
		// ENABLE MAGIC V-SYNC
		glfwSwapInterval(1);
		
		// MAKE THE WINDOW VISIBLE
		glfwShowWindow(glfwWindow);
		
		// important?
		GL.createCapabilities();
		glEnable(GL_BLEND);
		glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);