Yeah. here is a little messy test:
#include <SFML/Graphics.hpp>
#include <iostream>
#include <fstream>
int main()
{
sf::RenderWindow App(sf::VideoMode(800, 600, 32), "sfml");
float x = 400;
float y = 300;
App.PreserveOpenGLStates(true);
App.SetFramerateLimit(60);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(0,800,600,0,-1,1);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
sf::Image texture;
if (!texture.LoadFromFile("data\\text.jpg"))
return 0;
while (App.IsOpened())
{
sf::Event Event;
while (App.GetEvent(Event))
{
if (Event.Type == sf::Event::Closed)
App.Close();
if ((Event.Type == sf::Event::KeyPressed) && (Event.Key.Code == sf::Key::Escape))
App.Close();
if (Event.Type == sf::Event::Resized)
glViewport(0, 0, Event.Size.Width, Event.Size.Height);
}
glClear (GL_COLOR_BUFFER_BIT);
glLoadIdentity();
glTranslatef(x, y,0);
texture.Bind();
glBegin(GL_QUADS);
glTexCoord2i(0,0); glVertex2f(0,0);
glTexCoord2i(1,0); glVertex2f(0,50);
glTexCoord2i(1,1); glVertex2f(50,50);
glTexCoord2i(0,1); glVertex2f(50, 0);
glEnd();
App.Display();
App.Display();
}
return EXIT_SUCCESS;
}
The code seems to work properly. But at the closing of the program i got the following message :
An internal OpenGL call failed in image.cpp (481) : GL_INVALID_OPERATION, the specified operation is not allowed in the current state
An internal OpenGL call failed in image.cpp (482) : GL_INVALID_OPERATION, the specified operation is not allowed in the current state