本文整理汇总了C++中texture::height方法的典型用法代码示例。如果您正苦于以下问题:C++ texture::height方法的具体用法?C++ texture::height怎么用?C++ texture::height使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类texture
的用法示例。
在下文中一共展示了texture::height方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: blit_texture
void blit_texture(const texture& tex, int x, int y, GLfloat rotate)
{
if(!tex.valid()) {
return;
}
int h = tex.height();
int w = tex.width();
const int w_odd = w % 2;
const int h_odd = h % 2;
h /= 2;
w /= 2;
glPushMatrix();
glTranslatef(x+w,y+h,0.0);
glRotatef(rotate,0.0,0.0,1.0);
tex.set_as_current_texture();
glBegin(GL_QUADS);
graphics::texture::set_coord(0.0,0.0);
glVertex3i(-w,-h,0);
graphics::texture::set_coord(0.0,1.0);
glVertex3i(-w,h+h_odd,0);
graphics::texture::set_coord(1.0,1.0);
glVertex3i(w+w_odd,h+h_odd,0);
graphics::texture::set_coord(1.0,0.0);
glVertex3i(w+w_odd,-h,0);
glEnd();
glPopMatrix();
}
示例2: blit_texture
void blit_texture(const texture& tex, int x, int y, GLfloat rotate)
{
if(!tex.valid()) {
return;
}
glEnable(GL_TEXTURE_2D);
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
x &= preferences::xypos_draw_mask;
y &= preferences::xypos_draw_mask;
int h = tex.height();
int w = tex.width();
const int w_odd = w % 2;
const int h_odd = h % 2;
h /= 2;
w /= 2;
glPushMatrix();
glTranslatef(x+w,y+h,0.0);
glRotatef(rotate,0.0,0.0,1.0);
tex.set_as_current_texture();
GLfloat varray[] = {
-w, -h,
-w, h+h_odd,
w+w_odd, -h,
w+w_odd, h+h_odd
};
GLfloat tcarray[] = {
texture::get_coord_x(0.0), texture::get_coord_y(0.0),
texture::get_coord_x(0.0), texture::get_coord_y(1.0),
texture::get_coord_x(1.0), texture::get_coord_y(0.0),
texture::get_coord_x(1.0), texture::get_coord_y(1.0)
};
glVertexPointer(2, GL_FLOAT, 0, varray);
glTexCoordPointer(2, GL_FLOAT, 0, tcarray);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
glPopMatrix();
}