al_get_opengl_texture_size(3alleg5)

πŸ“¦
version 5.2.11.3 Β· 4 versions
, in debian trixie, ubuntu questing, ubuntu resolute, ubuntu stonking

πŸ’– al_get_opengl_texture_size πŸ’–

okay bestie, so this one is from the Allegro 5 API β€” the allegro5 manual, the one and only β€” and it's literally the lil detective that tells you how big your actual GPU texture is. it's giving "peek behind the curtain" energy ✨


🌸 SYNOPSIS 🌸

#include <allegro5/allegro_opengl.h>

bool al_get_opengl_texture_size(ALLEGRO_BITMAP *bitmap, int *w, int *h)

πŸ¦‹ DESCRIPTION πŸ¦‹

so the vibe here is: you hand it a bitmap, and it goes and finds out the size of the texture that's being used for that bitmap. and no, it is not always the same as the bitmap size β€” that's the whole point, that's the tea πŸ«–

it can come out different in two situations:

  • if OpenGL only supports power-of-two sizes, the texture might be bigger than your bitmap (because OpenGL said "no 64Γ—64 for me, only 128Γ—128 today" πŸ’…)
  • if the bitmap is a sub-bitmap, then yeah, the texture it lives in is the big one, not the little slice

it drops the width into *w and the height into *h for you. cute, right?

now for the return value, bestie, pay attention:

  • returns true on success βœ…
  • returns false on failure ❌
  • and if the bitmap isn't an OpenGL bitmap at all? then you get zero width and height back. like, 0 and 0. nothing. silence. πŸ’€
heads up: that zero-zero thing is a real outcome, not a bug β€” so if you see w == 0 and h == 0, your bitmap just isn't an OpenGL bitmap. check that before you go doing math with it, fr fr.

πŸ‘€ SEE ALSO πŸ‘€


and that's the whole page, periodt πŸ’œ this lil number lives in the <strong>Allegro reference manual</strong> under <code>al_get_opengl_texture_size(3alleg5)</code> β€” go off, go read the position one next, ily bye πŸŽ€βœ¨

πŸ“¦ where this page comes from