glm::ortho problem [SOLVED]

Hello!

I have a problem setting up an orthographic projection matrix with glm::ortho(). The object is a simple quad build by two triangles. The triangles are in the xy-plane with z=0. Using glm::perspective() everything is shown correct.

perspective:


P = glm::perspective(60.0f, (float)windowWidth / (float)windowHeight, 0.1f, 100.0f);

ortho:


P = glm::ortho(0.0f, (float)windowWidth,(float)windowHeight,0.0f, 0.1f, 100.0f);

matrix multiplication:


V = glm::lookAt( glm::vec3( 0.f, 0.f, 2.0f ),glm::vec3( 0.f, 0.f, 0.f ),glm::vec3( 0.0f, 1.0f, 0.0f ) );    
glm::mat4 T = glm::translate(glm::mat4(1.0f),glm::vec3(0.0f, 0.0f, 0.0f));
glm::mat4 Rx = glm::rotate(T,  rotation_x, glm::vec3(1.0f, 0.0f, 0.0f));
glm::mat4 Ry = glm::rotate(Rx, rotation_y, glm::vec3(0.0f, 1.0f, 0.0f));
glm::mat4 M = glm::rotate(Ry, rotation_z, glm::vec3(0.0f, 0.0f, 1.0f));
glm::mat4 MVP	= P*V*M;

As I said, using glm::perspective everything works fine. So can anyone help me?

greetz caaso

Your code seems correct, though you did not stated what is the problem in case you use orto? You don’t see the primitive? How big is your quad? Be careful that in case you set up the orto projection this way, a one unit wide and high quad will occupy only a single pixel on the screen.

ok thank you aqnuep. You solved my problem. I did not realize the problem with the size of the quad in relation to the pixels.