Exemplo n.º 1
0
def set_scissor( rect ):
    """Calls glScissor with the size of the rectangle.

    .. note:: It is up to the user to call glEnable(GL_SCISSOR_TEST).

    .. note:: To undo this, call this function again with the window's size as a rectangle.

    .. seealso::
        Module :py:mod:`pygly.window`
          Documentation of the :py:mod:`pygly.window` module.

    This call can be undone by first calling
    glPushAttrib( GL_SCISSOR_BIT )
    and later calling glPopAttrib().

    Or using the attribute context:
    with attributes( GL_SCISSOR_BIT ):
        set_scissor( rect )
    """
    GL.glScissor(
        int(rectangle.left(rect)),
        int(rectangle.bottom(rect)),
        int(rectangle.abs_width(rect)),
        int(rectangle.abs_height(rect))
        )
Exemplo n.º 2
0
def set_viewport(rect):
    """Calls glViewport with the dimensions of
    the rectangle

    In the OpenGL Legacy profile (<=2.1),
    this call can be undone by first calling
    glPushAttrib( GL_VIEWPORT_BIT )
    and later calling glPopAttrib().
    Or: using the attribute context:
    with attributes( GL_VIEWPORT_BIT ):
        set_viewport( rect )

    The glPushAttrib / glPopAttrib functions are not available on the
    OpenGL Core profile (>=3.0)
    """
    GL.glViewport(int(rectangle.left(rect)), int(rectangle.bottom(rect)),
                  int(rectangle.abs_width(rect)),
                  int(rectangle.abs_height(rect)))
Exemplo n.º 3
0
def set_viewport( rect ):
    """Calls glViewport with the dimensions of
    the rectangle

    In the OpenGL Legacy profile (<=2.1),
    this call can be undone by first calling
    glPushAttrib( GL_VIEWPORT_BIT )
    and later calling glPopAttrib().
    Or: using the attribute context:
    with attributes( GL_VIEWPORT_BIT ):
        set_viewport( rect )

    The glPushAttrib / glPopAttrib functions are not available on the
    OpenGL Core profile (>=3.0)
    """
    GL.glViewport(
        int(rectangle.left(rect)),
        int(rectangle.bottom(rect)),
        int(rectangle.abs_width(rect)),
        int(rectangle.abs_height(rect))
        )
Exemplo n.º 4
0
def set_scissor(rect):
    """Calls glScissor with the size of the rectangle.

    .. note:: It is up to the user to call glEnable(GL_SCISSOR_TEST).

    .. note:: To undo this, call this function again with the window's size as a rectangle.

    .. seealso::
        Module :py:mod:`pygly.window`
          Documentation of the :py:mod:`pygly.window` module.

    This call can be undone by first calling
    glPushAttrib( GL_SCISSOR_BIT )
    and later calling glPopAttrib().

    Or using the attribute context:
    with attributes( GL_SCISSOR_BIT ):
        set_scissor( rect )
    """
    GL.glScissor(int(rectangle.left(rect)), int(rectangle.bottom(rect)),
                 int(rectangle.abs_width(rect)),
                 int(rectangle.abs_height(rect)))
Exemplo n.º 5
0
 def left(self):
     """The left most point of the viewport in pixels.
     """
     return rectangle.left(self.rect)
Exemplo n.º 6
0
 def left( self ):
     """The left most point of the viewport in pixels.
     """
     return rectangle.left( self.rect )
Exemplo n.º 7
0
 def test_left_negative(self):
     result = rectangle.left([[1.,2.],[-3.,-4.]])
     np.testing.assert_almost_equal(result, -2., decimal=5)
Exemplo n.º 8
0
 def test_left(self):
     result = rectangle.left([[1.,2.],[3.,4.]])
     np.testing.assert_almost_equal(result, 1., decimal=5)
Exemplo n.º 9
0
 def left(self) -> float:
     return rectangle.left(self._m)
Exemplo n.º 10
0
 def test_left_negative(self):
     result = rectangle.left([[1.,2.],[-3.,-4.]])
     np.testing.assert_almost_equal(result, -2., decimal=5)
Exemplo n.º 11
0
 def test_left(self):
     result = rectangle.left([[1.,2.],[3.,4.]])
     np.testing.assert_almost_equal(result, 1., decimal=5)