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


C++ ProgramObject::Uniform方法代码示例

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


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

示例1: DrawWhiteBorders

void CubeBlock::DrawWhiteBorders(GLRenderingContext *rc, bool whiteBorders)
{
	if (whiteBorders) {
		borderAmbient = Color3f(0.8f);
		borderDiffuse = Color3f(0.85f);
	}
	else {
		borderAmbient = Color3f(0.0f);
		borderDiffuse = Color3f(0.35f);
	}
	ProgramObject *p = rc->GetCurProgram();
	p->Uniform("BorderMaterial.ambient", 1, borderAmbient.data);
	p->Uniform("BorderMaterial.diffuse", 1, borderDiffuse.data);
}
开发者ID:alexgaiv,项目名称:cubex,代码行数:14,代码来源:cubeblock.cpp

示例2: vshader

void GLRC_Text2DModule::Initialize(GLRenderingContext *rc)
{
	if (GLEW_ARB_shader_objects) {
		prog = new ProgramObject(rc);

		Shader vshader(GL_VERTEX_SHADER);
		Shader fshader(GL_FRAGMENT_SHADER);
		vshader.CompileSource(shaderSource[0]);
		fshader.CompileSource(shaderSource[1]);
		prog->AttachShader(vshader);
		prog->AttachShader(fshader);
		prog->Link();
		prog->Uniform("ColorMap", 0);
	}
	else prog = NULL;
}
开发者ID:alexgaiv,项目名称:cubex,代码行数:16,代码来源:text2d.cpp

示例3: Render

void CubeBlock::Render()
{
	rc->PushModelView();
	this->ApplyTransform();

	if (!GLEW_ARB_shader_objects) {
		RenderFixed();
		rc->PopModelView();
		return;
	}

	ProgramObject *program = rc->GetCurProgram();

	for (int i = 0; i < 6; i++)
	{
		if (!fRenderPickMode) {
			Color3f *c = GetSideColor(i);
			if (c == &borderDiffuse)
				program->Uniform("RenderBackSide", 1);

			program->Uniform("Mode", 0);
			program->Uniform("FrontMaterial.ambient", 1, Color3f(1).data);
			program->Uniform("FrontMaterial.diffuse", 1, c->data);
			program->Uniform("FrontMaterial.shininess", 70);

			rc->PushModelView();
				rc->MultModelView(face_transform[i]);
				face->Draw();
			rc->PopModelView();

			if (c == &borderDiffuse)
				program->Uniform("RenderBackSide", 0);
		}
		else {
			int id = pickId | (1 << (i+10));
			GLubyte r = id & 0xff;
			GLubyte g = id >> 8;

			program->Uniform("Mode", 2);
			program->Uniform("FrontMaterial.diffuse", r/255.0f, g/255.0f, 1/255.0f);
			
			rc->PushModelView();
				rc->MultModelView(face_transform[i]);
				face_pickMode->Draw();
			rc->PopModelView();
		}
	}

	if (!fRenderPickMode)
	{
		program->Uniform("Mode", 1);
		program->Uniform("FrontMaterial.ambient", 1, borderAmbient.data);
		program->Uniform("FrontMaterial.diffuse", 1, borderDiffuse.data);

		if (fUseReducedModel) {
			program->Uniform("UseSpecularMap", 0);
			program->Uniform("FrontMaterial.shininess", 70);
			border_reduced->Draw();
		}
		else {
			program->Uniform("UseSpecularMap", 1);
			program->Uniform("FrontMaterial.shininess", 200);
			border->Draw();
		}
	}

	rc->PopModelView();
}
开发者ID:alexgaiv,项目名称:cubex,代码行数:68,代码来源:cubeblock.cpp


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