本文整理汇总了C++中CL_GraphicContext::draw_primitives_array方法的典型用法代码示例。如果您正苦于以下问题:C++ CL_GraphicContext::draw_primitives_array方法的具体用法?C++ CL_GraphicContext::draw_primitives_array怎么用?C++ CL_GraphicContext::draw_primitives_array使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CL_GraphicContext
的用法示例。
在下文中一共展示了CL_GraphicContext::draw_primitives_array方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Draw
void ObjectPolygon::Draw(CL_GraphicContext &gc, CL_Texture &texture_image)
{
ObjectVertex *vptr = m_pVertex;
CL_Vec3f positions[6];
CL_Vec3f texture_positions[6];
CL_Vec3f normals[6];
// We convert quads into triangles. This is silly, and this entire example should be rewritten to just use triangles
if (m_NumVertex!=4) throw CL_Exception("Ooops");
positions[0] = m_pVertex[0].m_Point;
texture_positions[0] = m_pVertex[0].m_TexturePoint;
normals[0] = m_Normal;
positions[1] = m_pVertex[1].m_Point;
texture_positions[1] = m_pVertex[1].m_TexturePoint;
normals[1] = m_Normal;
positions[2] = m_pVertex[2].m_Point;
texture_positions[2] = m_pVertex[2].m_TexturePoint;
normals[2] = m_Normal;
positions[3] = m_pVertex[2].m_Point;
texture_positions[3] = m_pVertex[2].m_TexturePoint;
normals[3] = m_Normal;
positions[4] = m_pVertex[3].m_Point;
texture_positions[4] = m_pVertex[3].m_TexturePoint;
normals[4] = m_Normal;
positions[5] = m_pVertex[0].m_Point;
texture_positions[5] = m_pVertex[0].m_TexturePoint;
normals[5] = m_Normal;
CL_PrimitivesArray prim_array(gc);
gc.set_texture(0, texture_image);
prim_array.set_attributes(cl_attrib_position, positions);
prim_array.set_attribute(cl_attrib_color, CL_Colorf(1.0f,1.0f,1.0f, 1.0f));
prim_array.set_attributes(cl_attrib_texture_position, texture_positions);
prim_array.set_attributes(cl_attrib_normal, normals);
gc.set_primitives_array(prim_array);
gc.draw_primitives_array(cl_triangles, 6);
gc.reset_texture(0);
gc.reset_primitives_array();
}