本文整理汇总了C++中TextureManager::RestoreTextureMatrix方法的典型用法代码示例。如果您正苦于以下问题:C++ TextureManager::RestoreTextureMatrix方法的具体用法?C++ TextureManager::RestoreTextureMatrix怎么用?C++ TextureManager::RestoreTextureMatrix使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TextureManager
的用法示例。
在下文中一共展示了TextureManager::RestoreTextureMatrix方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OGL_Draw
//.........这里部分代码省略.........
TMgr.SetupTextureMatrix();
TMgr.RenderNormal();
bool rotating = (rotation > 0.1 || rotation < -0.1);
if (rotating)
{
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
glTranslatef((dst.x + dst.w/2.0), (dst.y + dst.h/2.0), 0.0);
glRotatef(rotation, 0.0, 0.0, 1.0);
glTranslatef(-(dst.x + dst.w/2.0), -(dst.y + dst.h/2.0), 0.0);
}
if (m_type == Shape_Texture_Interface)
{
if (crop_rect.x > 0)
U_Offset += crop_rect.x * U_Scale / static_cast<double>(m_scaled_src.w);
if (crop_rect.y > 0)
V_Offset += crop_rect.y * V_Scale / static_cast<double>(m_scaled_src.h);
if (crop_rect.w < m_scaled_src.w)
U_Scale *= crop_rect.w / static_cast<double>(m_scaled_src.w);
if (crop_rect.h < m_scaled_src.h)
V_Scale *= crop_rect.h / static_cast<double>(m_scaled_src.h);
OGL_RenderTexturedRect(dst.x, dst.y, dst.w, dst.h,
U_Offset, V_Offset,
U_Offset + U_Scale,
V_Offset + V_Scale);
}
else if (m_type == Shape_Texture_Landscape)
{
U_Scale = -TMgr.Texture->width / static_cast<double>(TMgr.Texture->height);
U_Offset = 0.5 - U_Scale/2.0;
if (crop_rect.x > 0)
V_Offset += crop_rect.x * V_Scale / static_cast<double>(m_scaled_src.w);
if (crop_rect.y > 0)
U_Offset += crop_rect.y * U_Scale / static_cast<double>(m_scaled_src.h);
if (crop_rect.w < m_scaled_src.w)
V_Scale *= crop_rect.w / static_cast<double>(m_scaled_src.w);
if (crop_rect.h < m_scaled_src.h)
U_Scale *= crop_rect.h / static_cast<double>(m_scaled_src.h);
OGL_RenderTexturedRect(dst.x, dst.y, dst.w, dst.h,
V_Offset, U_Offset,
V_Offset + V_Scale,
U_Offset + U_Scale);
}
else
{
shape_information_data *info = extended_get_shape_information(m_coll, m_frame);
if (info->flags & _X_MIRRORED_BIT)
{
V_Offset += V_Scale;
V_Scale = -V_Scale;
}
if (info->flags & _Y_MIRRORED_BIT)
{
U_Offset += U_Scale;
U_Scale = -U_Scale;
}
if (crop_rect.x > 0)
V_Offset += crop_rect.x * V_Scale / static_cast<double>(m_scaled_src.w);
if (crop_rect.y > 0)
U_Offset += crop_rect.y * U_Scale / static_cast<double>(m_scaled_src.h);
if (crop_rect.w < m_scaled_src.w)
V_Scale *= crop_rect.w / static_cast<double>(m_scaled_src.w);
if (crop_rect.h < m_scaled_src.h)
U_Scale *= crop_rect.h / static_cast<double>(m_scaled_src.h);
GLfloat texcoords[8] = {
U_Offset, V_Offset,
U_Offset, V_Offset + V_Scale,
U_Offset + U_Scale, V_Offset + V_Scale,
U_Offset + U_Scale, V_Offset
};
GLfloat vertices[8] = {
dst.x, dst.y,
dst.x + dst.w, dst.y,
dst.x + dst.w, dst.y + dst.h,
dst.x, dst.y + dst.h
};
glVertexPointer(2, GL_FLOAT, 0, vertices);
glTexCoordPointer(2, GL_FLOAT, 0, texcoords);
glDrawArrays(GL_POLYGON, 0, 4);
}
if (rotating)
glPopMatrix();
if (TMgr.IsGlowMapped()) TMgr.RenderGlowing();
TMgr.RestoreTextureMatrix();
if (Using_sRGB)
{
glDisable(GL_FRAMEBUFFER_SRGB_EXT);
Using_sRGB = false;
}
#endif
}
示例2: OGL_Draw
//.........这里部分代码省略.........
V_Offset += crop_rect.x * V_Scale / static_cast<double>(m_scaled_src.w);
}
if (crop_rect.y > 0) {
U_Offset += crop_rect.y * U_Scale / static_cast<double>(m_scaled_src.h);
}
if (crop_rect.w < m_scaled_src.w) {
V_Scale *= crop_rect.w / static_cast<double>(m_scaled_src.w);
}
if (crop_rect.h < m_scaled_src.h) {
U_Scale *= crop_rect.h / static_cast<double>(m_scaled_src.h);
}
// DJB OpenGL Change from glBegin/glEnd
GLfloat t[8] = {
V_Offset, U_Offset,
V_Offset + V_Scale, U_Offset,
V_Offset + V_Scale, U_Offset + U_Scale,
V_Offset, U_Offset + U_Scale
};
GLshort v[8] = {
dst.x, dst.y,
dst.x + dst.w, dst.y,
dst.x + dst.w, dst.y + dst.h,
dst.x, dst.y + dst.h
};
glVertexPointer(2, GL_SHORT, 0, v);
glEnableClientState(GL_VERTEX_ARRAY);
glTexCoordPointer(2, GL_FLOAT, 0, t);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
/*
glBegin(GL_TRIANGLE_FAN);
glTexCoord2d(V_Offset, U_Offset);
glVertex2i(dst.x, dst.y);
glTexCoord2d(V_Offset + V_Scale, U_Offset);
glVertex2i(dst.x + dst.w, dst.y);
glTexCoord2d(V_Offset + V_Scale, U_Offset + U_Scale);
glVertex2i(dst.x + dst.w, dst.y + dst.h);
glTexCoord2d(V_Offset, U_Offset + U_Scale);
glVertex2i(dst.x, dst.y + dst.h);
glEnd();
*/
}
else
{
if (crop_rect.x > 0) {
V_Offset += crop_rect.x * V_Scale / static_cast<double>(m_scaled_src.w);
}
if (crop_rect.y > 0) {
U_Offset += crop_rect.y * U_Scale / static_cast<double>(m_scaled_src.h);
}
if (crop_rect.w < m_scaled_src.w) {
V_Scale *= crop_rect.w / static_cast<double>(m_scaled_src.w);
}
if (crop_rect.h < m_scaled_src.h) {
U_Scale *= crop_rect.h / static_cast<double>(m_scaled_src.h);
}
// DJB OpenGL
GLfloat t[8] = {
U_Offset, V_Offset,
U_Offset, V_Offset + V_Scale,
U_Offset + U_Scale, V_Offset + V_Scale,
U_Offset + U_Scale, V_Offset
};
GLshort v[8] = {
dst.x, dst.y,
dst.x + dst.w, dst.y,
dst.x + dst.w, dst.y + dst.h,
dst.x, dst.y + dst.h
};
glVertexPointer(2, GL_SHORT, 0, v);
glEnableClientState(GL_VERTEX_ARRAY);
glTexCoordPointer(2, GL_FLOAT, 0, t);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
/*
glBegin(GL_TRIANGLE_FAN);
glTexCoord2d(U_Offset, V_Offset);
glVertex2i(dst.x, dst.y);
glTexCoord2d(U_Offset, V_Offset + V_Scale);
glVertex2i(dst.x + dst.w, dst.y);
glTexCoord2d(U_Offset + U_Scale, V_Offset + V_Scale);
glVertex2i(dst.x + dst.w, dst.y + dst.h);
glTexCoord2d(U_Offset + U_Scale, V_Offset);
glVertex2i(dst.x, dst.y + dst.h);
glEnd();
*/
}
if (rotating) {
glPopMatrix();
}
if (TMgr.IsGlowMapped()) {
TMgr.RenderGlowing();
}
TMgr.RestoreTextureMatrix();
#endif
}