Game Development Reference
In-Depth Information
Listing 6-16. Copying Over a Texture
void CopySubTextureToTexture(int Level, int XOffset, int YOffset, Bitmap BitmapImage)
{
// Copies the texture in BitmapImage to the bitmap associated with this Texture object
/*
public static void texSubImage2D (int target, int level, int xoffset, int yoffset,
Bitmap bitmap)
Added in API level 1
Calls glTexSubImage2D() on the current OpenGL context. If no context is current the
behavior is the same as calling glTexSubImage2D() with no current context, that is,
eglGetError()
will return the appropriate error. Unlike glTexSubImage2D() bitmap cannot be null and will
raise
an exception in that case. All other parameters are identical to those used for
glTexSubImage2D().
*/
ActivateTexture();
GLUtils.texSubImage2D(GLES20.GL_TEXTURE_2D, Level, XOffset, YOffset, BitmapImage);
CheckGLError("GLUtils.texSubImage2D");
}
Creating the BillBoardCharacterSet Class
The BillBoardCharacterSet class holds the character fonts for use with the HUD. The Settext()
function sets the text you want to display, then you use the RenderToBillBoard() function to put this
text on the input BillBoard object's texture.
The maximum number of characters in this set is specified by MAX_CHARACTERS .
static int MAX_CHARACTERS = 50;
The number of characters actually in the character set is held in m_NumberCharacters .
private int m_NumberCharacters = 0; // Number characters in the character set
The character set itself is made up of an array of BillBoardFonts .
private BillBoardFont[] m_CharacterSet = new BillBoardFont[MAX_CHARACTERS];
The text to be placed on the billboard when the Settext() function is called is stored in m_Text ,
which is a character array of MAX_CHARACTERS_TEXT in length.
private int MAX_CHARACTERS_TEXT = 100;
private char[] m_Text = new char[MAX_CHARACTERS_TEXT];
The BillBoardFont objects that correspond to the characters in m_Text are stored in m_TextBillBoard .
private BillBoardFont[] m_TextBillBoard = new BillBoardFont[MAX_CHARACTERS_TEXT];
 
Search WWH ::




Custom Search