Exemple #1
5
 def bottom(self) -> float:
     return rectangle.bottom(self._m)
Exemple #2
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))
        )
Exemple #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)))
Exemple #4
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))
        )
Exemple #5
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)))
Exemple #6
0
 def bottom(self):
     """The bottom most point of the viewport in pixels.
     """
     return rectangle.bottom(self.rect)
Exemple #7
0
 def bottom( self ):
     """The bottom most point of the viewport in pixels.
     """
     return rectangle.bottom( self.rect )
Exemple #8
0
 def test_bottom_negative(self):
     result = rectangle.bottom([[1.,2.],[-3.,-4.]])
     np.testing.assert_almost_equal(result, -2., decimal=5)
Exemple #9
0
 def test_bottom(self):
     result = rectangle.bottom([[1.,2.],[3.,4.]])
     np.testing.assert_almost_equal(result, 2., decimal=5)
Exemple #10
0
 def test_bottom_negative(self):
     result = rectangle.bottom([[1.,2.],[-3.,-4.]])
     np.testing.assert_almost_equal(result, -2., decimal=5)
Exemple #11
0
 def test_bottom(self):
     result = rectangle.bottom([[1.,2.],[3.,4.]])
     np.testing.assert_almost_equal(result, 2., decimal=5)