I reached the point in my blog where I had to share not just a screenshot, but video. This task splits in a few steps: 1. Capturing the video So, I have an animation on my screen, which I want to record/capture. Windows 10 offers a Capture Utility to record your display. It's a part […]
Chapter 22. Screen resize
When screen size changed, we need to re-position the camera to fit new screen size optimally. For example, in our case optimal scene/"stage" size would be, let's say, 500x300 (to fit our spinning box into the screen). Our camera's view angle is 30 degrees. so, ? / 250 = cosine(15) / sine(15) = cotangent(15) ? […]
Chapter 21. Textured surface
Now let's apply a texture to a complicated multi-vertex surface, to the right (blue) side for example. Hope, it's clear enough how to write a textured Phong shader, but we'll do it later, in some other chapter. For now the flat one (which we have already) will be good enough. We will need: to pass […]
Chapter 20. Modeler. Round shapes
Our current rectangular model does not allow us to appreciate all the beauty of the Phong shader, in particular - the glares. For that we'll need something more round-shaped. Let's extend our Modeler accordingly. Windows 1. Start VS. Open C:\CPP\a997modeler\p_windows\p_windows.sln. First - we'll need to extend VirtualShape.h. 2. Open VirtualShape.h and replace code by: New […]
Chapter 19. Light and Phong Shading
For more realistic image we'll need light and shades, which will require new shaders. We will use Phong shading model. Let's start with a uniform color shader. 1. Vertex shader. Copy following code in a Text Editor and save is as a txt file in C:\CPP\engine\dt\shaders\phong_ucolor_v.txt 2. Fragment shader. Copy following code in a Text […]
Chapter 18. Camera view
In our previous chapters we used straight projection of our subject to the "screen surface". For more realistic picture we need Camera. OpenGL ES doesn't offer an embedded camera object, so we'll need to create one. Windows 1. Start VS. Open C:\CPP\a997modeler\p_windows\p_windows.sln. To see the difference with Camera view let's first simplify our box movement. 2. […]
Chapter 17. Modeler. Part 2
Now back to the modeler. Time to put all these new classes together. Windows 1. Start VS. Open C:\CPP\a997modeler\p_windows\p_windows.sln. 2. Under modeler add new header file ModelBuilder.h Location - C:\CPP\engine\modeler Code: In this sample we will create a red box with 1 blue side (the right one). For this we will need to create 1 GameSubject, […]
Chapter 16. Modeler
Now it's time to think where to get actual 3D models for our Project. Our options are: So, let's start with the last option - generate models programmatically. It will be a set of tools and classes, a considerable part of our engine. Let's create a placeholder for it. 1. In Windows File Explorer under […]
Chapter 15. Indexes and EBO - Element Buffer Object
In our latest samples we used GL_TRIANGLE_STRIP primitive (to draw a rectangle as a sequential array of vertices). But the most useful and most common primitive is GL_TRIANGLES. We used it earlier to draw a triangle (assuming that vertices go in correct sequential order). For more complicated surfaces normal approach is to keep an array […]
Chapter 14. 3D Coordinates and Game Subjects
3D subject will require 3D coordinates including orientation angles. We will need Euler angles (yaw, pitch, and roll in aviation terminology or heading, attitude and bank in naval). We'll start with Euler angles in degrees and in radians and a rotation Matrix. We'll call this class Coords. Windows 1. Start VS. Open C:\CPP\a998engine\p_windows\p_windows.sln. 2. Under […]