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


C++ GraphicContext::get_height方法代码示例

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


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

示例1: render

void App::render(GraphicContext &gc)
{
	gc.clear(Colorf(0.0f, 0.0f, 0.0f, 1.0f));

	Rect viewport_rect(0, 0, Size(gc.get_width(), gc.get_height()));
	gc.set_viewport(viewport_rect);

	gc.clear_depth(1.0f);

	Mat4f modelview_matrix = scene.gs->camera_modelview;
	scene.Draw(modelview_matrix, gc);
	gc.reset_program_object();
}
开发者ID:Cemenyave,项目名称:ClanLib,代码行数:13,代码来源:example.cpp

示例2: render_texture

void HSV::render_texture(Canvas &canvas, ProgramObject &program, Texture &texture, float hue_offset)
{
	GraphicContext gc = canvas.get_gc();

	Rectf rect(0.0f, 0.0f, (float)gc.get_width(), (float)gc.get_height());
	Rectf texture_unit1_coords(0.0f, 0.0f, 1.0f, 1.0f);

	Vec2f positions[6] =
	{
		Vec2f(rect.left, rect.top),
		Vec2f(rect.right, rect.top),
		Vec2f(rect.left, rect.bottom),
		Vec2f(rect.right, rect.top),
		Vec2f(rect.left, rect.bottom),
		Vec2f(rect.right, rect.bottom)
	};

	Vec2f tex1_coords[6] =
	{
		Vec2f(texture_unit1_coords.left, texture_unit1_coords.top),
		Vec2f(texture_unit1_coords.right, texture_unit1_coords.top),
		Vec2f(texture_unit1_coords.left, texture_unit1_coords.bottom),
		Vec2f(texture_unit1_coords.right, texture_unit1_coords.top),
		Vec2f(texture_unit1_coords.left, texture_unit1_coords.bottom),
		Vec2f(texture_unit1_coords.right, texture_unit1_coords.bottom)
	};

	PrimitivesArray primarray(gc);

	VertexArrayVector<Vec2f> gpu_positions = VertexArrayVector<Vec2f>(gc, positions, 6);
	VertexArrayVector<Vec2f> gpu_tex1_coords = VertexArrayVector<Vec2f>(gc, tex1_coords, 6);

	primarray.set_attributes(0, gpu_positions);
	primarray.set_attributes(1, gpu_tex1_coords);

	ProgramUniforms buffer;
	buffer.cl_ModelViewProjectionMatrix = canvas.get_projection() * canvas.get_modelview();
	buffer.HueOffset0 = hue_offset;
	UniformVector<ProgramUniforms> uniform_vector(gc, &buffer, 1);
	gc.set_uniform_buffer(0, uniform_vector);

	gc.set_texture(0, texture);
	gc.set_program_object(program);
	gc.draw_primitives(type_triangles, 6, primarray);
	gc.reset_program_object();
	gc.reset_texture(0);
}
开发者ID:Zenol,项目名称:clanLib-3,代码行数:47,代码来源:hsv.cpp

示例3: calculate_matricies

void App::calculate_matricies(GraphicContext &gc)
{
	scene.gs->camera_projection = Mat4f::perspective(45.0f, ((float) gc.get_width()) / ((float) gc.get_height()), 0.1f, 1000.0f, handed_left, clip_negative_positive_w);

	float ortho_size = 60.0f / 2.0f;
	scene.gs->light_projection = Mat4f::ortho(-ortho_size, ortho_size, -ortho_size, ortho_size, 0.1f, 1000.0f, handed_left, clip_negative_positive_w);

	scene.gs->camera_modelview = Mat4f::identity();
	camera->GetWorldMatrix(scene.gs->camera_modelview);
	scene.gs->camera_modelview.inverse();

	scene.gs->light_modelview = Mat4f::identity();
	light_distant->GetWorldMatrix(scene.gs->light_modelview);
	scene.gs->light_modelview.inverse();
}
开发者ID:Cemenyave,项目名称:ClanLib,代码行数:15,代码来源:example.cpp


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