标题:关于OpenGL的一个载入纹理的前提函数
只看楼主
壮志在我胸
Rank: 3Rank: 3
来 自:邯郸
等 级:论坛游侠
威 望:1
帖 子:158
专家分:125
注 册:2009-9-7
结帖率:75%
 问题点数:0 回复次数:1 
关于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
谁会啊,解释下
搜索更多相关主题的帖子: 纹理 OpenGL 函数 前提 载入 
2010-05-14 17:11
bczgvip
Rank: 14Rank: 14Rank: 14Rank: 14
等 级:贵宾
威 望:66
帖 子:1310
专家分:5312
注 册:2009-2-26
得分:0 

问题呢?
2010-05-14 22:10



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-306681-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.587667 second(s), 7 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved