<p>I was converting the angle to radians twice guys. Moral of the story is to take breaks when coding.</p>

CC BY-SA 4.0
2022-10-22T17:31:09.463Z
2022-10-22T17:31:09.463Z
gallickgunner
<p>I'm trying to render some objects but apparently X and Y coordinates need to be really small in-order to get something on screen. See this example of 2 lines</p>
<p><a href="https://i.sstatic.net/8pDSp.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/8pDSp.png" alt="enter image description here" /></a></p>
<p>The world space coordinates for these lines are</p>
<pre><code>vertices.push_back(glm::vec3(-1.0, 1.0, -2.0)); //line 1 
vertices.push_back(glm::vec3(1.0, 1.0, -2.0));
vertices.push_back(glm::vec3(1.0, -1.0, -2.0)); // line 2
vertices.push_back(glm::vec3(-1.0, -1.0, -2.0));
</code></pre>
<p>My view and projection matrices are being set as</p>
<pre><code>proj = glm::perspectiveFov(glm::radians(60), 1280, 720, 0.1, 1000);
view = glm::lookAt(glm::vec3(0,0,300), glm::vec3(0,0,-1), glm::vec3(0,1,0));
</code></pre>
<p>As you can see, the lines are actually showing up when I place the camera <strong>300 units</strong> back and that's a lot to see lines that have X and Y coordinates in range -1 to +1, atleast that's what I think or perhaps I'm wrong and it's fine?</p>
<p>I remember scaling the range of X and Y in legacy opengl using <code>glOrtho</code> etc. Don't quite get what's the problem here since the matrices seem pretty normal to me. I've also checked the values of the matrices and they are coming up fine using the original math so the glm function is working as intended. Anything I'm forgetting here? Would appreciate some ideas.</p>
<p>EDIT:- I'm an effin idiot, was using <code>glm::radians</code> twice, once when passing it to my class then once inside.</p>

<opengl><rendering><transformations><perspective><camera>
OpenGL - How to increase view space coordinate range in X and Y axis
gallickgunner
# OpenGL - How to increase view space coordinate range in X and Y axis

(Asked by: username_0 on 2022-10-22)

I'm trying to render some objects but apparently X and Y coordinates need to be really small in-order to get something on screen. See this example of 2 lines

[![enter image description here](https://i.sstatic.net/8pDSp.png)](https://i.sstatic.net/8pDSp.png)

The world space coordinates for these lines are

```
vertices.push_back(glm::vec3(-1.0, 1.0, -2.0)); //line 1 
vertices.push_back(glm::vec3(1.0, 1.0, -2.0));
vertices.push_back(glm::vec3(1.0, -1.0, -2.0)); // line 2
vertices.push_back(glm::vec3(-1.0, -1.0, -2.0));

```

My view and projection matrices are being set as

```
proj = glm::perspectiveFov(glm::radians(60), 1280, 720, 0.1, 1000);
view = glm::lookAt(glm::vec3(0,0,300), glm::vec3(0,0,-1), glm::vec3(0,1,0));

```

As you can see, the lines are actually showing up when I place the camera **300 units** back and that's a lot to see lines that have X and Y coordinates in range -1 to +1, atleast that's what I think or perhaps I'm wrong and it's fine?

I remember scaling the range of X and Y in legacy opengl using `glOrtho` etc. Don't quite get what's the problem here since the matrices seem pretty normal to me. I've also checked the values of the matrices and they are coming up fine using the original math so the glm function is working as intended. Anything I'm forgetting here? Would appreciate some ideas.

EDIT:- I'm an effin idiot, was using `glm::radians` twice, once when passing it to my class then once inside.

**Tags:** opengl, rendering, transformations, perspective, camera


---

## 1 answers

### Answer by username_0 on 2022-10-22. Score: 4 | Accepted answer

I was converting the angle to radians twice guys. Moral of the story is to take breaks when coding.


---

