I would like to know why the following code does not show a textured quad after it draws a sprite.
Instead it replaces the sprite's texture with the texture which was meant for the quad.
#include <SFML/Graphics.hpp>
#include <SFML/Window.hpp>
#include <Windows.h>
#include <GL\GL.h>
int main()
{
sf::RenderWindow window(sf::VideoMode(640, 480), "test", sf::Style::Close);
sf::Texture spriteTexture, testTexture;
sf::Sprite sprite;
spriteTexture.loadFromFile("sprite.png");
testTexture.loadFromFile("texture.png");
sprite.setTexture(spriteTexture);
glEnable(GL_TEXTURE_2D);
while(window.isOpen())
{
window.clear();
window.draw(sprite);
testTexture.bind();
glBegin(GL_QUADS);
glTexCoord2f(0, 0);
glVertex2f(-1, -1);
glTexCoord2f(1, 0);
glVertex2f(0, -1);
glTexCoord2f(1, 1);
glVertex2f(0, 0);
glTexCoord2f(0, 1);
glVertex2f(-1, 0);
glEnd();
window.display();
}
return 0;
}