vpWindow(3)

πŸ“¦ version 1.0c7, in fedora 43, fedora 44

πŸ’– vpWindow β€” the vpWindow(3) glow-up ✨

okay bestie, settle in, because this is vpWindow from the Library Functions Manual and she's literally the girl who multiplies your projection matrix by a perspective or orthographic matrix. no cap. 🫢


🌸 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 β€” the VolPack context you got from vpCreateContext. your girl. your main character. πŸ’…
  • type β€” the projection type code. rn it must be VP_PARALLEL, no other options, that's the vibe check. 😌
  • 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 πŸ’œ

so vpWindow is used to multiply the current projection matrix by a perspective or orthographic projection matrix. the new projection matrix gets defined by the coordinates of six clipping planes in the eye coordinate system β€” peep vpCurrentMatrix(3) if you need the lore. 🌈

the matrix maps the points (left, bottom, near) and (right, top, near) to the lower left and upper right corners of the clipping window. and if you want an alternative way to specify the projection matrix, go see vpWindowPHIGS(3), she's iconic too. πŸ‘‘

currently, only orthographic projections are supported. perspective projections will be added in a future release β€” so don't come for her, she's growing. 🌱

the matrix for parallel projections is:

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

with these formulas, exactly as written:

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. not me pointing that out twice, but it matters. πŸ™ˆ

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. πŸ’«

and the default window? a parallel projection with left = bottom = near = -0.5, and right = top = far = 0.5. periodt. πŸ’…


πŸ¦‹ STATE VARIABLES πŸ¦‹

the current matrix concatenation parameters can be retrieved with this state variable code (check vpGeti(3) for the deets): VP_CONCAT_MODE.


πŸ”₯ ERRORS πŸ”₯

the normal return value is VP_OK β€” that's the slay. πŸ₯° the following error return values are possible tho:

  • VPERROR_BAD_VALUE β€” the clipping plane coordinates are invalid (left >= right, etc.). she said no. πŸ’€
  • VPERROR_BAD_OPTION β€” the type argument is invalid.

🌟 SEE ALSO 🌟

VolPack(3), vpCreateContext(3), vpCurrentMatrix(3), vpWindowPHIGS(3)


this has been VolPack's vpWindow(3) page, bestie β€” go multiply something cute. mwah. πŸ’–βœ¨πŸŽ€πŸ¦‹πŸŒΈπŸ’…πŸ«Ά

πŸ“¦ where this page comes from