An internal OpenGL call failed in Texture.cpp(98)

Ошибка

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.

Методом исключения выяснил что ошибка в this->texture1.loadFromFile но не знаю почему

#pragma once
#include "Figures.h"
class Pawn : public Figures
{
public:
    Pawn(int x, int y, Teams t) : Figures(x, y, t) { 
        if (t == Teams::WHITE)
            this->texture1.loadFromFile("images/2.png");
        else
            this->texture1.loadFromFile("images/-2.png");
        this->figure1.setTexture(texture1);
    }
};
#include <vector>
#include <SFML/Graphics.hpp>
using namespace sf;
enum Teams
{
    WHITE, BLACK
};
struct Cord
{ int x;
  int y; };
class Figures
{
public:
    Figures() {

    }
    Figures(int x, int y, Teams t) {
        this->MyCord.x = x;
        this->MyCord.y = y;
        this->isSelect = false;
        this->t = t;
    }
    Cord getCord() {
        return this->MyCord;
    }
    Sprite getSprite() {
        return this->figure1;
    }
    void SetPos(int x, int y) {
        figure1.setPosition(x, y);
    }
protected:
    Cord MyCord;
    std::vector<Cord> myMoves;
    bool isSelect;
    Teams t;
    Texture texture1;
    Sprite figure1;
};

Ответы (1 шт):

Автор решения: Евгений Соловьёв
Texture* texture = new Texture();
        if (t == Teams::WHITE)
            texture->loadFromFile("images/2.png");
        else
            texture->loadFromFile("images/-2.png");
        this->figure.setTexture(*texture);
→ Ссылка