本文整理汇总了C++中PSD::Load方法的典型用法代码示例。如果您正苦于以下问题:C++ PSD::Load方法的具体用法?C++ PSD::Load怎么用?C++ PSD::Load使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PSD
的用法示例。
在下文中一共展示了PSD::Load方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TextureUpdate
void TextureUpdate(const char *filename, int n)
{
glBindTexture(GL_TEXTURE_2D, texture[n]);
char fullname[256];
PSD psdimage;
CDDSImage image;
int psd = 0;
sprintf(fullname, "textures\\%s.psd", filename);
if (psdimage.Load(fullname))
{
psdimage.Upload2D(texinfo[n].mipmap);
}
else
{
sprintf(fullname, "textures\\%s.dds", filename);
if (image.load(fullname))
{
image.upload_texture2D();
}
}
}
示例2: CreateTexture
int CreateTexture(const char *filename, bool clamp, bool duplicate, unsigned int minfilter, unsigned int magfilter)
{
if (!filename)
{
// return -1;
return CreateTexture("default", false, false, GL_LINEAR_MIPMAP_LINEAR, GL_LINEAR);
}
if (duplicate == false)
{
for (int n = 0; n < textures; n++)
{
if (_stricmp(filename, texinfo[n].filename) == 0)
{
texinfo[n].refcount++;
return n;
}
}
}
char fullname[256];
PSD psdimage;
CDDSImage image;
int psd = 0;
sprintf(fullname, "textures\\%s.psd", filename);
if (psdimage.Load(fullname))
{
psd = 1;
}
else
{
sprintf(fullname, "textures\\%s.dds", filename);
if (!image.load(fullname))
{
// return -1;
return CreateTexture("default", false, false, GL_LINEAR_MIPMAP_LINEAR, GL_LINEAR);
}
}
texture = (unsigned int*)realloc(texture, sizeof(unsigned int) * (textures + 1));
texinfo = (TexInfo*)realloc(texinfo, sizeof(TexInfo) * (textures + 1));
int mipmap = 0;
if (minfilter == GL_NEAREST_MIPMAP_NEAREST || minfilter == GL_LINEAR_MIPMAP_NEAREST || minfilter == GL_NEAREST_MIPMAP_LINEAR || minfilter == GL_LINEAR_MIPMAP_LINEAR)
mipmap = 1;
glGenTextures(1, &texture[textures]);
glBindTexture(GL_TEXTURE_2D, texture[textures]);
if (psd)
{
psdimage.Upload2D(mipmap);
}
else
{
image.upload_texture2D();
}
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, minfilter);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, magfilter);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, anisotropy);
if (clamp)
{
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
}
strcpy(texinfo[textures].filename, filename);
if (psd)
{
texinfo[textures].width = psdimage.width;
texinfo[textures].height = psdimage.height;
}
else
{
texinfo[textures].width = image.get_width();
texinfo[textures].height = image.get_height();
}
texinfo[textures].mipmap = mipmap;
texinfo[textures].refcount = 1;
psdimage.Clear();
image.clear();
textures++;
return textures - 1;
}