Game Camera OpenGL | Coding a 2D Game Engine in Java #7

preview_player
Показать описание

In this tutorial I go over how to create a game camera in OpenGL using LWJGL3. I cover what a projection matrix is, what a view matrix is, and how they tie together to create a unified game camera. I also go over the mathematical process of transforming the world space coordinates to normalized device coordinates using these matrices. And lastly, I briefly describe what shader uniforms are, and how we can use them to upload our camera data to the GPU and then draw our world in world coordinates instead of normalized device coordinates.

---------------------------------------------------------------------

Here are some books I recommend if you want to learn about game engine development more thoroughly. I do not profit off any of these sales, these are just some books that have helped me out :)

My Recommended Game Engine Books:

My Recommended Beginning Game Programming Books:

My Recommended Java Books:

Рекомендации по теме
Комментарии
Автор

Gabe actually did the whole series about making mario on one day and switched his outfits after every video, to let us think he made the following videos on seperate days.

jestry
Автор

Sometimes I just wish I can press the like and subscribe button a thousand times.
Best series ever man. Helps out a lot and its just amazing.

nicholashendrata
Автор

Im nooob in java, and this is not just "guide how to create ur own engine". It is some more prectice, some more intresting stuff, some more usefull things. Thanks u man! I really enjoing ur course.

drochit
Автор

You deserve more subs this content is awesome not many people explain things very well but you take your time and I can tell you are super passionate about teaching it's dope!

twoleggedcat_cs
Автор

you're helping a ton, i hope you'll continue this series

rxn
Автор

The best game development tutorial out there. By Far.

trianglestudios
Автор

I just want to say thank you for making these! I started watching yesterday and already on this episode. Every tutorial is engaging and makes me want to continue. Even though I may not understand most of what you're doing right now, my hopes is that I will after I'm done and I mess around with the code a bit myself. Thanks Again!

zapjoshua
Автор

Hey Gabe, awesome series! surely the best one I've found since I got interested in opengl.
I have a little trouble with some of the concepts in this video, mainly the idea of view matrix.
1. My biggest issue is with the cameraUp object. What does it represent? What does it even mean? If I set it's values to (1.0f, 0.0f, 0.0f) - nothing is shown. Why is that?
2. We have the ortho() method (of the Matrix4f class). It takes some params such as 32.0f * 40.0f for right and some other float for the top. Where do these numbers come from? How did you calculate them? What do they represent?
3. You also create an object named cameraFront object, with some initial values, that are overridden with other values with the add() method. Is there a meaning for initializing the object before setting the actual required values?
4. Also, if you can please confirm of deny a conclusion I have: if the camera if positioned in the 20.0f of the z axis, than any value of the z axis for the cameraFront object - will show the same result.

Thanks a lot for these videos!

sigalgivatikovayko
Автор

Hey Gabe, first I would like to say, thank you for these tuts. They have to be the most comprehensive java game coding tutorials that I personally have ever found on youtube. You have a talent for teaching this stuff. I have one question, is there a way to set up a ( isometric 2d Camera ) with the code we did here, or is that something totally different ?

blacklight
Автор

With the last changes, my square disappeared rather than moving right.^^ xDDDD

ParalyticAngel
Автор

Hello, I just wantet to mention, that you don't have to reset the viewMatrix or the projectionMatrix, instead you can just use and viewMatrix.setLootAt(...), this way you avoid unnecessary matrix multiplication, which is way more efficient.
Otherwise great tutorial!

RobarthVideo
Автор

im not very clear what type of camera we use, orhto or prespect, taking that very good tutorial.

lucasgiffuni
Автор

1 секунду назад
I have some problem, help me please! My square is twitching... not slowly going right, just twitching(like not enough FPS). And in last videos was problem when Gabe prints in console FPS, i had aboud 6-7 ... This is strange.. help me please if somebody know what the problem is

drochit
Автор

holy shit you type fast, I have to pause the video almost every few seconds.

mrt_
Автор

Love the videos, I've been following them for the last couple of days now. However, I seem to be having a problem where the square comes up for a split second then disappears for good. Instead of moving around as you have. Any idea what could be causing that?

apkalypsis
Автор

Love your desktop background, if it's not too much do you have a link to it? But awesome video, will have to rewatch to have it sink in

justins
Автор

I have read your article in the comment. I am quite confusing about how the coordinate system work on our screen, for the cameraUp is(0, 1, 0) and the cameraFront(0, 0-1) so the camera is facing into our screen, but what happen if cameraUp is (1, 0, 0), the camera is somehow become upward :? Can you explain a little more specific about it. Thank you

HoangNguyen-ycov
Автор

Is it weird if my square moves to the left instead of to the right at the end? If it's an issue I want to fix it now before it causes more problems.

tomb_
Автор

Very good tutorials! Thank you so much for doing this.
I have a problem which is that my square blinks but i don't know what may be causing this issue.

javiervelez
Автор

We always use ortho for 2d, or there is specific case when we can use for 3d?

Bandit-iszi