# The Industry's Foundation for High Performance Graphics

1. ## glm::ortho problem [SOLVED]

Hello!

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

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

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

matrix multiplication:
Code :
```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:erspective everything works fine. So can anyone help me?

greetz caaso

2. ## Re: glm::ortho problem

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.

3. ## Re: glm::ortho problem

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.

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•