I am getting an error when trying to build this program:
these are the files of the class where the error is happening:
Sprite.h
#ifndef SPRITE_H
#define SPRITE_H
#include <GL/glew.h>
class Sprite
{
public:
Sprite();
virtual ~Sprite();
void draw();
void init(int x, int y, int width, int height);
protected:
private:
int _x;
int _y;
int _width;
int _height;
GLuint _vboID;
};
#endif // SPRITE_H
Sprite.cpp
#include "Sprite.h"
Sprite::Sprite(){
_vboID = 0;
}
Sprite::~Sprite()
{
//dtor
}
void Sprite::init(int x, int y, int width, int height){
_x = x;
_y = y;
_width = width;
_height = height;
if(_vboID == 0){
glGenBuffers(1, &_vboID);
}
float vertexData[12];
//first triangle
vertexData[0] = x + width;
vertexData[1] = y + height;
vertexData[2] = x;
vertexData[3] = y + height;
vertexData[4] = x;
vertexData[5] = y;
//second triangle
vertexData[6] = x;
vertexData[7] = y;
vertexData[8] = x + width;
vertexData[9] = y;
vertexData[10] = x + width;
vertexData[11] = y + height;
glBindBuffer(GL_ARRAY_BUFFER, _vboID);
glBufferData(GL_ARRAY_BUFFER, sizeof(vertexData), vertexData, GL_STATIC_DRAW);
}
void Sprite::draw(){
}
Also I have my linkers set up as following in this order under link libraries:
mingw32
libSDL2main
libSDL2
glew32
glew32s
openGL32
I found some solutions that say you have to use #define GLEW_STATIC. This solution however did not work for me. also changing the order of the linkers didn't change anything.