c++ template выдаёт ошибку
Почему то когда я инициализирую функцию класса то выдаёт ошибку: "ссылка на неразрешенный внешний символ "public: void __cdecl GLobject::Force(struct glm::vec<3,float,0>,float)" (??$Force@M@GLobject@@QEAAXU?$vec@$02M$0A@@glm@@M@Z)"
Знаю только то что делаю что то не правильно, а вот что понять не могу.
Вот код:
GLobject.h
using namespace glm;
#pragma once
class GLobject
{
public:
GLobject(int count, GLuint *VBO, mat4 matrix, GLuint program);
~GLobject();
void SetBufferData(int index, GLenum btype, int size, GLenum normalize, float vertex[], int vsize);
void Rotate(vec3 mod, float angle);
void Scale(vec3 mod);
void Translate(vec3 mod);
void Draw(GLenum btype, GLenum dtype, int size);
template<class T>
void Force(vec3 F, T mass);
private:
GLuint VAO;
GLuint *VBO;
mat4 matrix;
GLint p;
};
GLobject.cpp
#include "GLobject.h"
GLobject::GLobject(int count, GLuint *VBO, mat4 matrix, GLuint program)
{
glGenVertexArrays(1, &VAO);
this->VBO = VBO;
glGenBuffers(count, this->VBO);
this->matrix = matrix;
p = glGetUniformLocation(program, "matrix");
}
GLobject::~GLobject()
{
}
void GLobject::SetBufferData(int index, GLenum btype, int size, GLenum normalize, float vertex[], int vsize)
{
glBindVertexArray(VAO);
glBindBuffer(btype, VBO[index]);
glVertexAttribPointer(index, size, GL_FLOAT, normalize, size*sizeof(float), (void*)0);
glBufferData(btype, vsize * sizeof(float), vertex, GL_STATIC_DRAW);
glBindVertexArray(0);
glBindBuffer(btype, 0);
}
void GLobject::Rotate(vec3 mod, float angle)
{
matrix = rotate(matrix, radians(angle), mod);
}
void GLobject::Scale(vec3 mod)
{
matrix = scale(matrix, mod);
}
void GLobject::Translate(vec3 mod)
{
matrix = translate(matrix, mod);
}
template<class T>
void GLobject::Force(vec3 F, T mass) {
vec3 a = F / mass;
float t = glfwGetTime();
matrix = translate(matrix, a);
}
void GLobject::Draw(GLenum btype, GLenum dtype, int size) {
glBindVertexArray(VAO);
for (int i = 0; i < sizeof(VBO); i++) {
glEnableVertexAttribArray(i);
}
glUniformMatrix4fv(p, 1, GL_FALSE, value_ptr(matrix));
glDrawArrays(dtype, 0, size);
}