Hello!
I've been working on a simple map editor, and I have this "loadTexture" function, the problem is that when I call it, I have this that pops up hundreds of times in my console:
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.
Here is my loadTexture function:
void LevelEditor::loadTextures(){
sf::Texture texture;
for (int i = 0; i <= 15; i++) {
for (int j = 0; j <= 15; j++){
texture.loadFromFile("Resources/tileset.png", sf::IntRect(16, 16, i, j));
this->texture_vector.push_back(texture);
}
}
}
and my levelEditor class:
class LevelEditor {
private:
int level_width, level_height;
std::string level;
std::vector<sf::Texture> texture_vector{};
sf::Sprite block_sprite;
public:
LevelEditor();
~LevelEditor();
void update();
void draw(sf::RenderWindow &window);
void handleEvents();
void loadTextures();
void loadMap(std::string filename);
[...]
I tried to remove the " this->texture_vector.push_back(texture);" and when I do that, I no longer have the message. I also tried to reproduce in another sfml file the same thing:
a class with a std::vector<sf::Texture> and the same function, and everything works fine.
Thank you in advance for your answer because I really don't know what to do right now.