Code: Select all
void COpenGLDriver::draw2DImageAbsoluteCoordinates(const video::ITexture* texture, const core::position2d<s32>& pos)
{
//1st -> must specify coordinates for vertices and UVs
const core::dimension2d<u32>& textureSize = texture->getOriginalSize();
const core::rect<f32> tcoords(0, 1, 1, 0); // rect has only upper left and lower right corners that we must specify
const core::rect<s32> poss(pos.X, pos.Y, pos.X + textureSize.Width, pos.Y + textureSize.Height); // texture position
// all the code below wasn't modified
disableTextures(1);
if (!setActiveTexture(0, texture))
return;
glBegin (GL_QUADS);
glTexCoord2f(tcoords.UpperLeftCorner.X, tcoords.UpperLeftCorner.Y);
glVertex2f(GLfloat(poss.UpperLeftCorner.X), GLfloat(poss.UpperLeftCorner.Y));
glTexCoord2f(tcoords.LowerRightCorner.X, tcoords.UpperLeftCorner.Y);
glVertex2f(GLfloat(poss.LowerRightCorner.X), GLfloat(poss.UpperLeftCorner.Y));
glTexCoord2f(tcoords.LowerRightCorner.X, tcoords.LowerRightCorner.Y);
glVertex2f(GLfloat(poss.LowerRightCorner.X), GLfloat(poss.LowerRightCorner.Y));
glTexCoord2f(tcoords.UpperLeftCorner.X, tcoords.LowerRightCorner.Y);
glVertex2f(GLfloat(poss.UpperLeftCorner.X), GLfloat(poss.LowerRightCorner.Y));
glEnd();
}