本文整理汇总了C++中RenderElement::GetColor方法的典型用法代码示例。如果您正苦于以下问题:C++ RenderElement::GetColor方法的具体用法?C++ RenderElement::GetColor怎么用?C++ RenderElement::GetColor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RenderElement
的用法示例。
在下文中一共展示了RenderElement::GetColor方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: RenderText
void RendererOpenGL::RenderText( const RenderElement& _Text )
#endif
{
#ifdef MULTIPLE_RENDER_ELEMENTS
FontCPtr spFont = _spText->GetFont();
#else
FontCPtr spFont = _Text.GetFont();
#endif
if ( spFont == NULL )
{
CF_WARN( "No font set to render text." );
return;
}
#ifdef MULTIPLE_RENDER_ELEMENTS
const CFoundation::String& strText = _spText->GetText();
#else
const CFoundation::String& strText = _Text.GetText();
#endif
if ( strText.GetLength() == 0 )
{
return;
}
#ifdef MULTIPLE_RENDER_ELEMENTS
const CFoundation::Vector2Di& vPosition = _spText->GetPosition();
const CFoundation::Color& color = _spText->GetColor();
#else
const CFoundation::Vector2Di& vPosition = _Text.GetPosition();
const CFoundation::Color& color = _Text.GetColor();
#endif
// Set text color
Float16 f16R, f16G, f16B, f16A;
color.ToRGBA( f16R, f16G, f16B, f16A );
glColor4f( f16R, f16G, f16B, f16A );
spFont->Activate();
// Move to right position
glLoadIdentity();
glTranslated( vPosition.GetX(),
vPosition.GetY(),
0.0 );
// Draw text
glCallLists( strText.GetLength(), GL_UNSIGNED_SHORT, strText.wc_str() );
spFont->Deactivate();
}
示例2: RenderPrimitives
void RendererOpenGL::RenderPrimitives( const RenderElement& _Primitives )
#endif
{
PROFILING( "Render Primitives" );
#ifdef MULTIPLE_RENDER_ELEMENTS
RenderElementPrimitives::Type eType = _spPrimitives->GetType();
const CFoundation::Color& color = _spPrimitives->GetColor();
Float16 f16Thickness = _spPrimitives->GetThickness();
const RenderElementPrimitives::PointVec& avPoints = _spPrimitives->GetPoints();
#else
RenderElement::Type eType = _Primitives.GetType();
const CFoundation::Color& color = _Primitives.GetColor();
Float16 f16Thickness = _Primitives.GetThickness();
const RenderElement::PointVec& avPoints = _Primitives.GetPoints();
#endif
// Get opengl type
Unsigned32 u32Type = 0;
switch ( eType )
{
#ifdef MULTIPLE_RENDER_ELEMENTS
case RenderElementPrimitives::TYPE_POINTS:
#else
case RenderElement::TYPE_POINTS:
#endif
{
u32Type = GL_POINTS;
}
break;
#ifdef MULTIPLE_RENDER_ELEMENTS
case RenderElementPrimitives::TYPE_LINES:
#else
case RenderElement::TYPE_LINES:
#endif
{
u32Type = GL_LINES;
}
break;
#ifdef MULTIPLE_RENDER_ELEMENTS
case RenderElementPrimitives::TYPE_TRIANGLES:
#else
case RenderElement::TYPE_TRIANGLES:
#endif
{
u32Type = GL_TRIANGLES;
}
break;
#ifdef MULTIPLE_RENDER_ELEMENTS
case RenderElementPrimitives::TYPE_QUADS:
#else
case RenderElement::TYPE_QUADS:
#endif
{
u32Type = GL_QUADS;
}
break;
}
// Set color
Float16 f16R, f16G, f16B, f16A;
color.ToRGBA( f16R, f16G, f16B, f16A );
glColor4f( f16R, f16G, f16B, f16A );
// Set line thickness
glLineWidth( f16Thickness );
// Render primitives
glLoadIdentity();
glDisable( GL_TEXTURE_2D );
glBegin( u32Type );
Unsigned32 u32NumPoints = avPoints.size();
for ( Unsigned32 u32Idx = 0; u32Idx < u32NumPoints; ++u32Idx )
{
const CFoundation::Vector2Df& vPoint = avPoints[ u32Idx ];
glVertex3d( vPoint.GetX(), vPoint.GetY(), 0 );
}
glEnd();
}
示例3: RenderRect
void RendererOpenGL::RenderRect( const RenderElement& _Rect )
#endif
{
glLoadIdentity();
glDisable( GL_TEXTURE_2D );
#ifdef MULTIPLE_RENDER_ELEMENTS
Drawer::GetInstance().DrawSolidRect( CFoundation::RectI32( _spRect->GetPosition(), _spRect->GetSize() ), _spRect->GetColor(), _spRect->GetAngle() );
#else
Drawer::GetInstance().DrawSolidRect( CFoundation::RectI32( _Rect.GetPosition(), _Rect.GetSize() ), _Rect.GetColor(), _Rect.GetAngle() );
#endif
}