OpenGL 3D Game Tutorial 14: Simple Terrain
LWJGL tutorial series on how to create a 3D Java game with OpenGL!
This week we program a terrain renderer and generate a simple flat terrain!
Code for generating terrain: https://www.dropbox.com/s/47qk4yrz5v9lb61/Terrain%20Generation%20Code.txt?dl=0
Full code download (try doing the tutorial first though!):
https://www.dropbox.com/sh/37h3ri1veomo53p/AACoUHiVpvfZfjuHs01CCfwTa?dl=0
Common Problems:
-If you can't see the terrain make sure your camera is in the right position! It needs to have a y position of above 0, and if you still can't see the terrain then try turning the camera around by setting the "yaw" to 180.
-Make sure that you're starting and stopping the *terrain shader* (and NOT the static shader program) before and after rendering the terrain in the MasterRenderer's render() method.
-If the texture on the terrain only looks good in one corner then try adding these 2 lines into your loadTexture method before returning the texture's ID:
GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, GL11.GL_REPEAT);
GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, GL11.GL_REPEAT);
Support the series on Patreon: https://www.patreon.com/thinmatrix
Facebook Page: https://www.facebook.com/thinmatrix
Tumblr: http://thinmatrix.tumblr.com/
Instagram: http://instagram.com/thin_matrix
Twitter: https://twitter.com/ThinMatrix
Check out my game on IndieDB: http://www.indiedb.com/games/equilinox
End of video music- Kai Engel, "Waking Stars":
http://freemusicarchive.org/music/Kai_Engel/Evening_Colors/01_-_Waking_Stars