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)) )
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)))
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)) )
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)))
def left(self): """The left most point of the viewport in pixels. """ return rectangle.left(self.rect)
def left( self ): """The left most point of the viewport in pixels. """ return rectangle.left( self.rect )
def test_left_negative(self): result = rectangle.left([[1.,2.],[-3.,-4.]]) np.testing.assert_almost_equal(result, -2., decimal=5)
def test_left(self): result = rectangle.left([[1.,2.],[3.,4.]]) np.testing.assert_almost_equal(result, 1., decimal=5)
def left(self) -> float: return rectangle.left(self._m)