Hi everyone
I have this code:
#include "SFML/Graphics.hpp"
#include <iostream>
using namespace std;
using namespace sf;
struct sfButton
{
int ButtonSprite;
Text ButtonText;
};
int main()
{
int ScreenWide = 500;
int ScreenHeight = 500;
int FrameLimit = 60;
RenderWindow window;
srand(time(NULL));
setlocale(LC_ALL, "");
window.create(VideoMode(500,500,32),"Window");
window.setActive(true);
window.setPosition(Vector2i(90,0));
window.setFramerateLimit(60);
Font Calibri;
Calibri.loadFromFile("Calibri Regular.ttf");
sfButton A;
A.ButtonText.setCharacterSize(15);
A.ButtonText.setFillColor(Color(255,255,255));
A.ButtonText.setPosition(Vector2f(0,0));
A.ButtonText.setFont(Calibri);
A.ButtonText.setString("x");
Event event;
while(window.isOpen())
{
while(window.pollEvent(event))
{
}
if (event.type == Event::Closed || (Keyboard::isKeyPressed(Keyboard::Escape)))
window.close();
window.clear(Color(50,51,55));
window.draw(A.ButtonText);
window.display();
}
}
and when i run it i have this message:
"An internal OpenGL call failed in Texture.cpp(98).
Expression:
glFlush()
Error description:
GL_INVALID_OPERATION
The specified operation is not allowed in the current state.
An internal OpenGL call failed in Texture.cpp(98).
Expression:
glFlush()
Error description:
GL_INVALID_OPERATION
The specified operation is not allowed in the current state."
But when I remove "int ButtonSprite;" form "sfButton" program compiles correct and I have no errors.
Can anybody tell me why is this happening and how to fix it?