<s> """<STR_LIT>""" <EOL> from pi3d . constants . egl import * <EOL> from pi3d . constants . gl import * <EOL> from pi3d . constants . gl2 import * <EOL> from pi3d . constants . gl2ext import * <EOL> from pi3d . util . Ctypes import c_ints <EOL> import ctypes <EOL> from ctypes import c_int , c_float <EOL> import pygame <EOL> import os , fnmatch <EOL> EGL_DEFAULT_DISPLAY = <NUM_LIT:0> <EOL> EGL_NO_CONTEXT = <NUM_LIT:0> <EOL> EGL_NO_DISPLAY = <NUM_LIT:0> <EOL> EGL_NO_SURFACE = <NUM_LIT:0> <EOL> EGL_FALSE = <NUM_LIT:0> <EOL> EGL_TRUE = <NUM_LIT:1> <EOL> EGL_PLATFORM_ANGLE_ANGLE = <NUM_LIT> <EOL> EGL_PLATFORM_ANGLE_TYPE_ANGLE = <NUM_LIT> <EOL> EGL_PLATFORM_ANGLE_MAX_VERSION_MAJOR_ANGLE = <NUM_LIT> <EOL> EGL_PLATFORM_ANGLE_MAX_VERSION_MINOR_ANGLE = <NUM_LIT> <EOL> EGL_PLATFORM_ANGLE_TYPE_DEFAULT_ANGLE = <NUM_LIT> <EOL> EGL_PLATFORM_ANGLE_TYPE_D3D9_ANGLE = <NUM_LIT> <EOL> EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE = <NUM_LIT> <EOL> EGL_PLATFORM_ANGLE_DEVICE_TYPE_ANGLE = <NUM_LIT> <EOL> EGL_PLATFORM_ANGLE_DEVICE_TYPE_HARDWARE_ANGLE = <NUM_LIT> <EOL> EGL_PLATFORM_ANGLE_DEVICE_TYPE_WARP_ANGLE = <NUM_LIT> <EOL> EGL_ANGLE_DISPLAY_ALLOW_RENDER_TO_BACK_BUFFER = <NUM_LIT> <EOL> EGL_PLATFORM_ANGLE_DEVICE_TYPE_REFERENCE_ANGLE = <NUM_LIT> <EOL> EGL_PLATFORM_ANGLE_ENABLE_AUTOMATIC_TRIM_ANGLE = <NUM_LIT> <EOL> pygame . init ( ) <EOL> d = pygame . display . set_mode ( ( <NUM_LIT:0> , <NUM_LIT:0> ) , pygame . DOUBLEBUF | pygame . RESIZABLE | pygame . OPENGL ) <EOL> info = pygame . display . Info ( ) <EOL> width , height = info . current_w , info . current_h <EOL> egl_attr = { "<STR_LIT>" : EGL_RED_SIZE , "<STR_LIT>" : EGL_GREEN_SIZE , <EOL> "<STR_LIT>" : EGL_BLUE_SIZE , "<STR_LIT>" : EGL_DEPTH_SIZE , <EOL> "<STR_LIT>" : EGL_ALPHA_SIZE , "<STR_LIT>" : EGL_BUFFER_SIZE , <EOL> "<STR_LIT>" : EGL_SAMPLES , "<STR_LIT>" : EGL_SURFACE_TYPE } <EOL> print ( """<STR_LIT>""" . format ( <EOL> EGL_FALSE , EGL_BAD_DISPLAY , EGL_BAD_ATTRIBUTE , EGL_NOT_INITIALIZED , <EOL> EGL_BAD_PARAMETER , EGL_WINDOW_BIT ) ) <EOL> path = "<STR_LIT>" <EOL> """<STR_LIT>""" <EOL> d3dcompiler = ctypes . WinDLL ( os . path . join ( path , "<STR_LIT>" ) ) <EOL> opengles = ctypes . WinDLL ( os . path . join ( path , "<STR_LIT>" ) ) <EOL> openegl = ctypes . WinDLL ( os . path . join ( path , "<STR_LIT>" ) ) <EOL> attribute_lists = [ c_ints ( ( EGL_PLATFORM_ANGLE_TYPE_ANGLE , EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE , <EOL> EGL_ANGLE_DISPLAY_ALLOW_RENDER_TO_BACK_BUFFER , EGL_TRUE , <EOL> EGL_PLATFORM_ANGLE_ENABLE_AUTOMATIC_TRIM_ANGLE , EGL_TRUE , <EOL> EGL_NONE ) ) , <EOL> c_ints ( ( EGL_PLATFORM_ANGLE_TYPE_ANGLE , EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE , <EOL> EGL_PLATFORM_ANGLE_MAX_VERSION_MAJOR_ANGLE , <NUM_LIT:9> , <EOL> EGL_PLATFORM_ANGLE_MAX_VERSION_MINOR_ANGLE , <NUM_LIT:3> , <EOL> EGL_ANGLE_DISPLAY_ALLOW_RENDER_TO_BACK_BUFFER , EGL_TRUE , <EOL> EGL_PLATFORM_ANGLE_ENABLE_AUTOMATIC_TRIM_ANGLE , EGL_TRUE , <EOL> EGL_NONE ) ) , <EOL> c_ints ( ( EGL_PLATFORM_ANGLE_TYPE_ANGLE , EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE , <EOL> EGL_PLATFORM_ANGLE_MAX_VERSION_MAJOR_ANGLE , <NUM_LIT:9> , <EOL> EGL_PLATFORM_ANGLE_MAX_VERSION_MINOR_ANGLE , <NUM_LIT:3> , <EOL> EGL_NONE ) ) , <EOL> c_ints ( ( EGL_PLATFORM_ANGLE_TYPE_ANGLE , EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE , <EOL> EGL_PLATFORM_ANGLE_DEVICE_TYPE_ANGLE , EGL_PLATFORM_ANGLE_DEVICE_TYPE_WARP_ANGLE , <EOL> EGL_ANGLE_DISPLAY_ALLOW_RENDER_TO_BACK_BUFFER , EGL_TRUE , <EOL> EGL_PLATFORM_ANGLE_ENABLE_AUTOMATIC_TRIM_ANGLE , EGL_TRUE , <EOL> EGL_NONE ) ) , <EOL> c_ints ( ( EGL_PLATFORM_ANGLE_TYPE_ANGLE , EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE , <EOL> EGL_NONE ) ) , <EOL> c_ints ( ( EGL_PLATFORM_ANGLE_TYPE_ANGLE , EGL_PLATFORM_ANGLE_TYPE_D3D9_ANGLE , <EOL> EGL_NONE ) ) ] <EOL> i = <NUM_LIT:0> <EOL> for a_list in attribute_lists : <EOL> i += <NUM_LIT:1> <EOL> display = openegl . eglGetPlatformDisplayEXT ( EGL_PLATFORM_ANGLE_ANGLE , <EOL> EGL_DEFAULT_DISPLAY , <EOL> ctypes . byref ( a_list ) ) <EOL> if display == EGL_NO_DISPLAY : <EOL> print ( "<STR_LIT>" . format ( i , display ) ) <EOL> continue <EOL> r = openegl . eglInitialize ( display , None , None ) <EOL> if r == EGL_TRUE : <EOL> break <EOL> print ( "<STR_LIT>" . format ( i , display != EGL_NO_DISPLAY ) ) <EOL> if display == EGL_NO_DISPLAY : <EOL> display = openegl . eglGetDisplay ( EGL_DEFAULT_DISPLAY ) <EOL> assert display != EGL_NO_DISPLAY <EOL> r = openegl . eglInitialize ( display , None , None ) <EOL> assert r == EGL_TRUE <EOL> attribute_list = c_ints ( [ <NUM_LIT:0> for i in range ( <NUM_LIT> ) ] ) <EOL> config = ctypes . c_void_p ( ) <EOL> numconfig = c_int ( ) <EOL> val = c_int ( ) <EOL> r = openegl . eglGetConfigs ( display , ctypes . byref ( attribute_list ) , <NUM_LIT> , ctypes . byref ( numconfig ) ) <EOL> print ( "<STR_LIT>" . format ( r , numconfig . value ) ) <EOL> for i in range ( numconfig . value ) : <EOL> conf_text = "<STR_LIT>" . format ( i ) <EOL> for attr in egl_attr : <EOL> r = openegl . eglGetConfigAttrib ( display , attribute_list [ i ] , egl_attr [ attr ] , ctypes . byref ( val ) ) <EOL> conf_text += "<STR_LIT>" . format ( attr , val . value ) <EOL> print ( conf_text ) <EOL> x = <NUM_LIT:0> <EOL> y = <NUM_LIT:0> <EOL> w = <NUM_LIT:0> <EOL> h = <NUM_LIT:0> <EOL> depth = <NUM_LIT:16> <EOL> samples = <NUM_LIT:0> <EOL> attribute_list = c_ints ( ( EGL_RED_SIZE , <NUM_LIT:8> , <EOL> EGL_GREEN_SIZE , <NUM_LIT:8> , <EOL> EGL_BLUE_SIZE , <NUM_LIT:8> , <EOL> EGL_DEPTH_SIZE , depth , <EOL> EGL_ALPHA_SIZE , <NUM_LIT:8> , <EOL> EGL_BUFFER_SIZE , <NUM_LIT:32> , <EOL> EGL_SAMPLES , samples , <EOL> EGL_SURFACE_TYPE , EGL_WINDOW_BIT , <EOL> EGL_NONE ) ) <EOL> r = openegl . eglChooseConfig ( display , <EOL> ctypes . byref ( attribute_list ) , <EOL> ctypes . byref ( config ) , <NUM_LIT:1> , <EOL> ctypes . byref ( numconfig ) ) <EOL> print ( "<STR_LIT>" . format ( r ) ) <EOL> context_attribs = c_ints ( ( EGL_CONTEXT_CLIENT_VERSION , <NUM_LIT:2> , EGL_NONE ) ) <EOL> context = openegl . eglCreateContext ( display , config , <EOL> EGL_NO_CONTEXT , ctypes . byref ( context_attribs ) ) <EOL> assert context != EGL_NO_CONTEXT <EOL> dst_rect = c_ints ( ( x , y , w , h ) ) <EOL> src_rect = c_ints ( ( x , y , w << <NUM_LIT:16> , h << <NUM_LIT:16> ) ) <EOL> flags = pygame . RESIZABLE | pygame . OPENGL <EOL> wsize = ( w , h ) <EOL> if w == width and h == height : <EOL> flags = pygame . FULLSCREEN | pygame . OPENGL <EOL> wsize = ( <NUM_LIT:0> , <NUM_LIT:0> ) <EOL> width , height = w , h <EOL> d = pygame . display . set_mode ( wsize , flags ) <EOL> window = pygame . display . get_wm_info ( ) [ "<STR_LIT>" ] <EOL> surface = openegl . eglCreateWindowSurface ( display , config , window , <NUM_LIT:0> ) <EOL> print ( "<STR_LIT>" . format ( surface ) ) <EOL> assert surface != EGL_NO_SURFACE <EOL> r = openegl . eglMakeCurrent ( display , surface , surface , context ) <EOL> assert r <EOL> opengles . glViewport ( <NUM_LIT:0> , <NUM_LIT:0> , w , h ) <EOL> opengles . glDepthRangef ( c_float ( <NUM_LIT:0.0> ) , c_float ( <NUM_LIT:1.0> ) ) <EOL> opengles . glClearColor ( c_float ( <NUM_LIT> ) , c_float ( <NUM_LIT> ) , c_float ( <NUM_LIT> ) , c_float ( <NUM_LIT:1.0> ) ) <EOL> opengles . glBindFramebuffer ( GL_FRAMEBUFFER , <NUM_LIT:0> ) <EOL> opengles . glEnable ( GL_CULL_FACE ) <EOL> opengles . glEnable ( GL_DEPTH_TEST ) <EOL> opengles . glDepthFunc ( GL_LESS ) ; <EOL> opengles . glDepthMask ( <NUM_LIT:1> ) ; <EOL> opengles . glCullFace ( GL_FRONT ) <EOL> opengles . glHint ( GL_GENERATE_MIPMAP_HINT , GL_NICEST ) <EOL> opengles . glBlendFunc ( GL_SRC_ALPHA , GL_ONE_MINUS_SRC_ALPHA ) <EOL> opengles . glColorMask ( <NUM_LIT:1> , <NUM_LIT:1> , <NUM_LIT:1> , <NUM_LIT:0> ) <EOL> active = True </s>
