/** * Set a new viewport size. The render context will also need to store a viewport matrix, which * you need to reset here. */ public void setViewportSize(int width, int height) { this.width = width; this.height = height; viewPortMatrix = new Matrix4f(); viewPortMatrix.setM00(width / 2f); viewPortMatrix.setM11(height / 2f); viewPortMatrix.setM22(1 / 2f); viewPortMatrix.setColumn(3, width / 2f, height / 2f, 1 / 2f, 1); colorBuffer = new BufferedImage(width, height, BufferedImage.TYPE_3BYTE_BGR); }
public static Matrix4f convertMT4JMatrixToMatrix4f(Matrix matrix) { Matrix4f mat = new Matrix4f(); for (int i = 0; i < 4; i++) { float[] col; try { col = matrix.getColumn(i); try { mat.setColumn(i, col); } catch (Exception e) { e.printStackTrace(); } } catch (Exception e1) { // TODO Auto-generated catch block e1.printStackTrace(); } } return mat; }