Turns out, the whole time I was working on Rock Bottom before, I was using an outdated render engine.
Okay, fair enough, that wasn’t a new discovery, I was just too lazy to update so it stuck around.

Now I took the time to finally update Rock Bottom from LWJGL 2 to LWJGL 3!
For anyone that doesn’t know, LWJGL stands for Leightweight Java Game Libaray. It’s a library for Java (I know, right?) that wraps around OpenGL, which, similarly to other stuff like DirectX, renders stuff on your screen.
Updating from 2 to 3 was actually a lot of work. The whole way to open and display windows changed, a lot of the audio library AL changed, and the library went from using a plain old wrapper around OpenGL to something called GLFW for displaying windows and doing some other stuff.

Main point is: Now, Rock Bottom uses LWJGL 3, enabling it to run a lot faster and especially use GLSL shaders to display stuff! So, when I actually get around to it at some point, I can do stuff like make leaves wobble around a bit to simulate wind, or dynamic lights, or colored lights. Basically, everything involving rendering will be a lot easier because of this.

Anyway, the point of this post is actually something different: I really wanted to show you all the bugs that occured while I was trying to figure out this new system, cause they all look really funny in my opinion. So here we go!

Basically, at the start texture rendering itself actually didn’t work, because of an error in my texture coordinate calculations (not to get too technical, but basically, OpenGL needs a texture coordinate to be between 0 and 1, so a percentage, basically, but I was giving it the actual pixel coordinates). Anyway, point is: It created this image!
Also note how, at the start, my projection matrix was the wrong way around, so the little boxes you can make out at the top are actually the menu buttons, and the big box starting at the bottom is the logo texture.

At some point I actually got texture rendering working, and so this was the result of what the main menu looked like before I fixed the projection matrix being upside down. If you take a look at the top right, you will also see that, in this screenshot, my name was actually Ellp rV or something like that. This was due to an issue I had in my batched rendering system, where I was making OpenGL render before it had the full amount of vertices that it needed, meaning it distorted everything it drew after a certain point.

The next two screenshots are from a day later. Here, I tried to figure out some texture changing stuff, because I wanted to introduce what I call texture banks into the game (I don’t know their actual name, so let’s just go with that). Basically, with OpenGL, you bind a texture to be used for rendering. But before binding a texture, you can select the texture bank to put the texture into, so that you can basically have multiple textures bound at the same time. While playing around with this, the first result I got was.. well, binding the texture for soil to texture bank 0, then switching to 1 and binding every other texture to bank 1, but never actually accessing that one. This is what that looked like.

The last screenshot I’m gonna show is from the same experiment. I don’t really understand what happened here, but I remember it also being something with the renderer being told to render before the right amount of vertices was actually added, similar to what happened in the second screenshot with my name. Here goes. As you can see, the player now has two hearts and.. three pieces of soil. Yea.

So yea, this is my adventures of updating from LWJGL 2 to 3. It was definitely a challenge, but it was also a lot of fun to do something new. Anyway, I hope you enjoyed this post and I hope you’re all excited for more updates on Rock Bottom!
You can comment below this post and tell me what you think about anything I talked about here, or ask questions, or.. tell me whatever else you want to tell me! Thanks!

Categories: ContentTechnical

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Posts

Content

Cuts for Biomes and why culling is pretty cull

There’s a bad pun in the title. Do I win? So, the last couple of weeks I’ve been working on some stuff. Mostly, I’ve been re-implementing some of the features into the game, like the Read more…

Content

Text, Trees and why Patience pays out

Today, I’ve been working on a couple of things. First of all, I extended the text system of the game. I added a couple of Formatting Codes that allow you to style text in different Read more…