original_docstring: Connects GLES2 helper library to PPB_OpenGLES2 interface
docstring: Connects GLES2 helper library to PPB_OpenGLES2 interface
docstring_tokens: Connects GLES2 helper library to PPB_OpenGLES2 interface
code: def WriteGLES2ToPPAPIBridge(self, filename):
      """Connects GLES2 helper library to PPB_OpenGLES2 interface"""
  
      file = CWriter(filename)
      file.Write(_LICENSE)
      file.Write(_DO_NOT_EDIT_WARNING)
  
      file.Write("#ifndef GL_GLEXT_PROTOTYPES\n")
      file.Write("#define GL_GLEXT_PROTOTYPES\n")
      file.Write("#endif\n")
      file.Write("#include <GLES2/gl2.h>\n")
      file.Write("#include <GLES2/gl2ext.h>\n")
      file.Write("#include \"ppapi/lib/gl/gles2/gl2ext_ppapi.h\"\n\n")
  
      for func in self.original_functions:
        if not func.InAnyPepperExtension():
          continue
  
        interface = self.interface_info[func.GetInfo('pepper_interface') or '']
  
        file.Write("%s GL_APIENTRY gl%s(%s) {\n" %
                   (func.return_type, func.GetPepperName(),
                    func.MakeTypedPepperArgString("")))
        return_str = "" if func.return_type == "void" else "return "
        interface_str = "glGet%sInterfacePPAPI()" % interface.GetName()
        original_arg = func.MakeOriginalArgString("")
        context_arg = "glGetCurrentContextPPAPI()"
        if len(original_arg):
          arg = context_arg + ", " + original_arg
        else:
          arg = context_arg
        if interface.GetName():
          file.Write("  const struct %s* ext = %s;\n" %
                     (interface.GetStructName(), interface_str))
          file.Write("  if (ext)\n")
          file.Write("    %sext->%s(%s);\n" %
                     (return_str, func.GetPepperName(), arg))
          if return_str:
            file.Write("  %s0;\n" % return_str)
        else:
          file.Write("  %s%s->%s(%s);\n" %
                     (return_str, interface_str, func.GetPepperName(), arg))
        file.Write("}\n\n")
      file.Close()
      self.generated_cpp_filenames.append(file.filename)
code_tokens: def WriteGLES2ToPPAPIBridge ( self , filename ) : file = CWriter ( filename ) file . Write ( _LICENSE ) file . Write ( _DO_NOT_EDIT_WARNING ) file . Write ( "#ifndef GL_GLEXT_PROTOTYPES\n" ) file . Write ( "#define GL_GLEXT_PROTOTYPES\n" ) file . Write ( "#endif\n" ) file . Write ( "#include <GLES2/gl2.h>\n" ) file . Write ( "#include <GLES2/gl2ext.h>\n" ) file . Write ( "#include \"ppapi/lib/gl/gles2/gl2ext_ppapi.h\"\n\n" ) for func in self . original_functions : if not func . InAnyPepperExtension ( ) : continue interface = self . interface_info [ func . GetInfo ( 'pepper_interface' ) or '' ] file . Write ( "%s GL_APIENTRY gl%s(%s) {\n" % ( func . return_type , func . GetPepperName ( ) , func . MakeTypedPepperArgString ( "" ) ) ) return_str = "" if func . return_type == "void" else "return " interface_str = "glGet%sInterfacePPAPI()" % interface . GetName ( ) original_arg = func . MakeOriginalArgString ( "" ) context_arg = "glGetCurrentContextPPAPI()" if len ( original_arg ) : arg = context_arg + ", " + original_arg else : arg = context_arg if interface . GetName ( ) : file . Write ( "  const struct %s* ext = %s;\n" % ( interface . GetStructName ( ) , interface_str ) ) file . Write ( "  if (ext)\n" ) file . Write ( "    %sext->%s(%s);\n" % ( return_str , func . GetPepperName ( ) , arg ) ) if return_str : file . Write ( "  %s0;\n" % return_str ) else : file . Write ( "  %s%s->%s(%s);\n" % ( return_str , interface_str , func . GetPepperName ( ) , arg ) ) file . Write ( "}\n\n" ) file . Close ( ) self . generated_cpp_filenames . append ( file . filename )
short_docstring: Connects GLES2 helper library to PPB_OpenGLES2 interface
short_docstring_tokens: Connects GLES2 helper library to PPB_OpenGLES2 interface
comment: """Connects GLES2 helper library to PPB_OpenGLES2 interface"""