本文整理汇总了C++中nux::GraphicsEngine::SetModelViewMatrix方法的典型用法代码示例。如果您正苦于以下问题:C++ GraphicsEngine::SetModelViewMatrix方法的具体用法?C++ GraphicsEngine::SetModelViewMatrix怎么用?C++ GraphicsEngine::SetModelViewMatrix使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nux::GraphicsEngine
的用法示例。
在下文中一共展示了GraphicsEngine::SetModelViewMatrix方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Draw
void OverlaySpinner::Draw(nux::GraphicsEngine& GfxContext, bool force_draw)
{
nux::Geometry const& geo = GetGeometry();
nux::TexCoordXForm texxform;
GfxContext.PushClippingRectangle(geo);
nux::GetPainter().PaintBackground(GfxContext, geo);
texxform.SetTexCoordType(nux::TexCoordXForm::OFFSET_COORD);
texxform.SetWrap(nux::TEXWRAP_REPEAT, nux::TEXWRAP_REPEAT);
texxform.min_filter = nux::TEXFILTER_LINEAR;
texxform.mag_filter = nux::TEXFILTER_LINEAR;
unsigned int current_alpha_blend;
unsigned int current_src_blend_factor;
unsigned int current_dest_blend_factor;
GfxContext.GetRenderStates().GetBlend(current_alpha_blend, current_src_blend_factor, current_dest_blend_factor);
GfxContext.GetRenderStates().SetBlend(true, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
nux::Geometry spin_geo(geo.x + ((geo.width - spin_->GetWidth()) / 2),
geo.y + ((geo.height - spin_->GetHeight()) / 2),
spin_->GetWidth(),
spin_->GetHeight());
// Geometry (== Rect) uses integers which were rounded above,
// hence an extra 0.5 offset for odd sizes is needed
// because pure floating point is not being used.
int spin_offset_w = !(geo.width % 2) ? 0 : 1;
int spin_offset_h = !(geo.height % 2) ? 0 : 1;
nux::Matrix4 matrix_texture;
matrix_texture = nux::Matrix4::TRANSLATE(-spin_geo.x - (spin_geo.width + spin_offset_w) / 2.0f,
-spin_geo.y - (spin_geo.height + spin_offset_h) / 2.0f, 0) * matrix_texture;
matrix_texture = rotate_ * matrix_texture;
matrix_texture = nux::Matrix4::TRANSLATE(spin_geo.x + (spin_geo.width + spin_offset_w) / 2.0f,
spin_geo.y + (spin_geo.height + spin_offset_h) / 2.0f, 0) * matrix_texture;
GfxContext.SetModelViewMatrix(GfxContext.GetModelViewMatrix() * matrix_texture);
GfxContext.QRP_1Tex(spin_geo.x,
spin_geo.y,
spin_geo.width,
spin_geo.height,
spin_->GetDeviceTexture(),
texxform,
nux::color::White);
// revert to model view matrix stack
GfxContext.ApplyModelViewMatrix();
GfxContext.PopClippingRectangle();
GfxContext.GetRenderStates().SetBlend(current_alpha_blend, current_src_blend_factor, current_dest_blend_factor);
if (!frame_timeout_)
{
frame_timeout_.reset(new glib::Timeout(22, sigc::mem_fun(this, &OverlaySpinner::OnFrameTimeout)));
}
}