diff --git a/Frequently-asked-Questions--Common-Questions.md b/Frequently-asked-Questions--Common-Questions.md index 3d16066..026bc57 100644 --- a/Frequently-asked-Questions--Common-Questions.md +++ b/Frequently-asked-Questions--Common-Questions.md @@ -97,9 +97,17 @@ DrawText(text, textStartX, textStartY, fontSize, LIGHTGRAY); Drawing a texture flipped requires the use of either `DrawTextureRec`, or `DrawTexturePro` functions. Every single texture drawing function calls `DrawTexturePro` to do its work, but only these two expose the parameters necessary to flip a texture (the source rectangle). -To flip the texture, simply pass a source rectangle with a negative width and height. +To flip the texture, simply pass a source rectangle with a negative width or height. + +```c +Rectangle source = (Rectangle) { 0, 0, -texture.width, texture.height }; + +DrawTextureRec(texture, source, (Vector2) { 0, 0 }, WHITE); +``` + +The above code will draw a texture flipped in the X axis. # Why is my render texture upside down? -All textures in OpenGL by default have the origin in the lower-left corner. 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 flip your texture when drawing, see the above paragraph for how to do this. +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 flip your texture vertically when drawing, see the above paragraph for how to do this.