I can not get the call glm :: rotate (mat4, int, vec3 (x, y, z)); work. VS 2010 tells me
Intellisense: no instance of function template "glm::gtc::matrix_transform::rotate" matches the argument
I am using glm-0.9.1
I saw this question, but the solution still throws an error using the intellisense function: glm rotate in Opengl
I can not get it to accept any overload methods. I could just miss something obvious though.
I tried to make the rotation call explicit in the code, this is a bit down.
here is the code:
#include <GL/glew.h>
#include <GL/glfw.h>
#include <GL/glut.h>
#include <glm/glm.hpp>
#include <glm/gtc/matrix_transform.hpp>
#include "loadShader.h"
#include <stdio.h>
#include <stdlib.h>
glm::mat4 Projection;
glm::mat4 View;
glm::mat4 Model;
glm::mat4 MVP;
glm::mat4 t;
glm::mat4 s;
glm::mat4 r;
GLuint programID;
int main()
{
if( !glfwInit() )
{
fprintf( stderr, "Failed to initialize GLFW\n" );
return -1;
}
glfwOpenWindowHint(GLFW_FSAA_SAMPLES, 4);
glfwOpenWindowHint(GLFW_OPENGL_VERSION_MAJOR, 3);
glfwOpenWindowHint(GLFW_OPENGL_VERSION_MINOR, 3);
glfwOpenWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
if( !glfwOpenWindow( 1024, 768, 0,0,0,0, 32,0, GLFW_WINDOW ) )
{
fprintf( stderr, "Failed to open GLFW window. If you have an Intel GPU, they are not 3.3 compatible. Try the 2.1 version of the tutorials.\n" );
glfwTerminate();
return -1;
}
if (glewInit() != GLEW_OK) {
fprintf(stderr, "Failed to initialize GLEW\n");
return -1;
}
glfwSetWindowTitle( "Tutorial 02" );
glfwEnable( GLFW_STICKY_KEYS );
glewExperimental = GL_TRUE;
glewInit();
glClearColor(0.0f, 0.0f, 0.3f, 0.0f);
GLuint VertexArrayID;
glGenVertexArrays(1, &VertexArrayID);
glBindVertexArray(VertexArrayID);
programID = LoadShaders( "vertexShader.glsl", "fragmentShader.glsl" );
Projection = glm::perspective( 45.0f, 4.0f / 3.0f, 0.1f, 100.0f );
View = glm::lookAt(
glm::vec3(4,3,3),
glm::vec3(0,0,0),
glm::vec3(0,1,0)
);
Model = glm::mat4(1.0f);
r = glm::rotate(Model, 45, glm::vec3(1,0,0));
MVP = Projection * View * Model;
GLuint MatrixID = glGetUniformLocation(programID, "MVP");
static const GLfloat g_vertex_buffer_data[] = {
-1.0f, -1.0f, 0.0f,
1.0f, -1.0f, 0.0f,
0.0f, 1.0f, 0.0f,
};
GLuint vertexbuffer;
glGenBuffers(1, &vertexbuffer);
glBindBuffer(GL_ARRAY_BUFFER, vertexbuffer);
glBufferData(GL_ARRAY_BUFFER, sizeof(g_vertex_buffer_data), g_vertex_buffer_data, GL_STATIC_DRAW);
do{
glClear( GL_COLOR_BUFFER_BIT );
glUseProgram(programID);
glUniformMatrix4fv(MatrixID, 1, GL_FALSE, &MVP[0][0]);
glEnableVertexAttribArray(0);
glBindBuffer(GL_ARRAY_BUFFER, vertexbuffer);
glVertexAttribPointer(
0,
3,
GL_FLOAT,
GL_FALSE,
0,
(void*)0
);
glDrawArrays(GL_TRIANGLES, 0, 3);
glDisableVertexAttribArray(0);
glfwSwapBuffers();
}
while( glfwGetKey( GLFW_KEY_ESC ) != GLFW_PRESS &&
glfwGetWindowParam( GLFW_OPENED ) );
glfwTerminate();
glDeleteBuffers(1, &vertexbuffer);
glDeleteVertexArrays(1, &VertexArrayID);
return 0;
}