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

  • 大小: 134KB
    文件類型: .rar
    金幣: 2
    下載: 1 次
    發布日期: 2021-05-24
  • 語言: 其他
  • 標簽: opengl??texture??render??

資源簡介

opengl渲染到紋理技術,RendertoaTexture很好的例子

資源截圖

代碼片段和文件信息

//***********************************************************************//
// ?//
// -?“Talk?to?me?like?I‘m?a?3?year?old!“?Programming?Lessons?- ?//
//???????????????????????????????????????????????????????????????????????//
// $Author: DigiBen digiben@gametutorials.com ?//
// ?//
// $Program: RenderToTexture ?//
// ?//
// $Description: Demonstrates?how?to?render?screen?to?a?texture ?//
// ?//
// $Date: 2/27/02 ?//
// ?//
//***********************************************************************//


#include?“main.h“


/////////////////////////////////?CREATE?TEXTURE?\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*
/////
///// This?creates?a?texture?in?OpenGL?that?we?can?texture?map
/////
/////////////////////////////////?CREATE?TEXTURE?\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*

void?CreateTexture(UINT?textureArray[]?LPSTR?strFileName?int?textureID)
{
AUX_RGBImageRec?*pBitmap?=?NULL;

if(!strFileName) //?Return?from?the?function?if?no?file?name?was?passed?in
return;

//?We?need?to?load?the?texture?data?so?we?use?a?cool?API?that?the?glaux.lib?offers.

pBitmap?=?auxDIBImageLoad(strFileName); //?Load?the?bitmap?and?store?the?data

if(pBitmap?==?NULL) //?If?we?can‘t?load?the?file?quit!
exit(0);

//?Generate?a?texture?with?the?associative?texture?ID?stored?in?the?array
glGenTextures(1?&textureArray[textureID]);

//?Bind?the?texture?to?the?texture?arrays?index?and?init?the?texture
glBindTexture(GL_TEXTURE_2D?textureArray[textureID]);

//?Build?Mipmaps?(builds?different?versions?of?the?picture?for?distances?-?looks?better)
gluBuild2DMipmaps(GL_TEXTURE_2D?3?pBitmap->sizeX?pBitmap->sizeY?GL_RGB?GL_UNSIGNED_BYTE?pBitmap->data);

//?Lastly?we?need?to?tell?OpenGL?the?quality?of?our?texture?map.??GL_LINEAR_MIPMAP_LINEAR
//?is?the?smoothest.??GL_LINEAR_MIPMAP_NEAREST?is?faster?than?GL_LINEAR_MIPMAP_LINEAR?
//?but?looks?blochy?and?pixilated.??Good?for?slower?computers?though.??

glTexParameteri(GL_TEXTURE_2DGL_TEXTURE_MIN_FILTERGL_LINEAR_MIPMAP_NEAREST);
glTexParameteri(GL_TEXTURE_2DGL_TEXTURE_MAG_FILTERGL_LINEAR);

//?Now?we?need?to?free?the?bitmap?data?that?we?loaded?since?openGL?stored?it?as?a?texture

if?(pBitmap) //?If?we?loaded?the?bitmap
{
if?(pBitmap->data) //?If?there?is?texture?data
{
free(pBitmap->data); //?Free?the?texture?data?we?don‘t?need?it?anymore
}

free(pBitmap); //?Free?the?bitmap?structure
}
}


/////////////////////////////////?CHANGE?TO?FULL?SCREEN?\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*
/////
///// This?changes?the?screen?to?FULL?SCREEN
/////
/////////////////////////////////?CHANGE?TO?FULL?SCREEN?\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*

void?ChangeToFullScreen()
{
DEVMODE?dmSettings; //?Device?Mode?variable

memset(&dmSettings0sizeof(dmSettings)); //?Makes?Sure

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----

?????文件???????4410??2005-01-09?23:45??Render?to?a?Texture\RenderToTexture.vcproj

?????文件??????19377??2003-11-20?00:36??Render?to?a?Texture\Main.cpp

?????文件????????919??2005-01-09?23:45??Render?to?a?Texture\RenderToTexture.sln

?????文件??????12795??2003-11-20?00:37??Render?to?a?Texture\Init.cpp

?????文件?????196662??2002-02-28?01:59??Render?to?a?Texture\Brick.bmp

?????文件???????3096??2002-02-28?01:56??Render?to?a?Texture\main.h

?????文件??????49152??2003-11-20?00:37??Render?to?a?Texture\RenderToTexture.exe

?????文件???????2108??2003-04-20?17:51??Render?to?a?Texture\ReadMe?-?RenderToTexture.txt

?????目錄??????????0??2008-05-01?01:47??Render?to?a?Texture

-----------?---------??----------?-----??----

???????????????288737????????????????????10


評論

共有 條評論