开发者

Porting allegro 4 to allegro 5

开发者 https://www.devze.com 2023-03-14 10:39 出处:网络
what is the allegro 5 version of this function? texture_number = allegro_gl_make_texture_ex(AGL_TEXTURE_MASKED, my_bitmap, GL_RGBA);

what is the allegro 5 version of this function?

texture_number = allegro_gl_make_texture_ex(AGL_TEXTURE_MASKED, my_bitmap, GL_RGBA);

Or do I need to开发者_如何转开发 do something completely different in allegro 5? I'm trying to load an image to be used as an openGL texture. Here is the full code.

GLuint texture_number;
ALLEGRO_BITMAP *my_bitmap;

my_bitmap = al_load_bitmap("terrainImages/ground_32.bmp");
texture_number = allegro_gl_make_texture_ex(AGL_TEXTURE_MASKED, my_bitmap, GL_RGBA);

glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, texture_number);


Allegro 5 always uses either OpenGL or D3D. Therefore, all Allegro bitmaps are already textures. To get the OpenGL texture object associated with an Allegro bitmap, call al_get_opengl_texture. Note that due to sub-bitmaps, multiple bitmaps can use the same texture. So you will need to use al_get_opengl_texture_size and al_get_opengl_texture_position to get the location within the texture for that bitmap.

0

精彩评论

暂无评论...
验证码 换一张
取 消