@ -111,3 +111,50 @@ The above code will draw a texture flipped in the X axis.
All textures in OpenGL by default have the origin in the lower-left corner, while the screen origin is in the upper left. When you load a normal texture, raylib flips the image data for you, however this cannot be done with a render texture.
All textures in OpenGL by default have the origin in the lower-left corner, while the screen origin is in the upper left. When you load a normal texture, raylib flips the image data for you, however this cannot be done with a render texture.
The solution is to draw your render texture vertically flipped, see the above paragraph for how to do this.
The solution is to draw your render texture vertically flipped, see the above paragraph for how to do this.
# How do I create a depth texture?
By default `LoadRenderTexture()` uses a `RenderBuffer` for the depth texture, this is done for optimization (supposedly GPU can work faster if it knows that depth texture does not need to be read back). But a `RenderBuffer` is unsuitable to be drawn on the screen like a regular `Texture2D`.
Here some code to load a `RenderTexture2D` that uses a `Texture2D`for the depth:
```c
RenderTexture2D LoadRenderTextureWithDepthTexture(int width, int height)
{
RenderTexture2D target = {0};
target.id = rlLoadFramebuffer(width, height); // Load an empty framebuffer