<p>Eye position, projection reference point PRP, camera center, or projection center are all just different words for the same thing. </p>

<p>gluLookAt() applied to the GL_MODELVIEW matrix works for both, parallel and perspective projection.</p>

<p>You can choose between parallel and perspective projection by setting up the GL_PROJECTION matrix. For perspective projection this can be done using the gluPerspective() function.</p>

<p><a href="http://www.mathematik.uni-marburg.de/~thormae/lectures/graphics1/graphics_6_1_eng_web.html#19" rel="nofollow noreferrer">Creating a perspective projection matrix in OpenGL</a></p>

<p><strong>Edit: (after revised question)</strong></p>

<p>If the PRP is not at the eye position, you can not use gluPerspective(). Instead you have to create your own GL_PROJECTION matrix. Following the formula that you have now provided, this results in the 4 x 4 matrix:</p>

<p>$$\mathtt{A} =\begin{bmatrix} z_c-z_{pp} &amp; 0 &amp; -x_c &amp;  x_c \cdot z_{pp}\\ 0  &amp; z_c-z_{pp}  &amp; -y_c &amp; y_c \cdot z_{pp} \\ 0 &amp; 0 &amp; \frac{\mathrm{far}+\mathrm{near}}{\mathrm{near}-\mathrm{far}} &amp; \frac{2 \cdot \mathrm{far} \cdot \mathrm{near}}{\mathrm{near}-\mathrm{far}} \\ 0 &amp; 0 &amp; -1 &amp; z_c \end{bmatrix}
$$</p>

<p>I have done a quick OpenGL/WebGL rendering test with the GSN Composer. Follow the link and move the mouse over the render output to change $x_c$ and $y_c$ of the projection reference point $(x_c, y_c, z_c)$:</p>

<p><a href="https://www.gsn-lib.org/docs/gallery.php?projectName=ProjRefPoint&amp;graphName=ProjectionReferencePoint" rel="nofollow noreferrer">Example: ProjectionReferencePoint | GSN Composer</a></p>

CC BY-SA 3.0
2017-12-24T19:37:08.103Z
Thank you. I have added a figure to show that the PRP is the 3D point that corresponds to the 2D vanishing point
Freeman
CC BY-SA 3.0
2018-01-02T14:56:09.033Z
Thanks for the figure. It seems as if I have understand you correctly. Use a combination of gluLookAt() and  gluPerspective() to achieve the desired projection and position change of the camera. 2D vanishing points are something else: Parallel lines in 3D do not intersect - but after projection in the camera plane the projected lines might intersect. The intersection point in 2D is called "vanishing point". It is possible to infer the projection properties and rotation of a camera from vanishing points and when I first have read your question I thought you were maybe interested in this.
NodeCode
CC BY-SA 3.0
2018-01-05T11:21:37.330Z
Thank you for answering. I don't want to change the vanishing point of parallel lines in the 2D projection, but the PRP of the perspective projection matrix. I have added another figure indicating that the eye (origin of the view coordinate) does not change, but the position of the PRP. glLookAt() enables to move the eye, but not the PRP (https://www.khronos.org/registry/OpenGL-Refpages/gl2.1/xhtml/gluLookAt.xml), which is the parameter that I want to change. You can find this general model in "Computer Graphics with OpenGL 4th ed", page 322.
Freeman
CC BY-SA 3.0
2018-01-05T21:57:00.857Z
Okay, I had a look at the book and now it is clear what you want. I have edited my answer accordingly. Sorry, I did not get it earlier.
NodeCode
CC BY-SA 3.0
2017-12-22T14:17:50.210Z
2018-03-07T11:54:31.937Z
2018-03-07T11:54:31.937Z
NodeCode
<p>If you are talking about an oblique perspective projection in which the line joining the eye and center of the projection plane is not perpendicular to the plane like here (upper left),</p>

<p><a href="https://i.sstatic.net/dJInW.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/dJInW.png" alt="enter image description here"></a></p>

<p>This can be generated by the <code>glFrustum()</code> call. Normally when you describe perspective projection they set </p>

<p><code>left = -right</code></p>

<p><code>bottom = -top</code></p>

<p>so that these are centered around the Z-axis. In order to generate an oblique projection you can use the <a href="https://www.khronos.org/registry/OpenGL-Refpages/gl2.1/xhtml/glFrustum.xml" rel="nofollow noreferrer">above</a> mentioned method which takes input the coordinates for left, right, top, bottom, near and far planes.</p>

<p>The other way around is to build your own custom projection matrix, and load it directly. The matrix should be stored as an array</p>

<p><code>GLfloat mat[16] = {...}
 GlLoadMatrix(mat)</code></p>

CC BY-SA 3.0
2018-01-05T11:20:35.753Z
I have added another figure indicating that the eye (origin of the view coordinate) does not change, but the position of the PRP.
Freeman
CC BY-SA 3.0
2017-12-26T11:40:51.503Z
2017-12-26T11:40:51.503Z
gallickgunner
<p>By default, the eye an the projection reference point PRP are in (0,0,0). I can change the eye position with gluLookAt(), but how can I change the PRP (i.e., the  convergence position for a set of parallel lines) for a perspective projection in OpenGL?
<a href="https://i.sstatic.net/9QdUj.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/9QdUj.png" alt="enter image description here"></a></p>

<p><a href="https://i.sstatic.net/VrYBF.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/VrYBF.png" alt="enter image description here"></a></p>

<opengl><perspective>
Changing the projection reference point in Open GL
Freeman
# Changing the projection reference point in Open GL

(Asked by: username_0 on 2017-12-20)

By default, the eye an the projection reference point PRP are in (0,0,0). I can change the eye position with gluLookAt(), but how can I change the PRP (i.e., the convergence position for a set of parallel lines) for a perspective projection in OpenGL?
[![enter image description here](https://i.sstatic.net/9QdUj.png)](https://i.sstatic.net/9QdUj.png)

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

**Tags:** opengl, perspective


---

## 2 answers

### Answer by username_1 on 2017-12-22. Score: 1 | Accepted answer

Eye position, projection reference point PRP, camera center, or projection center are all just different words for the same thing.

gluLookAt() applied to the GL\_MODELVIEW matrix works for both, parallel and perspective projection.

You can choose between parallel and perspective projection by setting up the GL\_PROJECTION matrix. For perspective projection this can be done using the gluPerspective() function.

[Creating a perspective projection matrix in OpenGL](http://www.mathematik.uni-marburg.de/~thormae/lectures/graphics1/graphics_6_1_eng_web.html#19)

**Edit: (after revised question)**

If the PRP is not at the eye position, you can not use gluPerspective(). Instead you have to create your own GL\_PROJECTION matrix. Following the formula that you have now provided, this results in the 4 x 4 matrix:

$$\mathtt{A} =\begin{bmatrix} z\_c-z\_{pp} & 0 & -x\_c & x\_c \cdot z\_{pp}\\ 0 & z\_c-z\_{pp} & -y\_c & y\_c \cdot z\_{pp} \\ 0 & 0 & \frac{\mathrm{far}+\mathrm{near}}{\mathrm{near}-\mathrm{far}} & \frac{2 \cdot \mathrm{far} \cdot \mathrm{near}}{\mathrm{near}-\mathrm{far}} \\ 0 & 0 & -1 & z\_c \end{bmatrix}
$$

I have done a quick OpenGL/WebGL rendering test with the GSN Composer. Follow the link and move the mouse over the render output to change $x\_c$ and $y\_c$ of the projection reference point $(x\_c, y\_c, z\_c)$:

[Example: ProjectionReferencePoint | GSN Composer](https://www.gsn-lib.org/docs/gallery.php?projectName=ProjRefPoint&graphName=ProjectionReferencePoint)

> **Comments:**
> **username_0**: Thank you. I have added a figure to show that the PRP is the 3D point that corresponds to the 2D vanishing point  
> **username_1**: Thanks for the figure. It seems as if I have understand you correctly. Use a combination of gluLookAt() and  gluPerspective() to achieve the desired projection and position change of the camera. 2D vanishing points are something else: Parallel lines in 3D do not intersect - but after projection in the camera plane the projected lines might intersect. The intersection point in 2D is called "vanishing point". It is possible to infer the projection properties and rotation of a camera from vanishing points and when I first have read your question I thought you were maybe interested in this.  
> **username_0**: Thank you for answering. I don't want to change the vanishing point of parallel lines in the 2D projection, but the PRP of the perspective projection matrix. I have added another figure indicating that the eye (origin of the view coordinate) does not change, but the position of the PRP. glLookAt() enables to move the eye, but not the PRP (https://www.khronos.org/registry/OpenGL-Refpages/gl2.1/xhtml/gluLookAt.xml), which is the parameter that I want to change. You can find this general model in "Computer Graphics with OpenGL 4th ed", page 322.  
> **username_1**: Okay, I had a look at the book and now it is clear what you want. I have edited my answer accordingly. Sorry, I did not get it earlier.  

---

### Answer by username_2 on 2017-12-26. Score: 0

If you are talking about an oblique perspective projection in which the line joining the eye and center of the projection plane is not perpendicular to the plane like here (upper left),

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

This can be generated by the `glFrustum()` call. Normally when you describe perspective projection they set

`left = -right`

`bottom = -top`

so that these are centered around the Z-axis. In order to generate an oblique projection you can use the [above](https://www.khronos.org/registry/OpenGL-Refpages/gl2.1/xhtml/glFrustum.xml) mentioned method which takes input the coordinates for left, right, top, bottom, near and far planes.

The other way around is to build your own custom projection matrix, and load it directly. The matrix should be stored as an array

`GLfloat mat[16] = {...}
GlLoadMatrix(mat)`

> **Comments:**
> **username_0**: I have added another figure indicating that the eye (origin of the view coordinate) does not change, but the position of the PRP.  

---

