hey ive been wondering something..
is it possible to load a sprite as a texture(i got it to work as an image before)
what im trying to do is use a subrect of that image(say its 30x15 and i wanna use ponly 15x15 of it)
heres what i got so far:
GLuint LoadTexture(sf::Sprite image)
{
GLuint Texture;
glGenTextures(1, &Texture);
glBindTexture(GL_TEXTURE_2D, Texture);
gluBuild2DMipmaps(GL_TEXTURE_2D, GL_RGBA, 17, 22, GL_RGBA, GL_UNSIGNED_BYTE,image.GetImage().GetPixelsPtr());
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
return Texture;
}
and in main...
GLuint _texture[2];
sf::Image itexture[2];
sf::Sprite stexture[2];
itexture[0].LoadFromFile("Awesome.png");
itexture[1].LoadFromFile("Graphics/Player Sprite.png");
stexture[1].SetImage(itexture[1]);
stexture[1].SetSubRect(sf::IntRect(0,0,17,22));
//_texture[0] = LoadTexture(itexture[0]);
_texture[1] = LoadTexture(stexture[1]);
hopefully the code can give you some vision of what will happen