关于OpenGL的一个载入纹理的前提函数
Public Function LoadGLTextures() As Boolean'Load up desired bitmaps and convert them into textures
'that can be used by OpenGL
Dim sFile As String
Dim bmFile As BITMAPFILEHEADER
Dim bmInfo As BITMAPINFOHEADER
Dim bmRGB() As RGBQUAD
Dim iFile As Integer
Dim lImageSize As Long
Dim iPixelSize As Integer
Dim baImageData() As Byte
On Error GoTo ERR_H
'Set the filename
sFile = App.Path & "\" & TEXTURE_FILE
iFile = FreeFile
Open sFile For Binary As iFile
'Read in the headers
Get #iFile, , bmFile
Get #iFile, , bmInfo
'Determine how many colors are used
If (bmInfo.biBitCount < 24) Then
'Less than 24 bits per pixel are used, so allocate space for the color table
ReDim bmRGB(bmInfo.biClrUsed)
'Read in the color table
Get #iFile, , bmRGB
End If
'Determine how big the image is
iPixelSize = bmInfo.biBitCount / 8
lImageSize = bmInfo.biWidth * bmInfo.biHeight * iPixelSize
ReDim baImageData(lImageSize)
'Read in the image data
Get #iFile, , baImageData
Close #iFile
谁会啊,解释下