Hg200

Joined 29 March 2020
42 bytes removed ,  4 January 2021
m
no edit summary
mNo edit summary
mNo edit summary
Line 157: Line 157:
{{Code|Section of opengl_renderer::setup_opengl_transformation ()"|<syntaxhighlight lang="C" style="font-size:13px">
{{Code|Section of opengl_renderer::setup_opengl_transformation ()"|<syntaxhighlight lang="C" style="font-size:13px">


    Matrix x_zlim = props.get_transform_zlim ();
  Matrix x_zlim = props.get_transform_zlim ();


    xZ1 = x_zlim(0)-(x_zlim(1)-x_zlim(0))/2;
  xZ1 = x_zlim(0)-(x_zlim(1)-x_zlim(0))/2;
    xZ2 = x_zlim(1)+(x_zlim(1)-x_zlim(0))/2;
  xZ2 = x_zlim(1)+(x_zlim(1)-x_zlim(0))/2;


    // Load x_gl_mat1 and x_gl_mat2
  // Load x_gl_mat1 and x_gl_mat2
    Matrix x_mat1 = props.get_opengl_matrix_1 ();
  Matrix x_mat1 = props.get_opengl_matrix_1 ();
    Matrix x_mat2 = props.get_opengl_matrix_2 ();
  Matrix x_mat2 = props.get_opengl_matrix_2 ();


    m_glfcns.glMatrixMode (GL_MODELVIEW);
  m_glfcns.glMatrixMode (GL_MODELVIEW);
    m_glfcns.glLoadIdentity ();
  m_glfcns.glLoadIdentity ();
    m_glfcns.glScaled (1, 1, -1);
  m_glfcns.glScaled (1, 1, -1);
    // Matrix x_gl_mat2
  // Matrix x_gl_mat2
    m_glfcns.glMultMatrixd (x_mat1.data ());
  m_glfcns.glMultMatrixd (x_mat1.data ());
    m_glfcns.glMatrixMode (GL_PROJECTION);
  m_glfcns.glMatrixMode (GL_PROJECTION);
    m_glfcns.glLoadIdentity ();
  m_glfcns.glLoadIdentity ();


    Matrix vp = get_viewport_scaled ();
  Matrix vp = get_viewport_scaled ();
    // Install Orthographic Projection Matrix with viewport
  // Install Orthographic Projection Matrix with viewport
    // setting 0, vp(2), vp(3), 0 and near / far values xZ1, xZ2
  // setting 0, vp(2), vp(3), 0 and near / far values xZ1, xZ2
    m_glfcns.glOrtho (0, vp(2), vp(3), 0, xZ1, xZ2);
  m_glfcns.glOrtho (0, vp(2), vp(3), 0, xZ1, xZ2);
    // Matrix x_gl_mat2
  // Matrix x_gl_mat2
    m_glfcns.glMultMatrixd (x_mat2.data ());
  m_glfcns.glMultMatrixd (x_mat2.data ());
    m_glfcns.glMatrixMode (GL_MODELVIEW);
  m_glfcns.glMatrixMode (GL_MODELVIEW);


    m_glfcns.glClear (GL_DEPTH_BUFFER_BIT);
  m_glfcns.glClear (GL_DEPTH_BUFFER_BIT);


</syntaxhighlight>}}
</syntaxhighlight>}}
20

edits