-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProjectionFix.pde
More file actions
44 lines (37 loc) · 960 Bytes
/
ProjectionFix.pde
File metadata and controls
44 lines (37 loc) · 960 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/*
COMP 3490 Fall 2022
Assignment 3
Tara Boulanger
7922331
ProjectionFix
This is the file containing the functions to compell Processing to let us edit the projection matrix.
*/
PGraphicsOpenGL pogl = null;
// called at the beginning of your code
void setupPOGL() {
pogl = (PGraphicsOpenGL)g;
}
// for debugging
void printProjection() {
pogl.projection.print();
}
// call immediately after using perspective() to create a view frustum
void fixFrustumYAxis() {
PMatrix3D projection = getProjection();
projection.preApply(new PMatrix3D(
1, 0, 0, 0,
0, -1, 0, 0,
0, 0, 1, 0,
0, 0, 0, 1
));
setProjection(projection);
}
PMatrix3D getProjection() {
assert pogl != null: "no PGraphics OpenGL context";
return pogl.projection.get();
}
void setProjection(PMatrix3D projectionMatrix) {
assert pogl != null: "no PGraphics OpenGL context";
pogl.projection.set(projectionMatrix.get());
pogl.updateProjmodelview();
}