set_projection_viewport(3)
β¨ set_projection_viewport β¨
okay bestie, so this one lives in the Allegro manual, aka the game programming library of your dreams π, and it's a <pink>set_projection_viewport(3)</pink> situation. what does it do? it sets the viewport used to scale the output of persp_project(). that's it, that's the girl. π
πΈ SYNOPSIS πΈ
#include <allegro.h>
void set_projection_viewport(int x, int y, int w, int h);
π¦ DESCRIPTION π¦
so basically, set_projection_viewport() sets the viewport that gets used to scale the output of the persp_project() function. you pass in the dimensions of the screen area you wanna draw onto, and ngl that's typically gonna be 0, 0, SCREEN_W, and SCREEN_H. no cap. π
β¨ pro tip from me to you: don't forget to pass an appropriate aspect ratio to get_camera_matrix later. the way that these two are besties... iykyk π«Ά
now here's the tea β β the width and height you specify here determine how big your viewport is in 3d space. so if an object in your 3D space is w units wide, it will fill the complete screen when you run into it (i.e., if it has a distance of 1.0 after the camera matrix was applied. the fov and aspect-ratio parameters to get_camera_matrix also apply some scaling though, so this isn't always completely true). lowkey important, highkey iconic. π
and listen β if you pass -1/-1/2/2 as parameters, no extra scaling will be performed by the projection. literally zero. none. periodt. π
π SEE ALSO π
and that's the whole vibe, bestie πβ¨ this cutie came straight out of Allegro, version 4.4.3, and it's the set_projection_viewport(3) page. go forth and scale your viewport, you absolute main character πππ¦
π¦ where this page comes from
- fedora 43: allegro-devel 4.4.3.1-18.fc43 Β· Giftware
- fedora 43: allegro-devel 4.4.3.1-18.fc43 Β· Giftware
- fedora 44: allegro-devel 4.4.3.1-20.fc44 Β· Giftware
- fedora 44: allegro-devel 4.4.3.1-20.fc44 Β· Giftware
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms