Hello people!
I could not seem to find any information about how this is done, but how exactly are you supposed to draw a textured quad with the origin in it’s center?
I’m using SOIL for the textures. So this code is meant to draw a texture on a quad, where the texture decides the quads size. But the origin is still in the left corner.
Anybody able to give a hand?
{
glPushMatrix();
glTranslatef(GetGameObject()->Transform->Position->X, GetGameObject()->Transform->Position->Y, GetGameObject()->Transform->Position->Z);
glBindTexture(GL_TEXTURE_2D, this->texture);
//Render textured quad
glBegin(GL_QUADS);
glTexCoord2d(0.0, 0.0); glVertex2d(0.0, 0.0);
glTexCoord2d(1.0, 0.0); glVertex2d(1 * scale->X , 0.0);
glTexCoord2d(1.0, 1.0); glVertex2d(1 * scale->X, (height / width) * scale->Y);
glTexCoord2d(0.0, 1.0); glVertex2d(0.0, (height / width) * scale->Y);
glEnd();
glPopMatrix();