Setting projection and modelview matrices manually

Hi. I'd like to copy the projection and modelView matrices from one PGraphics into another one so I can render different passes of the same scene no matter what camera library is in use.

I have tried using get() and set() of both matrices like this (and different alternatives like projmodelView and combinatins of set() and apply() ):

PMatrix3D modelView = ((PGraphicsOpenGL) pgSrc).modelview.get();
PMatrix3D projection = ((PGraphicsOpenGL) pgSrc).projection.get();
((PGraphicsOpenGL) pgDst).projection.set(projection);
((PGraphicsOpenGL) pgDst).modelview.set(modelView);

I also tried the pure OpenGL calls from the method copyMatrices() from here

None of them worked. I can reuse the same PGraphics for each pass, but this would be more convenient. Does anyone know how it should be done?



Sign In or Register to comment.