Resizing | Game Engine series

  Рет қаралды 22,950

The Cherno

The Cherno

Күн бұрын

Patreon ► / thecherno
Instagram ► / thecherno
Twitter ► / thecherno
Discord ► thecherno.com/discord
Series Playlist ► thecherno.com/engine

Пікірлер: 49
@TheCherno
@TheCherno 4 жыл бұрын
One other thing with handling the resizing that you need to consider is performance; you probably don't want to be resizing all of your framebuffers whilst resizing is taking place (as seen by the log text at 11:30), but rather after resizing has finished.
@shifengliang5660
@shifengliang5660 4 жыл бұрын
Excited about multi-threading! Hope it will come soon! xD
@benfeldbergcollins6568
@benfeldbergcollins6568 Жыл бұрын
Great video as always, Just a quick one a more robust way to handle the minimizing is to use the glfw function glfwSetWindowIconifyCallback(window, window_iconify_callback); This is similar to other glfw callbacks set in the WindowsWindow.cpp file. If you create a new ApplicationEvent for WindowMinimizedEvent you can set the minimized state in the WindowData. This will help anyone having issues on Mac / Linux with minimizing as the window size is not set rather the window is push to a background task and 'iconified' Thank you for this series :)
@0x356
@0x356 4 жыл бұрын
The calculation you are looking for to keep everything same size and just see more when the window is resized is as follows: Obviously its bad to have that 720.0f in there - you'd need to pass that in from sandbox somehow. bool OrthographicCameraController::OnWindowResized(WindowResizeEvent& e) { float yScale = e.GetHeight() / 720.0f; m_aspectRatio = yScale * (float)e.GetWidth() / e.GetHeight(); m_camera.SetProjection(-m_aspectRatio * m_zoom, m_aspectRatio * m_zoom, -yScale * m_zoom, yScale * m_zoom); return false; }
@Marsman512
@Marsman512 4 жыл бұрын
Considering MacOS has some weird things when it comes to window size vs frame buffer size, I wouldn't use a glfwWindowSizeCallback for resizing the frame buffer. GLFW does have a glfwFramebufferSizeCallback though, or at least that's what I use.
@incognito9374
@incognito9374 4 жыл бұрын
OMG, I learned English only for watching your videos. Perfect work, Yan. (Здесь русские есть?)
@esben181
@esben181 4 жыл бұрын
Inco Gnito noice
@agfd5659
@agfd5659 4 жыл бұрын
Zdyes nyet russkogo
@warstt
@warstt 4 жыл бұрын
@@agfd5659 Zdyes yest ruskovo!
@KennyTutorials
@KennyTutorials 4 жыл бұрын
@@warstt Konehn!
@KennyTutorials
@KennyTutorials 4 жыл бұрын
Im learn English only watching ThinMatrix (Karl), TheCodeUniverse and TheChernoProject (Yan) videos.
@tinyrobot7443
@tinyrobot7443 4 жыл бұрын
I have built some kind of mixture between cropping and scaling: when resizing vertically (changing 1920x1080 to 1920x800) it gets scaled as I want to fit exactely 2 units into my ortographic camera. When resizing horizontally it gets cropped. You can change that behaviour in the camera to scale horizontally and crop vertically.
@almirfirmo3742
@almirfirmo3742 5 ай бұрын
I don't know if that happenend only to me, but the resizing was working fine already (exactly like his at the end of the video). And It took me some time to figure out that in the ImGuiLayer class, at the End() method, I was running the following piece of code: GLFWwindow* window = s_GetNativeWindow(); int display_w, display_h; glfwGetFramebufferSize(window, &display_w, &display_h); glViewport(0, 0, display_w, display_h); Which already corrects the size of the viewport on every Run() call of the Application class based on the Frame buffer size (apparently GLFW updates the frame buffer size when the window resizes?).
@theo-dr2dz
@theo-dr2dz 7 ай бұрын
With what we have now, it should be possible to create a view/viewport system comparable to what sfml has. This would combine the camera, the camera controller and some of the stuff of this episode. Only I would do it differently, because I think the sfml approach is very confusing and hard to use. For someone with my kind of brain, it's hard to keep the aspect ratio right with the sfml approach, because they have the view in pixels, but the viewport in normalised units that are relative to the window. I would fix it so that the aspect ratio of the view and the viewport are always equal, so that the graphics are not getting distorted when the aspect ratio of the window is changed by a resize. This implies that either change in width or change in height is dominant. Also I would do the api entirely in pixels and convert it to normalised units internally. I would also make the viewport the "main" thing instead of the view. Of course in opengl there is one viewport per context, so that if you want to draw to multiple viewports, you would have to have multiple scenes that each have a viewport. Every begin_scene would change the opengl viewport to reflect the scene viewport.
@tim21010
@tim21010 4 жыл бұрын
So excited about each new vid!
@whythosenames
@whythosenames 4 жыл бұрын
Can you also render while resizing or doesn’t it work in opengl?
@jacob26referibles
@jacob26referibles 4 жыл бұрын
When you were just starting out, what books did you use to get the fundamental basics of what makes up a game engine and walked you through implementing a simple one?
@pooria_garrett3020
@pooria_garrett3020 4 жыл бұрын
Game Engine Architecture is one
@michamarzec9786
@michamarzec9786 4 жыл бұрын
0:58 Java won't ever let you forget about updates.
@miguelg.s.1246
@miguelg.s.1246 3 жыл бұрын
27:54 It's not a bug it's a feature!!
@sam_is_people1170
@sam_is_people1170 2 жыл бұрын
thanks!!!
@cheako91155
@cheako91155 4 жыл бұрын
You've stopped the forwad progression of time during minimize.
@christianheidemann3829
@christianheidemann3829 4 жыл бұрын
Perfect timing Cherno, just came home from Uni!
@msid9870
@msid9870 4 жыл бұрын
Haha same
@RandomGuyyy
@RandomGuyyy 4 жыл бұрын
Cherno said in a couple of videos (I think) that his favourite graphics API is DX11 - How about a DirectX 11 series? Like, it could be a sort of conversion course comparing it with the equivalent OpenGL calls and pipeline.
@weltlos
@weltlos 4 жыл бұрын
He already said that the engine is definitely going to support DX11 and maybe Vulkan at some point too. If you can't wait maybe look into ChiliTomatoNoodle's tutorials. He is currently doing something similar but with DX11.
@supremedeity9003
@supremedeity9003 4 жыл бұрын
@@weltlos He Jumps the gun a lot, new episode and bam all windowing stuff + input done. following along can be a hassle that way.
@weltlos
@weltlos 4 жыл бұрын
@@supremedeity9003 Yes, I agree, his way of explaining things is pretty straight forward. At the same time, however, you get the feeling that it is actually your project and that you are researching how specific things _can_ be done, how specific mechanisms work and not so much how to implement them step by step, because this is mainly your task, as project manager, so to say. Good luck!
@spencersmith4305
@spencersmith4305 3 жыл бұрын
I'm having a lot of problems with the resizing. I copied all of the code exactly to see if it would work, but when I resize the window everything rotates by almost 90 degrees on the y axis. (or it's just squishing everything to be very thin, it's hard to tell) Has the glViewport() command changed or something?
@spencersmith4305
@spencersmith4305 3 жыл бұрын
Nevermind I just had a random - symbol where it shouldn't have been. I spent 2 hours on this haha
@Destroyer19941995
@Destroyer19941995 3 жыл бұрын
My entire picture stretches when I do that
@JinkunOu
@JinkunOu Ай бұрын
You need to update the camera's orthogonal matrix at the same time.
@nicolassurfay2585
@nicolassurfay2585 4 жыл бұрын
Ah, what is your VS theme it kinda looks cooler than the default one. BTW AWESOME VIDEO!
@scrub6515
@scrub6515 4 жыл бұрын
default VS theme with visual assist x
@nicolassurfay2585
@nicolassurfay2585 4 жыл бұрын
@@scrub6515 wait I didn't understand the orange, yellow combination of the text color comes with visual assist x?
@JackPunter2012
@JackPunter2012 4 жыл бұрын
@@nicolassurfay2585 yes it does, you may need to go into visual assist settings and turn on the plugins highlighting
@nicolassurfay2585
@nicolassurfay2585 4 жыл бұрын
@@JackPunter2012 OK!
@sumitdhingra9520
@sumitdhingra9520 3 жыл бұрын
I don't know for some reason on my Mac OpenGL 4.1, the resizing was working fine without setting the viewport. Does anyone know if there a particular reason for that?
@sumitdhingra9520
@sumitdhingra9520 3 жыл бұрын
for anyone looking for answers it has something to do with RetinaDisplay
@minhquannguyen3605
@minhquannguyen3605 3 жыл бұрын
Window Resize Event not show the {0,0} in Minimized in my Ubuntu 20.04
@chris_burrows
@chris_burrows 4 жыл бұрын
Early squad reporting in
@pooria_garrett3020
@pooria_garrett3020 4 жыл бұрын
Oh look whose squad it is ;)
@kavishshah6441
@kavishshah6441 4 жыл бұрын
Can you make a video on what visual studio plugins you use and what are the best ones For eg: How do you get the words underlined in red when there's an error and stuff I don't get that in my vs Please!
@Stephen_Samuel
@Stephen_Samuel 4 жыл бұрын
There should be an option in the tools>options
@theo-dr2dz
@theo-dr2dz 7 ай бұрын
He keeps saying that you shouldn't use imgui in the game itself, just in debugging and development tools, but he never gives a reason why not. Now, I think imgui looks pretty good (better than most actually) and it has a lot of functionality. I guess for a game it looks a bit office-y, but building your own gui is quite a project in its own right. Is there any reason beyond looks not to just use imgui as the game gui?
@_vnzin.7
@_vnzin.7 4 жыл бұрын
Br?
@tanujmehta7155
@tanujmehta7155 4 жыл бұрын
Make videos about competitive programming with c++
@BrokenPuzzle03
@BrokenPuzzle03 4 жыл бұрын
I always feel like we don't do anything in your tutorials. I'm a beginner and I learn by doing not listening.
@knodelcrafter6888
@knodelcrafter6888 4 жыл бұрын
Broken Puzzle maybe creating a game engine is not really suitable for beginning to program. Maybe consider some other tutorials?
TEXTURES | Game Engine series
51:48
The Cherno
Рет қаралды 42 М.
Batch Rendering Textures (+ Debugging!) // Game Engine series
46:30
Increíble final 😱
00:37
Juan De Dios Pantoja 2
Рет қаралды 110 МЛН
I CAN’T BELIEVE I LOST 😱
00:46
Topper Guild
Рет қаралды 65 МЛН
Always be more smart #shorts
00:32
Jin and Hattie
Рет қаралды 38 МЛН
Just In Time (JIT) Compilers - Computerphile
10:41
Computerphile
Рет қаралды 262 М.
CoPilot Review: My Thoughts After 6 Months
9:45
ThePrimeagen
Рет қаралды 537 М.
Transforms | Game Engine series
25:03
The Cherno
Рет қаралды 26 М.
Moving to Sandbox | Game Engine series
22:16
The Cherno
Рет қаралды 30 М.
How I Made JavaScript BLAZINGLY FAST
10:10
ThePrimeagen
Рет қаралды 212 М.
Camera Controllers | Game Engine series
35:50
The Cherno
Рет қаралды 30 М.
What are Events? (C# Basics)
15:05
Code Monkey
Рет қаралды 377 М.
Physics Engine from Scratch
11:19
therealjtgill
Рет қаралды 8 М.
CAMERAS and How They Work | Game Engine series
38:54
The Cherno
Рет қаралды 39 М.
Textures in OpenGL
31:44
The Cherno
Рет қаралды 168 М.
Increíble final 😱
00:37
Juan De Dios Pantoja 2
Рет қаралды 110 МЛН