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.
精彩评论