OpenGL 3D Game Tutorial 14: Simple Terrain

preview_player
Показать описание
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!

Full code download (try doing the tutorial first though!):

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:

End of video music- Kai Engel, "Waking Stars":
Рекомендации по теме
Комментарии
Автор

I've created terrain before, but I like how you organize your code. How data is managed is also a subject I seldom see in tutorials, yet it is very important.

NeilRoy
Автор

Excellent tutorial! Everything has worked perfectly so far, but in this episode I struggled a bit to see the ground. Like said, it was the camera position that could have solved the problem, but also positioning the terrains differently would make them show. Like this:

Terrain terrain = new Terrain(-1, -1, loader, new
Terrain terrain2 = new Terrain(0, -1, loader, new

uramawa
Автор

I hope i'll hepl someone with my comment: After dancing around the computer i tried just to move my camera a lot more in a different positions and i'vo found my terrain. Also i got a bit bigge rpicture before that. Anyway i'm happy like a little child that everything's working! Thanx man for great tutorials. I've started to learn java little less than 2 months ago. from zero. All i knew was a couple web pages on html. And now following this tutorial i'm making A GAME ENGINE!! OMG!!! That's cool! So all it means that you are a really good teacher! Thanx once again!!

stanymiles
Автор

i still have endless amounts of fun setting FOV to 170 and watching everything stretch and warp by at lightspeed XD

bobthegreatiii
Автор

"We don't want to rotate our terrains, that would be crazy." 9:57

Flatearther.

ItsRamzi
Автор

Although I already know these things the videos help me compare your backend against mine, to develop a better api. Also your Development log video diary things are very entertaining. Thanks!

axelforsman
Автор

a small typo got me hanging around for some time but now its resolved ^^
i always have to watch at 0.5 speed because i can't follow along that fast but you explain everything very good, thank you :D

toniwalter
Автор

Very nice tutorial! Thanks so much, you are so talented!!!

Joern
Автор

Gracias por estos asombrosos vídeo tutoriales, eres genial! :D

jonatanla
Автор

Ah, this is the tutorial I've been waiting for.

skittles
Автор

Awesome tutorial! Keep this amazing work!

itay
Автор

for now i'm making a 2d game, but when i finish it, i'll be doing a 3d one with the guidance of this tutorial series. For the terrain, i'll try a procedural generation of blocks, just like Minecraft.

Luquinha-qfkb
Автор

Exception in thread "main"
at
at
at
at
help

edit: stupid mistake one of the variables was called textur not texture

Smoah
Автор

If the tiles are repeated with large black margins surrounding them, check that the dimensions of grass.png are powers of 2, e.g. 128x128, 256x256, 512x512 etc.

iJoemo
Автор

Thnx for the tutorial. This is Awesome!

buffetize
Автор

How did you define your "whole terrain. When I rendered my terrain, I only see 1/4 of the world covered with the terrain. I found that out when I added in the sky box.

DanielHong
Автор

All looks good, got 2 trees, my terrains, also set the sun to be 200 blocks high :D

MohammedPlaysMC
Автор

just want to say thank you. brilliant job.

xekplugins
Автор

How do you make appear the tree in the middle of both the textures?

dbejarcaballero
Автор

I'm attempting to create your terrain "package" as a project in Visual Studio (C++) and then implement the procedural generation you've got in the other tutorial. Wish me luck! :P

cosmic_gate