---
name: "Window"
section: "3"
platform: "linux"
package: "libvolpack1-dev"
version: "1.0b3-10"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/Window"
---

# Window(3)

multiply the projection matrix by a perspective or orthographic matrix

## NAME

vpWindow - multiply the projection matrix by a perspective or orthographic matrix

## SYNOPSIS

\#include \<volpack.h\>

vpResult

**vpWindow(***vpc, type, left, right, bottom, top, near, far***)**

-

  vpContext \**vpc;*

-

  int *type;*

-

  double *left, right;*

-

  double *bottom, top;*

-

  double *near, far;*

## ARGUMENTS

- *vpc*

  VolPack context from **vpCreateContext.**

- *type*

  Projection type code.  Currently, must be VP\_PARALLEL.

- *left*

  Coordinate of the left vertical clipping plane.

- *right*

  Coordinate of the right vertical clipping plane.

- *bottom*

  Coordinate of the bottom horizontal clipping plane.

- *top*

  Coordinate of the top horizontal clipping plane.

- *near*

  Coordinate of the near depth clipping plane.

- *far*

  Coordinate of the far depth clipping plane.

## DESCRIPTION

**vpWindow** is used to multiply the current projection matrix by a perspective or orthographic projection matrix.  The new projection matrix is defined by the coordinates of six clipping planes in the eye coordinate system (see vpCurrentMatrix(3)).  The matrix maps the points *(left, bottom, near)* and *(right, top, near)* to the lower left and upper right corners of the clipping window.  For an alternative means of specifying the projection matrix, see vpWindowPHIGS(3).

Currently, only orthographic projections are supported.  Perspective projections will be added in a future release.

The matrix for parallel projections is:

-

  	A	0	0	D\
  \
   	0	B	0	E\
  \
   	0	0	C	F\
  \
   	0	0	0	1

  A = 2 / *(right - left)*\
   B = 2 / *(top - bottom)*\
   C = 2 / *(far - near)*\
   D = *(left + right) / (left - right)*\
   E = *(bottom + top) / (bottom - top)*\
   F = *(near + far) / (near - far)*

The matrix is multiplied into the projection matrix, even if the projection matrix is not the current matrix.    By default, the matrix is post-multiplied (N = N\**m* where N is the current matrix and *m* is the argument to **vpMultMatrix**).  The VP\_CONCAT\_MODE option to **vpSeti** can be used to select pre-multiplication. The default window is a parallel projection with left = bottom = near = -0.5, and right = top = far = 0.5.

## STATE VARIABLES

The current matrix concatenation parameters can be retrieved with the following state variable codes (see vpGeti(3)): VP\_CONCAT\_MODE.

## ERRORS

The normal return value is VP\_OK.  The following error return values are possible:

- VPERROR\_BAD\_VALUE

  The clipping plane coordinates are invalid (*left \>= right*, etc.).

- VPERROR\_BAD\_OPTION

  The *type* argument is invalid.

## SEE ALSO

[VolPack(3)](/VolPack/3.md), vpCreateContext(3), vpCurrentMatrix(3), vpWindowPHIGS(3)
