91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小:
    文件類型: .zip
    金幣: 1
    下載: 0 次
    發布日期: 2023-07-14
  • 語言: 其他
  • 標簽: OPenGL??

資源簡介

OpenGL編程精粹源代碼

資源截圖

代碼片段和文件信息

//======================================================================
/**
*??@file??CBMPLoader.cpp
*
*??項目描述:?OpenGL混合
*??文件描述:??載入位圖類?
*??適用平臺:?Windows98/2000/NT/XP
*??
*??作者:?????BrightXu
*??電子郵件:??huoxini@hotmail.com
*??創建日期:?2006-11-23
*??修改日期:?2006-11-28
*
*/
//======================================================================
#include“CBMPLoader.h“??????????????/**
/**?構造函數?*/
CBMPLoader::CBMPLoader()
{
???/**?初始化成員值為0?*/
image?=?0;
imageWidth?=?0;
imageHeight?=?0;
}

/**?析構函數?*/
CBMPLoader::~CBMPLoader()
{
???FreeImage();?/**}

/**?裝載一個位圖文件?*/
bool?CBMPLoader::LoadBitmap(char?*file)
{
FILE?*pFile?=?0;?/**
/**?創建位圖文件信息和位圖文件頭結構?*/
BITMAPINFOHEADER?bitmapInfoHeader;
BITMAPFILEHEADER?header;
??
unsigned?char?textureColors?=?0;/**
???/**?打開文件并檢查錯誤?*/
pFile?=?fopen(file?“rb“);
if(pFile?==?0)?return?false;

/**?讀入位圖文件頭信息?*/?
fread(&header?sizeof(BITMAPFILEHEADER)?1?pFile);

/**?檢查該文件是否為位圖文件?*/
if(header.bfType?!=?BITMAP_ID)
???{
???fclose(pFile);?????????????/** ???return?false;
???}

/**?讀入位圖文件信息?*/
fread(&bitmapInfoHeader?sizeof(BITMAPINFOHEADER)?1?pFile);

/**?保存圖像的寬度和高度?*/
imageWidth?=?bitmapInfoHeader.biWidth;
????imageHeight?=?bitmapInfoHeader.biHeight;

????/**?確保讀取數據的大小?*/
???if(bitmapInfoHeader.biSizeImage?==?0)
??????bitmapInfoHeader.biSizeImage?=?bitmapInfoHeader.biWidth?*
??????bitmapInfoHeader.biHeight?*?3;

/**?將指針移到數據開始位置?*/
fseek(pFile?header.bfOffBits?SEEK_SET);

/**?分配內存?*/
image?=?new?unsigned?char[bitmapInfoHeader.biSizeImage];

/**?檢查內存分配是否成功?*/
if(!image)????????????????????????/** ???{
???delete[]?image;
???fclose(pFile);
???return?false;
???}

/**?讀取圖像數據?*/
fread(image?1?bitmapInfoHeader.biSizeImage?pFile);

/**?將圖像顏色數據格式進行交換由BGR轉換為RGB?*/
for(int?index?=?0;?index? ???{
???textureColors?=?image[index];
???image[index]?=?image[index?+?2];
???image[index?+?2]?=?textureColors;
???}
??
fclose(pFile);???????/** return?true;?????????/**}

/**?釋放內存?*/
void?CBMPLoader::FreeImage()
{
???/**?釋放分配的內存?*/
???if(image)
??????{
?????????delete[]?image;
?????????image?=?0;
??????}
}

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2011-05-08?13:24??OpenGL實例編程精粹\
?????目錄???????????0??2011-05-08?13:19??OpenGL實例編程精粹\第10章\
?????目錄???????????0??2011-05-08?13:40??OpenGL實例編程精粹\第10章\Blend\
?????文件??????152516??2010-07-12?13:53??OpenGL實例編程精粹\第10章\Blend\bak.bmp
?????文件??????241664??2010-07-13?09:24??OpenGL實例編程精粹\第10章\Blend\Blend.exe
?????文件????????3347??2006-11-08?21:13??OpenGL實例編程精粹\第10章\Blend\Blend.rc
?????文件?????????870??2010-07-13?09:23??OpenGL實例編程精粹\第10章\Blend\Blend.sln
?????文件????????8704??2010-07-13?09:25??OpenGL實例編程精粹\第10章\Blend\Blend.suo
?????文件????????8704??2006-11-29?22:01??OpenGL實例編程精粹\第10章\Blend\Blend.suo.old
?????文件????????4917??2010-07-13?09:23??OpenGL實例編程精粹\第10章\Blend\Blend.vcproj
?????文件????????2649??2006-11-28?21:39??OpenGL實例編程精粹\第10章\Blend\CBMPLoader.cpp
?????文件????????1131??2006-11-28?21:39??OpenGL實例編程精粹\第10章\Blend\CBMPLoader.h
?????文件???????????9??2007-03-10?08:49??OpenGL實例編程精粹\第10章\Blend\Desktop_.ini
?????文件????????7293??2006-11-29?21:28??OpenGL實例編程精粹\第10章\Blend\Example.cpp
?????文件????????1998??2006-11-28?21:59??OpenGL實例編程精粹\第10章\Blend\Example.h
?????文件???????10694??2006-11-29?21:28??OpenGL實例編程精粹\第10章\Blend\GLframe.cpp
?????文件????????3778??2006-11-28?21:39??OpenGL實例編程精粹\第10章\Blend\GLframe.h
?????文件????????9530??2006-11-28?21:35??OpenGL實例編程精粹\第10章\Blend\GLWindow.cpp
?????文件????????2621??2006-11-28?21:39??OpenGL實例編程精粹\第10章\Blend\GLWindow.h
?????文件??????193590??2006-11-26?21:30??OpenGL實例編程精粹\第10章\Blend\image.bmp
?????文件?????????910??2006-11-08?21:00??OpenGL實例編程精粹\第10章\Blend\resource.h
?????文件????????2872??2006-11-28?21:39??OpenGL實例編程精粹\第10章\Blend\ScreenDlg.cpp
?????文件?????????922??2006-11-28?21:39??OpenGL實例編程精粹\第10章\Blend\ScreenDlg.h
?????目錄???????????0??2011-05-08?13:19??OpenGL實例編程精粹\第11章\
?????目錄???????????0??2011-05-08?13:40??OpenGL實例編程精粹\第11章\Antialiasing1\
?????文件??????236544??2010-07-13?09:24??OpenGL實例編程精粹\第11章\Antialiasing1\Antialiasing1.exe
?????文件????????3347??2006-11-08?21:13??OpenGL實例編程精粹\第11章\Antialiasing1\Antialiasing1.rc
?????文件?????????886??2010-07-13?09:24??OpenGL實例編程精粹\第11章\Antialiasing1\Antialiasing1.sln
?????文件????????8704??2010-07-13?09:25??OpenGL實例編程精粹\第11章\Antialiasing1\Antialiasing1.suo
?????文件????????7680??2006-12-01?19:14??OpenGL實例編程精粹\第11章\Antialiasing1\Antialiasing1.suo.old
?????文件????????4827??2010-07-13?09:24??OpenGL實例編程精粹\第11章\Antialiasing1\Antialiasing1.vcproj
............此處省略881個文件信息

評論

共有 條評論