Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - ThisGuy

Pages: [1]
1
Graphics / Re: Cannot draw textured quads after drawing a sprite
« on: January 31, 2013, 08:40:08 pm »
Thanks for your help!
I solved my problem by using pushGLStates() & popGLStates().

2
Graphics / Cannot draw textured quads after drawing a sprite
« on: January 31, 2013, 06:25:34 pm »
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;
}
 

Pages: [1]
anything