当前位置: 首页>>代码示例>>C++>>正文


C++ PSD::Upload2D方法代码示例

本文整理汇总了C++中PSD::Upload2D方法的典型用法代码示例。如果您正苦于以下问题:C++ PSD::Upload2D方法的具体用法?C++ PSD::Upload2D怎么用?C++ PSD::Upload2D使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PSD的用法示例。


在下文中一共展示了PSD::Upload2D方法的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();
		}
	}
}
开发者ID:MounikaArkala,项目名称:txstateprojects,代码行数:23,代码来源:texture.cpp

示例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;
}
开发者ID:MounikaArkala,项目名称:txstateprojects,代码行数:92,代码来源:texture.cpp


注:本文中的PSD::Upload2D方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。