packages/pyglGA/scripts/basicIndexedTriangle.py
def init(self):
        """
        Initialise an SDL2 RenderWindow, not directly but via the SDL2Decorator
        """
        print(f'SDL2Window init()')
        
        #SDL_Init for the window initialization
        sdl_not_initialised = sdl2.SDL_Init(sdl2.SDL_INIT_VIDEO | sdl2.SDL_INIT_TIMER)
        if sdl_not_initialised !=0:
            print("SDL2 could not be initialised! SDL Error: ", sdl2.SDL_GetError())
            exit(1)
        
        #setting OpenGL attributes for the GL state and context 4.1
        sdl2.SDL_GL_SetAttribute(sdl2.SDL_GL_CONTEXT_FLAGS,
                                 sdl2.SDL_GL_CONTEXT_FORWARD_COMPATIBLE_FLAG
                                 )
        sdl2.SDL_GL_SetAttribute(sdl2.SDL_GL_CONTEXT_PROFILE_MASK,
                                 sdl2.SDL_GL_CONTEXT_PROFILE_CORE
                                 )
        sdl2.SDL_GL_SetAttribute(sdl2.SDL_GL_DOUBLEBUFFER, 1)
        sdl2.SDL_GL_SetAttribute(sdl2.SDL_GL_DEPTH_SIZE, 24)
        sdl2.SDL_GL_SetAttribute(sdl2.SDL_GL_STENCIL_SIZE, 8)
        sdl2.SDL_GL_SetAttribute(sdl2.SDL_GL_ACCELERATED_VISUAL, 1)
        sdl2.SDL_GL_SetAttribute(sdl2.SDL_GL_MULTISAMPLEBUFFERS, 1)
        sdl2.SDL_GL_SetAttribute(sdl2.SDL_GL_MULTISAMPLESAMPLES, 16)
        sdl2.SDL_GL_SetAttribute(sdl2.SDL_GL_CONTEXT_MAJOR_VERSION, 4)
        sdl2.SDL_GL_SetAttribute(sdl2.SDL_GL_CONTEXT_MINOR_VERSION, 1)
        sdl2.SDL_SetHint(sdl2.SDL_HINT_MAC_CTRL_CLICK_EMULATE_RIGHT_CLICK, b"1")
        sdl2.SDL_SetHint(sdl2.SDL_HINT_VIDEO_HIGHDPI_DISABLED, b"1")
        
        #creating the SDL2 window
        self._gWindow = sdl2.SDL_CreateWindow(self._windowTitle.encode(), 
                                              sdl2.SDL_WINDOWPOS_CENTERED,
                                              sdl2.SDL_WINDOWPOS_CENTERED,
                                              self._windowWidth,
                                              self._windowHeight,
                                              sdl2.SDL_WINDOW_ALLOW_HIGHDPI)
        if self._gWindow is None:
            print("Window could not be created! SDL Error: ", sdl2.SDL_GetError())
            exit(1)
            
        #create the OpenGL context for rendering into the SDL2Window that was constructed just before
        self._gContext = sdl2.SDL_GL_CreateContext(self._gWindow)
        if self._gContext is None:
            print("OpenGL Context could not be created! SDL Error: ", sdl2.SDL_GetError())
            exit(1)
        sdl2.SDL_GL_MakeCurrent(self._gWindow, self._gContext)
        if sdl2.SDL_GL_SetSwapInterval(1) < 0:
            print("Warning: Unable to set VSync! SDL Error: " + sdl2.SDL_GetError())
            exit(1)
        #obtain the GL versioning system info
        self._gVersionLabel = f'OpenGL {gl.glGetString(gl.GL_VERSION).decode()} GLSL {gl.glGetString(gl.GL_SHADING_LANGUAGE_VERSION).decode()} Renderer {gl.glGetString(gl.GL_RENDERER).decode()}'
        print(self._gVersionLabel)

        Initialise an SDL2 RenderWindow, not directly but via the SDL2Decorator
        
Initialise an SDL2 RenderWindow, not directly but via the SDL2Decorator
Initialise an SDL2 RenderWindow not directly but via the SDL2Decorator
def init(self):
        print(f'SDL2Window init()')
        sdl_not_initialised = sdl2.SDL_Init(sdl2.SDL_INIT_VIDEO | sdl2.SDL_INIT_TIMER)
        if sdl_not_initialised !=0:
            print("SDL2 could not be initialised! SDL Error: ", sdl2.SDL_GetError())
            exit(1)
        sdl2.SDL_GL_SetAttribute(sdl2.SDL_GL_CONTEXT_FLAGS,
                                 sdl2.SDL_GL_CONTEXT_FORWARD_COMPATIBLE_FLAG
                                 )
        sdl2.SDL_GL_SetAttribute(sdl2.SDL_GL_CONTEXT_PROFILE_MASK,
                                 sdl2.SDL_GL_CONTEXT_PROFILE_CORE
                                 )
        sdl2.SDL_GL_SetAttribute(sdl2.SDL_GL_DOUBLEBUFFER, 1)
        sdl2.SDL_GL_SetAttribute(sdl2.SDL_GL_DEPTH_SIZE, 24)
        sdl2.SDL_GL_SetAttribute(sdl2.SDL_GL_STENCIL_SIZE, 8)
        sdl2.SDL_GL_SetAttribute(sdl2.SDL_GL_ACCELERATED_VISUAL, 1)
        sdl2.SDL_GL_SetAttribute(sdl2.SDL_GL_MULTISAMPLEBUFFERS, 1)
        sdl2.SDL_GL_SetAttribute(sdl2.SDL_GL_MULTISAMPLESAMPLES, 16)
        sdl2.SDL_GL_SetAttribute(sdl2.SDL_GL_CONTEXT_MAJOR_VERSION, 4)
        sdl2.SDL_GL_SetAttribute(sdl2.SDL_GL_CONTEXT_MINOR_VERSION, 1)
        sdl2.SDL_SetHint(sdl2.SDL_HINT_MAC_CTRL_CLICK_EMULATE_RIGHT_CLICK, b"1")
        sdl2.SDL_SetHint(sdl2.SDL_HINT_VIDEO_HIGHDPI_DISABLED, b"1")
        self._gWindow = sdl2.SDL_CreateWindow(self._windowTitle.encode(), 
                                              sdl2.SDL_WINDOWPOS_CENTERED,
                                              sdl2.SDL_WINDOWPOS_CENTERED,
                                              self._windowWidth,
                                              self._windowHeight,
                                              sdl2.SDL_WINDOW_ALLOW_HIGHDPI)
        if self._gWindow is None:
            print("Window could not be created! SDL Error: ", sdl2.SDL_GetError())
            exit(1)
        self._gContext = sdl2.SDL_GL_CreateContext(self._gWindow)
        if self._gContext is None:
            print("OpenGL Context could not be created! SDL Error: ", sdl2.SDL_GetError())
            exit(1)
        sdl2.SDL_GL_MakeCurrent(self._gWindow, self._gContext)
        if sdl2.SDL_GL_SetSwapInterval(1) < 0:
            print("Warning: Unable to set VSync! SDL Error: " + sdl2.SDL_GetError())
            exit(1)
        self._gVersionLabel = f'OpenGL {gl.glGetString(gl.GL_VERSION).decode()} GLSL {gl.glGetString(gl.GL_SHADING_LANGUAGE_VERSION).decode()} Renderer {gl.glGetString(gl.GL_RENDERER).decode()}'
        print(self._gVersionLabel)
def init ( self ) : print ( f'SDL2Window init()' ) sdl_not_initialised = sdl2 . SDL_Init ( sdl2 . SDL_INIT_VIDEO | sdl2 . SDL_INIT_TIMER ) if sdl_not_initialised != 0 : print ( "SDL2 could not be initialised! SDL Error: " , sdl2 . SDL_GetError ( ) ) exit ( 1 ) sdl2 . SDL_GL_SetAttribute ( sdl2 . SDL_GL_CONTEXT_FLAGS , sdl2 . SDL_GL_CONTEXT_FORWARD_COMPATIBLE_FLAG ) sdl2 . SDL_GL_SetAttribute ( sdl2 . SDL_GL_CONTEXT_PROFILE_MASK , sdl2 . SDL_GL_CONTEXT_PROFILE_CORE ) sdl2 . SDL_GL_SetAttribute ( sdl2 . SDL_GL_DOUBLEBUFFER , 1 ) sdl2 . SDL_GL_SetAttribute ( sdl2 . SDL_GL_DEPTH_SIZE , 24 ) sdl2 . SDL_GL_SetAttribute ( sdl2 . SDL_GL_STENCIL_SIZE , 8 ) sdl2 . SDL_GL_SetAttribute ( sdl2 . SDL_GL_ACCELERATED_VISUAL , 1 ) sdl2 . SDL_GL_SetAttribute ( sdl2 . SDL_GL_MULTISAMPLEBUFFERS , 1 ) sdl2 . SDL_GL_SetAttribute ( sdl2 . SDL_GL_MULTISAMPLESAMPLES , 16 ) sdl2 . SDL_GL_SetAttribute ( sdl2 . SDL_GL_CONTEXT_MAJOR_VERSION , 4 ) sdl2 . SDL_GL_SetAttribute ( sdl2 . SDL_GL_CONTEXT_MINOR_VERSION , 1 ) sdl2 . SDL_SetHint ( sdl2 . SDL_HINT_MAC_CTRL_CLICK_EMULATE_RIGHT_CLICK , b"1" ) sdl2 . SDL_SetHint ( sdl2 . SDL_HINT_VIDEO_HIGHDPI_DISABLED , b"1" ) self . _gWindow = sdl2 . SDL_CreateWindow ( self . _windowTitle . encode ( ) , sdl2 . SDL_WINDOWPOS_CENTERED , sdl2 . SDL_WINDOWPOS_CENTERED , self . _windowWidth , self . _windowHeight , sdl2 . SDL_WINDOW_ALLOW_HIGHDPI ) if self . _gWindow is None : print ( "Window could not be created! SDL Error: " , sdl2 . SDL_GetError ( ) ) exit ( 1 ) self . _gContext = sdl2 . SDL_GL_CreateContext ( self . _gWindow ) if self . _gContext is None : print ( "OpenGL Context could not be created! SDL Error: " , sdl2 . SDL_GetError ( ) ) exit ( 1 ) sdl2 . SDL_GL_MakeCurrent ( self . _gWindow , self . _gContext ) if sdl2 . SDL_GL_SetSwapInterval ( 1 ) < 0 : print ( "Warning: Unable to set VSync! SDL Error: " + sdl2 . SDL_GetError ( ) ) exit ( 1 ) self . _gVersionLabel = f'OpenGL {gl.glGetString(gl.GL_VERSION).decode()} GLSL {gl.glGetString(gl.GL_SHADING_LANGUAGE_VERSION).decode()} Renderer {gl.glGetString(gl.GL_RENDERER).decode()}' print ( self . _gVersionLabel )
Initialise an SDL2 RenderWindow, not directly but via the SDL2Decorator
Initialise an SDL2 RenderWindow not directly but via the SDL2Decorator
"""
        Initialise an SDL2 RenderWindow, not directly but via the SDL2Decorator
        """ #SDL_Init for the window initialization #setting OpenGL attributes for the GL state and context 4.1 #creating the SDL2 window #create the OpenGL context for rendering into the SDL2Window that was constructed just before #obtain the GL versioning system info
self