Hello forum;
I have the following inside the window resize callback :
void framebuffer_size_callback(GLFWwindow *window,int width,int height)
{
if(height < 1)
height = 1;
winWidth = width;
winHeight = height;
//set the viewport matrix
ViewportMatrix = glm::mat4(glm::vec4((GLfloat)winWidth/2.0f,0.0f,0.0f,0.0f),
glm::vec4(0.0f,(GLfloat)winHeight/2.0f,0.0f,0.0f),
glm::vec4(0.0f,0.0f,1.0f,0.0f),
glm::vec4((GLfloat)winWidth/2.0f,(GLfloat)winHeight/2.0f,0.0f,1.0f));
//setup the projection matrix
ProjectionMatrix = glm::perspective(50.0f,(GLfloat)(winWidth/winHeight),0.1f,1000.0f);
glViewport(0,0,winWidth,winHeight);
}
And i have called the above in the following manner inside the main function:
......................
......................
glfwSetErrorCallback(error_callback);
glfwSetFramebufferSizeCallback(window,framebuffer_size_callback);
glfwSetScrollCallback(window,scroll_callback);
glfwSetKeyCallback(window,key_callback);
//make the current window context the current one
glfwMakeContextCurrent(window);
glfwSwapInterval(1);
glfwGetFramebufferSize(window,&winWidth,&winHeight);
framebuffer_size_callback(window,winWidth,winHeight);
......................
......................
I am having the following error :
**************** OpenGL Driver Information *********************
OpenGL version: 4.4.0 NVIDIA 340.46
GLSL version: 4.40 NVIDIA via Cg compiler
GLEW version: 1.10.0
OpenGL vendor: NVIDIA Corporation
Renderer: GeForce GTX 560M/PCIe/SSE2
****************************************************************
SolidWiredFrame: /usr/include/glm/gtc/matrix_transform.inl:247: glm::detail::tmat4x4<T, (glm::precision)0u> glm::perspective(const valType&, const valType&, const valType&, const valType&) [with valType = float]: Assertion `aspect != valType(0)' failed.
it is pointing to the opengl mathematics library i am using to do all the affine transformation. Any idea ?