本文整理汇总了C++中GraphicContext::is_frame_buffer_owner方法的典型用法代码示例。如果您正苦于以下问题:C++ GraphicContext::is_frame_buffer_owner方法的具体用法?C++ GraphicContext::is_frame_buffer_owner怎么用?C++ GraphicContext::is_frame_buffer_owner使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GraphicContext
的用法示例。
在下文中一共展示了GraphicContext::is_frame_buffer_owner方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setup
void LightsourceSimplePass::setup(GraphicContext &gc)
{
Size viewport_size = viewport->get_size();
if (fb.is_null() || !gc.is_frame_buffer_owner(fb) || final_color.updated() || zbuffer.updated() || diffuse_color_gbuffer.updated())
{
final_color.set(Texture2D(gc, viewport->get_width(), viewport->get_height(), tf_rgba16f));
fb = FrameBuffer(gc);
fb.attach_color(0, final_color.get());
fb.attach_depth(zbuffer.get());
BlendStateDescription blend_desc;
blend_desc.enable_blending(true);
blend_desc.set_blend_function(blend_one, blend_one, blend_one, blend_one);
blend_state = BlendState(gc, blend_desc);
DepthStencilStateDescription icosahedron_depth_stencil_desc;
icosahedron_depth_stencil_desc.enable_depth_write(false);
icosahedron_depth_stencil_desc.enable_depth_test(true);
icosahedron_depth_stencil_desc.set_depth_compare_function(compare_lequal);
icosahedron_depth_stencil_state = DepthStencilState(gc, icosahedron_depth_stencil_desc);
RasterizerStateDescription icosahedron_rasterizer_desc;
icosahedron_rasterizer_desc.set_culled(true);
icosahedron_rasterizer_state = RasterizerState(gc, icosahedron_rasterizer_desc);
DepthStencilStateDescription rect_depth_stencil_desc;
rect_depth_stencil_desc.enable_depth_write(false);
rect_depth_stencil_desc.enable_depth_test(false);
rect_depth_stencil_state = DepthStencilState(gc, rect_depth_stencil_desc);
RasterizerStateDescription rect_rasterizer_desc;
rect_rasterizer_desc.set_culled(false);
rect_rasterizer_state = RasterizerState(gc, rect_rasterizer_desc);
uniforms = UniformVector<Uniforms>(gc, 1);
icosahedron_prim_array = PrimitivesArray(gc);
icosahedron_prim_array.set_attributes(0, icosahedron->vertices);
Vec4f positions[6] =
{
Vec4f(-1.0f, -1.0f, 1.0f, 1.0f),
Vec4f( 1.0f, -1.0f, 1.0f, 1.0f),
Vec4f(-1.0f, 1.0f, 1.0f, 1.0f),
Vec4f( 1.0f, -1.0f, 1.0f, 1.0f),
Vec4f(-1.0f, 1.0f, 1.0f, 1.0f),
Vec4f( 1.0f, 1.0f, 1.0f, 1.0f)
};
rect_positions = VertexArrayVector<Vec4f>(gc, positions, 6);
rect_prim_array = PrimitivesArray(gc);
rect_prim_array.set_attributes(0, rect_positions);
}
}
示例2: setup
void ParticleEmitterPass::setup(GraphicContext &gc)
{
if (program.is_null())
{
std::string vertex_filename = PathHelp::combine(shader_path, "ParticleEmitter/vertex.hlsl");
std::string fragment_filename = PathHelp::combine(shader_path, "ParticleEmitter/fragment.hlsl");
program = ProgramObject::load(gc, vertex_filename, fragment_filename);
program.bind_attribute_location(0, "AttrPosition");
program.bind_frag_data_location(0, "FragColor");
if (!program.link())
throw Exception(string_format("Particle emitter program failed to link: %1", program.get_info_log()));
program.set_uniform_buffer_index("Uniforms", 0);
program.set_uniform1i("NormalZTexture", 0);
program.set_uniform1i("InstanceTexture", 1);
program.set_uniform1i("ParticleTexture", 2);
program.set_uniform1i("ParticleSampler", 2);
program.set_uniform1i("ColorGradientTexture", 3);
program.set_uniform1i("ColorGradientSampler", 3);
billboard_positions = VertexArrayVector<Vec3f>(gc, cpu_billboard_positions, 6);
}
Size viewport_size = viewport->get_size();
if (fb.is_null() || !gc.is_frame_buffer_owner(fb) || final_color.updated() || zbuffer.updated())
{
fb = FrameBuffer(gc);
fb.attach_color(0, final_color.get());
fb.attach_depth(zbuffer.get());
BlendStateDescription blend_desc;
blend_desc.enable_blending(true);
blend_desc.set_blend_function(blend_src_alpha, blend_one_minus_src_alpha, blend_zero, blend_zero);
blend_state = BlendState(gc, blend_desc);
DepthStencilStateDescription depth_stencil_desc;
depth_stencil_desc.enable_depth_write(false);
depth_stencil_desc.enable_depth_test(true);
depth_stencil_desc.set_depth_compare_function(compare_lequal);
depth_stencil_state = DepthStencilState(gc, depth_stencil_desc);
RasterizerStateDescription rasterizer_desc;
rasterizer_desc.set_culled(false);
rasterizer_state = RasterizerState(gc, rasterizer_desc);
prim_array = PrimitivesArray(gc);
prim_array.set_attributes(0, billboard_positions);
}
}