本文整理汇总了C++中TextureLoader::LoadTextureFromDisk方法的典型用法代码示例。如果您正苦于以下问题:C++ TextureLoader::LoadTextureFromDisk方法的具体用法?C++ TextureLoader::LoadTextureFromDisk怎么用?C++ TextureLoader::LoadTextureFromDisk使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TextureLoader
的用法示例。
在下文中一共展示了TextureLoader::LoadTextureFromDisk方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: InitializeFreezeParticleShader
void FreezeParticle::InitializeFreezeParticleShader()
{
TextureLoader textureLoader;
glTexture FreezeParticleTexture;
FreezeParticleProfile = cgGLGetLatestProfile(CG_GL_FRAGMENT);
cgGLSetOptimalOptions(FreezeParticleProfile);
CheckForCgError("FreezeParticle", "selecting fragment profile");
FreezeParticleProgram = cgCreateProgramFromFile(ShaderContext, CG_SOURCE, "assets/pixelshaders/ps_freezeparticle.cg", FreezeParticleProfile, "pixelMain", 0);
CheckForCgError("FreezeParticle", "creating fragment program from file");
cgGLLoadProgram(FreezeParticleProgram);
CheckForCgError("FreezeParticle", "loading fragment program");
FreezeParticleCoord0 = cgGetNamedParameter(FreezeParticleProgram, "texcoord0");
textureLoader.LoadTextureFromDisk("assets/textures/weapon/freezeparticle.tga", &FreezeParticleTexture);
FreezeParticleText1 = cgGetNamedParameter(FreezeParticleProgram, "text1");
cgGLSetTextureParameter(FreezeParticleText1, FreezeParticleTexture.TextureID);
CheckForCgError("FreezeParticle", "setting decal 2D texture");
}
示例2: InitializeSkydomeShaders
void Skydome::InitializeSkydomeShaders() {
TextureLoader textureLoader;
glTexture daySky, nightSky, redSky, sun, sunMask;
textureLoader.LoadTextureFromDisk("assets/textures/sky/clouds2.tga", &daySky);
textureLoader.LoadTextureFromDisk("assets/textures/sky/night.tga", &nightSky);
textureLoader.LoadTextureFromDisk("assets/textures/sky/red.tga", &redSky);
/*
//Vertext Shader profile
vsSkydomeProfile = cgGLGetLatestProfile(CG_GL_VERTEX);
//Set profile
cgGLSetOptimalOptions(vsFireballProfile);
CheckForCgError("skydome", "selecting vertex profile");
//Load vertex shader
vsFireballProgram = cgCreateProgramFromFile(ShaderContext, CG_SOURCE, "assets/vertexshaders/vs_fireball.cg", vsFireballProfile, "vertMain", 0);
CheckForCgError("skydome", "creating vertex program from file");
cgGLLoadProgram(vsFireballProgram);
CheckForCgError("skydome", "loading vertex program");
texVert = cgGetNamedParameter(vsFireballProgram, "texCoordIN");
position = cgGetNamedParameter(vsFireballProgram, "posIN");
move = cgGetNamedParameter(vsFireballProgram, "move");
mvMatrix = cgGetNamedParameter(vsFireballProgram, "ModelViewProj");
*/
/////////////////////////////
//Pixel Shader
psSkydomeProfile = cgGLGetLatestProfile(CG_GL_FRAGMENT);
cgGLSetOptimalOptions(psSkydomeProfile);
CheckForCgError("skydome", "selecting Skydome fragment profile");
psSkydomeProgram = cgCreateProgramFromFile(ShaderContext, CG_SOURCE, "assets/pixelshaders/ps_skydome.cg", psSkydomeProfile, "pixelMain", 0);
CheckForCgError("skydome", "creating fragment program from file");
cgGLLoadProgram(psSkydomeProgram);
CheckForCgError("skydome", "loading fragment program");
texcoord0 = cgGetNamedParameter(psSkydomeProgram, "texcoord0");
dayTime = cgGetNamedParameter(psSkydomeProgram, "lightdist");
transition = cgGetNamedParameter(psSkydomeProgram, "transition");
text1 = cgGetNamedParameter(psSkydomeProgram, "text1");
cgGLSetTextureParameter(text1, daySky.TextureID);
text2 = cgGetNamedParameter(psSkydomeProgram, "text2");
cgGLSetTextureParameter(text2, nightSky.TextureID);
text3 = cgGetNamedParameter(psSkydomeProgram, "text3");
cgGLSetTextureParameter(text3, redSky.TextureID);
CheckForCgError("skydome", "setting decal 2D texture");
textureLoader.LoadTextureFromDisk("assets/textures/sky/sun.tga", &sun);
textureLoader.LoadTextureFromDisk("assets/textures/sky/sunmask.tga", &sunMask);
psSkydomeSunProfile = cgGLGetLatestProfile(CG_GL_FRAGMENT);
cgGLSetOptimalOptions(psSkydomeSunProfile);
CheckForCgError("skydome", "selecting Skydome sun fragment profile");
psSkydomeSunProgram = cgCreateProgramFromFile(ShaderContext, CG_SOURCE, "assets/pixelshaders/ps_skydomeSun.cg", psSkydomeSunProfile, "pixelMain", 0);
CheckForCgError("skydome", "creating fragment program from file");
cgGLLoadProgram(psSkydomeSunProgram);
CheckForCgError("skydome", "loading fragment program");
texcoord0 = cgGetNamedParameter(psSkydomeSunProgram, "texcoord0");
suntext1 = cgGetNamedParameter(psSkydomeSunProgram, "text1");
cgGLSetTextureParameter(suntext1, sun.TextureID);
suntext2 = cgGetNamedParameter(psSkydomeSunProgram, "text2");
cgGLSetTextureParameter(suntext2, sunMask.TextureID);
CheckForCgError("skydome", "setting decal 2D texture");
//Temporarily Unbind Texture
//glDisable(GL_TEXTURE_2D);
//glDisable(GL_BLEND); // Disable Blending
//glBindTexture(GL_TEXTURE_2D,0);
}
示例3: InitializeSargeShaders
void Sarge::InitializeSargeShaders() {
TextureLoader textureLoader;
/////////////////////////////
//Vertex Shader
vsSargeProfile = cgGLGetLatestProfile(CG_GL_VERTEX);
cgGLSetOptimalOptions(vsSargeProfile);
CheckForCgError("sarge", "selecting vertex profile");
vsSargeProgram = cgCreateProgramFromFile(ShaderContext, CG_SOURCE, "assets/vertexshaders/vs_sarge.cg", vsSargeProfile, "sargeVertexShader", 0);
CheckForCgError("sarge", "creating vertex program from file");
cgGLLoadProgram(vsSargeProgram);
CheckForCgError("sarge", "loading vertex program");
//////////////////////////////
//Pixel Shader
psSargeProfile = cgGLGetLatestProfile(CG_GL_FRAGMENT);
cgGLSetOptimalOptions(psSargeProfile);
CheckForCgError("sarge", "selecting pixel profile");
psSargeProgram = cgCreateProgramFromFile(ShaderContext, CG_SOURCE, "assets/pixelshaders/ps_sarge.cg", psSargeProfile, "sargeLightMap", 0);
CheckForCgError("sarge", "creating fragment program from file");
cgGLLoadProgram(psSargeProgram);
CheckForCgError("sarge", "loading fragment program");
modelViewProj = cgGetNamedParameter(vsSargeProgram, "modelViewProj");
lightViewProj = cgGetNamedParameter(vsSargeProgram, "lightViewProj");
vertin = cgGetNamedParameter(vsSargeProgram, "vertin");
lightPosition = cgGetNamedParameter(vsSargeProgram, "lightPosition");
fragin = cgGetNamedParameter(psSargeProgram, "fragin");
eyevector = cgGetNamedParameter(psSargeProgram, "eyevector");
CheckForCgError("sarge", "getting parameters");
textureLoader.LoadTextureFromDisk("assets/textures/shadermaps/sarge_normalmap.tga", &sargeNormalTexture);
textureLoader.LoadTextureFromDisk("assets/textures/shadermaps/sarge_colormap.tga", &sargeColorTexture);
//textureLoader.LoadTextureFromDisk("assets/textures/weapon/fire1.tga", &sargeColorTexture);
normalmap = cgGetNamedParameter(psSargeProgram, "normalmap");
cgGLSetTextureParameter(normalmap, sargeNormalTexture.TextureID);
decalmap = cgGetNamedParameter(psSargeProgram, "decalmap");
cgGLSetTextureParameter(decalmap, sargeColorTexture.TextureID);
CheckForCgError("sarge", "setting decal 2D texture");
/*
decalmap = cgGetNamedParameter(psSargeProgram, "decalmap");
cgGLSetTextureParameter(text1, sargeColorTexture.TextureID);
CheckForCgError("sarge", "setting decal 2D texture");
*/
mMeshObject.Scale(1.6f);
}