def test_pygame2_sdl_gl_get_attribute(self): # __doc__ (as of 2009-12-14) for pygame2.sdl.gl.get_attribute: # get_attribute (attribute) -> int # # Gets an OpenGL attribute value. # # Gets the current value of the specified OpenGL attribute constant. gllib = self._get_gllib () if not gllib: return # No video. self.assertRaises (pygame2.Error, gl.get_attribute, constants.GL_DEPTH_SIZE) video.init () # No GL library self.assertRaises (pygame2.Error, gl.get_attribute, constants.GL_DEPTH_SIZE) # No screen self.assertEquals (gl.load_library (gllib), None) self.assertRaises (pygame2.Error, gl.get_attribute, constants.GL_DEPTH_SIZE) # No OpenGL screen screen = video.set_mode (10, 10) self.assertEquals (gl.get_attribute (constants.GL_DEPTH_SIZE), 0) screen = video.set_mode (10, 10, bpp=32, flags=constants.OPENGL) self.assertEquals (gl.get_attribute (constants.GL_DEPTH_SIZE), 24) video.quit ()
def test_pygame2_sdl_gl_set_attribute(self): # __doc__ (as of 2009-12-14) for pygame2.sdl.gl.set_attribute: # set_attribute (attribute, value) -> None # # Sets an OpenGL attribute value. # # Sets the value of the specified OpenGL attribute. gllib = self._get_gllib () if not gllib: return # No video. self.assertRaises (pygame2.Error, gl.set_attribute, constants.GL_RED_SIZE, 1) video.init () self.assertEquals (gl.load_library (gllib), None) # No OpenGL screen screen = video.set_mode (10, 10) self.assertEquals (gl.set_attribute (constants.GL_RED_SIZE, 1), None) self.assertEquals (gl.get_attribute (constants.GL_RED_SIZE), 0)