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


C++ Texture::Bufferize方法代码示例

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


在下文中一共展示了Texture::Bufferize方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Process

void GMBufferTexture::Process()
{
	Texture * texturePtr;
	if (textureID != -1)
		texturePtr = TexMan.GetTextureByID(textureID);
	else
		texturePtr = t;

	if (texturePtr == NULL){
		std::cout<<"Null-Texture was queued to buffering!";
		return;
	}
	if (texturePtr->glid != -1 && !texturePtr->dynamic){
		std::cout<<"\nTexture "<<texturePtr->name<<" is already buffered (has glid)!";
		return;
	}

	texturePtr->Bufferize();
	return;
}
开发者ID:erenik,项目名称:engine,代码行数:20,代码来源:GMBufferTexture.cpp

示例2: RenderSelection

/// Render the character as selected.
void TextFont::RenderSelection(uchar c)
{
	/// No good solution for this... yet.
	if (shaderBased)
	{
		return;
	}

	// Stop the quads.
	glEnd();

	CheckGLError("TextFont::RenderSelection 1");

	// Switch to additive rendering 
	glBlendFunc(GL_SRC_ALPHA, GL_ONE);
	

	CheckGLError("TextFont::RenderSelection 1.5");

	int characterX = c % 16;
	int characterY = c / 16;
	/// Texture co-ordinates.
	float & xStart = pivotPoint[0];
	float & yStart = pivotPoint[1];
	
	// Bind the texture to use. Preferably a gray sort.
	Texture * tex = TexMan.GetTextureByHex32(0xFFFFFF22);
	if (tex->glid == -1)
		tex->Bufferize();
	glBindTexture(GL_TEXTURE_2D, tex->glid);

	CheckGLError("TextFont::RenderSelection 2");

	float width = this->charWidth[c];
	float halfWidth = width * 0.5f;

	// Render the quad!
	glBegin(GL_QUADS);

	float x1 = halfWidth * -halfScale[0] + xStart - padding[0] * 0.5f,
		x2 = halfWidth * halfScale[0] + xStart + padding[0] * 0.5f;

	// And actual rendering.
	glTexCoord2f(0, 1);
	glVertex3f(x2, -halfScale[1] + yStart, 0);
	glTexCoord2f(1, 1);
	glVertex3f(x1, -halfScale[1] + yStart, 0);
	glTexCoord2f(1, 0);
	glVertex3f(x1, halfScale[1] + yStart, 0);
	glTexCoord2f(0, 0);
	glVertex3f(x2, halfScale[1] + yStart, 0);

	glEnd();

	CheckGLError("TextFont::RenderSelection 3");

	// Re-bind old texture.
	glBindTexture(GL_TEXTURE_2D, this->texture->glid);

	// Reset blend-mode.
	glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

	CheckGLError("TextFont::RenderSelection 4");
	// Begin quads again.
	glBegin(GL_QUADS);
}
开发者ID:erenik,项目名称:engine,代码行数:67,代码来源:TextFont.cpp


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