 Okay, so today we are going to be discussing STL Texture. Now, what is an STL Texture? Well, according to the Wiki, an STL Texture is a struct that contains an efficient driver-specific representation of pixel data. This means that an STL Texture is just a chunk of data that you can store in your video card. And the reason you would want to use a STL Texture is because basically using a Texture is really useful when it comes to drawing something that may not fit on your screen. So, for example, if you want to load a really big image, if you want to load a really big image and show it on your screen, or if you want to do a lot of drawing that is higher resolution than your screen, what you can do is you can draw it to the Texture and then you can selectively show it onto your screen at given times. So, for now, I'm going to begin slowly. I'm going to show you a very simple way of using a Texture and I'm going to build up from that. And by the end of it, I think we are going to make something fairly interesting. Okay, let's begin. Okay, so how do we create a Texture? Well, we create a Texture by running the STL Create Texture function and we do it like this. I'm going to be using best practices for C++ from now on. So, apparently, having type names in your code is bad practice, so I'm going to start using the Auto keyword. Okay, we're going to say Auto, Red Texture and as you can guess by the name, this is going to be a Texture which is going to be colored to the color red. Okay, so the second argument you're going to pass to this Texture is just going to be the pixel format, the format in which you keep the pixels. And this isn't specific to STL, so I'm just going to use the constant that they provide, which is going to be STL pixel format and it's going to be RGBA8888. You can look that up yourself. It's not really that important. Now, the third argument is going to be STL Texture, Access, Target. And what an Access Target is essentially, what you can do with this Texture. So, if we look at the wiki, we can see that STL Texture Access Target and this can be used as a render target. So, we will be able to draw to this Texture if we set this type of Access Target. So, that's what we're going to do. And finally, the last two arguments are going to be the width and the height of this Texture. So, just like a window has a width and a height, Texture also has a width and a height. So, it's a two-dimensional structure. So, this is going to be 1000 by 1000, the same as the window. Okay, and while we're at this, we are going to create a new Texture and this Texture is going to be called Blue Texture. Okay, good. We created our two Texture classes and our classes. We created our two Texture structs. This is a C library and a C++ library. We don't have classes here. Okay, so, what we're going to do next is we are going to clear both of these textures to their respective colors. And the way we do that is, first, we have to set our render target to be the texture that we want to draw to. And if we look at the Wiki again, we can see the description for this function is, set a Texture as the current rendering target. So, all the rendering that we're going to do is going to be done to the Texture that we set. So, to do that, we are going to set the render target to be... Okay, so, we set our render target to be red Texture. Next, we are going to set the draw color and this should be familiar. Okay, so, what I did here is I set the red channel to be 255GB00. So, this is going to be... we're basically setting the renderer to the red color. The color for the renderer is going to be red. Okay, and what we're going to do now is we're going to do render clear. I'm going to say STL, render clear. I'm going to say render, okay. So, essentially, what we did in these three lines is we set the target to be the red Texture. We set the red Texture just because of the name. It's not red yet. Then we set the draw color to be red and then we cleared the renderer. So, essentially what we did is we said, okay, renderer point to this red Texture and second, we're going to clear the color of this red Texture to red. Now we're going to do the same thing but we're going to do this for the blue Texture. Okay, perfect. So, now we have both of these textures cleared to the respective color. So, the first one is red, the second one is blue. And what we have to do is we actually have to present it to our screen. So, how do we do that? Okay, so to show the textures to our screen, what we're going to do is we are going to copy. We're going to copy, or actually before we do that, we are going to clear the render target. And if we look at the wiki again, if we look at the wiki, as you can see, the second argument being the Texture, if you pass null to the renderer, or if you pass null as the Texture, it's just going to default back to rendering to the window. So, if we do that, we're just going to say, sdl set render target, and then we're going to pass null. We're using C++, so I guess null PTR would be better. And I don't think, I think they're interchangeable, so it doesn't really matter. Okay, so we're basically setting the render target to be back to our window. So, now we can actually show these textures, and we show our textures like this. We are going to copy a section of, or should I say, we're going to copy the texture to our window, and we're going to use the render copy function. And if we look at the render copy function, we can see that, what does it do? It says here it copies a portion of the texture to the current rendering target. And how does it do that? So, it needs a renderer, and it needs a texture. And then it needs srect, and it needs destrect. So, it takes an srect and a destrect. And for now, I'm going to leave that as it is. You don't have to worry about that. You can just pass null, because if you pass null, it's just going to take the entire texture. And if you pass null for the second, it's going to basically render to the whole thing. So, leave it for now. Don't think about it. For now, just understand the concept of how these textures work, right? So, what they're doing is we're going to take a copy of this texture and we're going to put it to our screen. So, what we're going to do is we're going to say, STL, render copy, and we are going to pass in our renderer, and then we're going to pass in our texture. And finally, we have to pass in two nulls because we want to use the entire renderer and we want to use the entire texture. And when I say renderer, I mean, we want to show this texture, we want to show this whole texture to the whole screen. So, we're going to pass null ptr and null ptr. And that should be fine. And once we do that, we are going to do STL, render, present, render. And then we are going to, we're going to STL delay for, I would say, 10 seconds. Okay, good. And when we do that, or actually, no, no, no, no. I'm going to present the red texture. Okay, so after that, we're going to say STL, render, copy. And we're going to copy the second texture. We're going to copy the blue texture to the screen. And then we're going to say renderer. And then we're going to say blue texture. Then we're going to pass in null ptr, null ptr. STL, render, present, renderer. And then we're going to do STL delay. And then we're going to delay for 10,000 milliseconds. Okay, good. Write. Now let's compile this. We're going to compile this the standard way, g++. And then we're going to say, what's this called again? Textures.cpp. And we're going to link it, lstl2. Output is going to be textures. Okay, so as you can see, we're seeing the red texture first. And it's going to switch to the blue texture. And that was showing the blue texture. And it's going to close. Okay, great.