本文整理汇总了C++中GraphicContext::reset_blend_state方法的典型用法代码示例。如果您正苦于以下问题:C++ GraphicContext::reset_blend_state方法的具体用法?C++ GraphicContext::reset_blend_state怎么用?C++ GraphicContext::reset_blend_state使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GraphicContext
的用法示例。
在下文中一共展示了GraphicContext::reset_blend_state方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: flush
void RenderBatchTriangle::flush(GraphicContext &gc)
{
if (position > 0)
{
gc.set_program_object(program_sprite);
int gpu_index;
VertexArrayVector<SpriteVertex> gpu_vertices(batch_buffer->get_vertex_buffer(gc, gpu_index));
if (prim_array[gpu_index].is_null())
{
prim_array[gpu_index] = PrimitivesArray(gc);
prim_array[gpu_index].set_attributes(0, gpu_vertices, cl_offsetof(SpriteVertex, position));
prim_array[gpu_index].set_attributes(1, gpu_vertices, cl_offsetof(SpriteVertex, color));
prim_array[gpu_index].set_attributes(2, gpu_vertices, cl_offsetof(SpriteVertex, texcoord));
prim_array[gpu_index].set_attributes(3, gpu_vertices, cl_offsetof(SpriteVertex, texindex));
if (glyph_blend.is_null())
{
BlendStateDescription blend_desc;
blend_desc.set_blend_function(blend_constant_color, blend_one_minus_src_color, blend_zero, blend_one);
glyph_blend = BlendState(gc, blend_desc);
}
}
gpu_vertices.upload_data(gc, 0, vertices, position);
for (int i = 0; i < num_current_textures; i++)
gc.set_texture(i, current_textures[i]);
if (use_glyph_program)
{
gc.set_blend_state(glyph_blend, constant_color);
gc.draw_primitives(type_triangles, position, prim_array[gpu_index]);
gc.reset_blend_state();
}
else
{
gc.draw_primitives(type_triangles, position, prim_array[gpu_index]);
}
for (int i = 0; i < num_current_textures; i++)
gc.reset_texture(i);
gc.reset_program_object();
position = 0;
for (int i = 0; i < num_current_textures; i++)
current_textures[i] = Texture2D();
num_current_textures = 0;
}
}
示例2: draw
void ShaderEffect::draw(GraphicContext &gc)
{
gc.set_program_object(impl->program);
if (!impl->fb.is_null())
gc.set_frame_buffer(impl->fb);
if (!impl->rasterizer_state.is_null())
gc.set_rasterizer_state(impl->rasterizer_state);
if (!impl->blend_state.is_null())
gc.set_blend_state(impl->blend_state);
if (!impl->depth_stencil_state.is_null())
gc.set_depth_stencil_state(impl->depth_stencil_state);
for (auto & elem : impl->uniform_bindings)
{
gc.set_uniform_buffer(elem.first, elem.second);
}
for (auto & elem : impl->storage_bindings)
{
gc.set_storage_buffer(elem.first, elem.second);
}
for (auto & elem : impl->image_bindings)
{
gc.set_image_texture(elem.first, elem.second);
}
for (auto & elem : impl->texture_bindings)
{
gc.set_texture(elem.first, elem.second);
}
if (!impl->elements.is_null())
{
gc.set_primitives_elements(impl->elements);
gc.set_primitives_array(impl->prim_array);
gc.draw_primitives_elements(type_triangles, impl->num_vertices, impl->elements_type);
gc.reset_primitives_array();
gc.reset_primitives_elements();
}
else
{
gc.set_primitives_array(impl->prim_array);
gc.draw_primitives_array(type_triangles, 0, impl->num_vertices);
gc.reset_primitives_array();
}
for (auto & elem : impl->uniform_bindings)
{
gc.reset_uniform_buffer(elem.first);
}
for (auto & elem : impl->storage_bindings)
{
gc.reset_storage_buffer(elem.first);
}
for (auto & elem : impl->image_bindings)
{
gc.reset_image_texture(elem.first);
}
for (auto & elem : impl->texture_bindings)
{
gc.reset_texture(elem.first);
}
if (!impl->rasterizer_state.is_null())
gc.reset_rasterizer_state();
if (!impl->blend_state.is_null())
gc.reset_blend_state();
if (!impl->depth_stencil_state.is_null())
gc.reset_depth_stencil_state();
if (!impl->fb.is_null())
gc.reset_frame_buffer();
gc.reset_program_object();
}