Cast from PGraphics to GraphicsDevice?

By 3D I assume you’re using P3D? In which case check out GLWindow and this thread from earlier today Problem with robot cursor