github.com/thommil/tge-mobile@v0.0.0-20190308225214-66a08abd51aa/gl/interface.go (about)

     1  // Copyright 2014 The Go Authors.  All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package gl
     6  
     7  import (
     8  	"unsafe"
     9  )
    10  
    11  // Context is an OpenGL ES context.
    12  //
    13  // A Context has a method for every GL function supported by ES 2 or later.
    14  // In a program compiled with ES 3 support, a Context is also a Context3.
    15  // For example, a program can:
    16  //
    17  //	func f(glctx gl.Context) {
    18  //		glctx.(gl.Context3).BlitFramebuffer(...)
    19  //	}
    20  //
    21  // Calls are not safe for concurrent use. However calls can be made from
    22  // any goroutine, the gl package removes the notion of thread-local
    23  // context.
    24  //
    25  // Contexts are independent. Two contexts can be used concurrently.
    26  type Context interface {
    27  	// ActiveTexture sets the active texture unit.
    28  	//
    29  	// http://www.khronos.org/opengles/sdk/docs/man3/html/glActiveTexture.xhtml
    30  	ActiveTexture(texture Enum)
    31  
    32  	// AttachShader attaches a shader to a program.
    33  	//
    34  	// http://www.khronos.org/opengles/sdk/docs/man3/html/glAttachShader.xhtml
    35  	AttachShader(p Program, s Shader)
    36  
    37  	// BindAttribLocation binds a vertex attribute index with a named
    38  	// variable.
    39  	//
    40  	// http://www.khronos.org/opengles/sdk/docs/man3/html/glBindAttribLocation.xhtml
    41  	BindAttribLocation(p Program, a Attrib, name string)
    42  
    43  	// BindBuffer binds a buffer.
    44  	//
    45  	// http://www.khronos.org/opengles/sdk/docs/man3/html/glBindBuffer.xhtml
    46  	BindBuffer(target Enum, b Buffer)
    47  
    48  	// BindFramebuffer binds a framebuffer.
    49  	//
    50  	// http://www.khronos.org/opengles/sdk/docs/man3/html/glBindFramebuffer.xhtml
    51  	BindFramebuffer(target Enum, fb Framebuffer)
    52  
    53  	// BindRenderbuffer binds a render buffer.
    54  	//
    55  	// http://www.khronos.org/opengles/sdk/docs/man3/html/glBindRenderbuffer.xhtml
    56  	BindRenderbuffer(target Enum, rb Renderbuffer)
    57  
    58  	// BindTexture binds a texture.
    59  	//
    60  	// http://www.khronos.org/opengles/sdk/docs/man3/html/glBindTexture.xhtml
    61  	BindTexture(target Enum, t Texture)
    62  
    63  	// BindVertexArray binds a vertex array.
    64  	//
    65  	// http://www.khronos.org/opengles/sdk/docs/man3/html/glBindVertexArray.xhtml
    66  	BindVertexArray(rb VertexArray)
    67  
    68  	// BlendColor sets the blend color.
    69  	//
    70  	// http://www.khronos.org/opengles/sdk/docs/man3/html/glBlendColor.xhtml
    71  	BlendColor(red, green, blue, alpha float32)
    72  
    73  	// BlendEquation sets both RGB and alpha blend equations.
    74  	//
    75  	// http://www.khronos.org/opengles/sdk/docs/man3/html/glBlendEquation.xhtml
    76  	BlendEquation(mode Enum)
    77  
    78  	// BlendEquationSeparate sets RGB and alpha blend equations separately.
    79  	//
    80  	// http://www.khronos.org/opengles/sdk/docs/man3/html/glBlendEquationSeparate.xhtml
    81  	BlendEquationSeparate(modeRGB, modeAlpha Enum)
    82  
    83  	// BlendFunc sets the pixel blending factors.
    84  	//
    85  	// http://www.khronos.org/opengles/sdk/docs/man3/html/glBlendFunc.xhtml
    86  	BlendFunc(sfactor, dfactor Enum)
    87  
    88  	// BlendFunc sets the pixel RGB and alpha blending factors separately.
    89  	//
    90  	// http://www.khronos.org/opengles/sdk/docs/man3/html/glBlendFuncSeparate.xhtml
    91  	BlendFuncSeparate(sfactorRGB, dfactorRGB, sfactorAlpha, dfactorAlpha Enum)
    92  
    93  	// BufferData creates a new data store for the bound buffer object.
    94  	//
    95  	// http://www.khronos.org/opengles/sdk/docs/man3/html/glBufferData.xhtml
    96  	BufferData(target Enum, src []byte, usage Enum)
    97  
    98  	// BufferInit creates a new uninitialized data store for the bound buffer object.
    99  	//
   100  	// http://www.khronos.org/opengles/sdk/docs/man3/html/glBufferData.xhtml
   101  	BufferInit(target Enum, size int, usage Enum)
   102  
   103  	// BufferSubData sets some of data in the bound buffer object.
   104  	//
   105  	// http://www.khronos.org/opengles/sdk/docs/man3/html/glBufferSubData.xhtml
   106  	BufferSubData(target Enum, offset int, data []byte)
   107  
   108  	// CheckFramebufferStatus reports the completeness status of the
   109  	// active framebuffer.
   110  	//
   111  	// http://www.khronos.org/opengles/sdk/docs/man3/html/glCheckFramebufferStatus.xhtml
   112  	CheckFramebufferStatus(target Enum) Enum
   113  
   114  	// Clear clears the window.
   115  	//
   116  	// The behavior of Clear is influenced by the pixel ownership test,
   117  	// the scissor test, dithering, and the buffer writemasks.
   118  	//
   119  	// http://www.khronos.org/opengles/sdk/docs/man3/html/glClear.xhtml
   120  	Clear(mask Enum)
   121  
   122  	// ClearColor specifies the RGBA values used to clear color buffers.
   123  	//
   124  	// http://www.khronos.org/opengles/sdk/docs/man3/html/glClearColor.xhtml
   125  	ClearColor(red, green, blue, alpha float32)
   126  
   127  	// ClearDepthf sets the depth value used to clear the depth buffer.
   128  	//
   129  	// http://www.khronos.org/opengles/sdk/docs/man3/html/glClearDepthf.xhtml
   130  	ClearDepthf(d float32)
   131  
   132  	// ClearStencil sets the index used to clear the stencil buffer.
   133  	//
   134  	// http://www.khronos.org/opengles/sdk/docs/man3/html/glClearStencil.xhtml
   135  	ClearStencil(s int)
   136  
   137  	// ColorMask specifies whether color components in the framebuffer
   138  	// can be written.
   139  	//
   140  	// http://www.khronos.org/opengles/sdk/docs/man3/html/glColorMask.xhtml
   141  	ColorMask(red, green, blue, alpha bool)
   142  
   143  	// CompileShader compiles the source code of s.
   144  	//
   145  	// http://www.khronos.org/opengles/sdk/docs/man3/html/glCompileShader.xhtml
   146  	CompileShader(s Shader)
   147  
   148  	// CompressedTexImage2D writes a compressed 2D texture.
   149  	//
   150  	// http://www.khronos.org/opengles/sdk/docs/man3/html/glCompressedTexImage2D.xhtml
   151  	CompressedTexImage2D(target Enum, level int, internalformat Enum, width, height, border int, data []byte)
   152  
   153  	// CompressedTexSubImage2D writes a subregion of a compressed 2D texture.
   154  	//
   155  	// http://www.khronos.org/opengles/sdk/docs/man3/html/glCompressedTexSubImage2D.xhtml
   156  	CompressedTexSubImage2D(target Enum, level, xoffset, yoffset, width, height int, format Enum, data []byte)
   157  
   158  	// CopyTexImage2D writes a 2D texture from the current framebuffer.
   159  	//
   160  	// http://www.khronos.org/opengles/sdk/docs/man3/html/glCopyTexImage2D.xhtml
   161  	CopyTexImage2D(target Enum, level int, internalformat Enum, x, y, width, height, border int)
   162  
   163  	// CopyTexSubImage2D writes a 2D texture subregion from the
   164  	// current framebuffer.
   165  	//
   166  	// http://www.khronos.org/opengles/sdk/docs/man3/html/glCopyTexSubImage2D.xhtml
   167  	CopyTexSubImage2D(target Enum, level, xoffset, yoffset, x, y, width, height int)
   168  
   169  	// CreateBuffer creates a buffer object.
   170  	//
   171  	// http://www.khronos.org/opengles/sdk/docs/man3/html/glGenBuffers.xhtml
   172  	CreateBuffer() Buffer
   173  
   174  	// CreateFramebuffer creates a framebuffer object.
   175  	//
   176  	// http://www.khronos.org/opengles/sdk/docs/man3/html/glGenFramebuffers.xhtml
   177  	CreateFramebuffer() Framebuffer
   178  
   179  	// CreateProgram creates a new empty program object.
   180  	//
   181  	// http://www.khronos.org/opengles/sdk/docs/man3/html/glCreateProgram.xhtml
   182  	CreateProgram() Program
   183  
   184  	// CreateRenderbuffer create a renderbuffer object.
   185  	//
   186  	// http://www.khronos.org/opengles/sdk/docs/man3/html/glGenRenderbuffers.xhtml
   187  	CreateRenderbuffer() Renderbuffer
   188  
   189  	// CreateShader creates a new empty shader object.
   190  	//
   191  	// http://www.khronos.org/opengles/sdk/docs/man3/html/glCreateShader.xhtml
   192  	CreateShader(ty Enum) Shader
   193  
   194  	// CreateTexture creates a texture object.
   195  	//
   196  	// http://www.khronos.org/opengles/sdk/docs/man3/html/glGenTextures.xhtml
   197  	CreateTexture() Texture
   198  
   199  	// CreateTVertexArray creates a vertex array.
   200  	//
   201  	// http://www.khronos.org/opengles/sdk/docs/man3/html/glGenVertexArrays.xhtml
   202  	CreateVertexArray() VertexArray
   203  
   204  	// CullFace specifies which polygons are candidates for culling.
   205  	//
   206  	// Valid modes: FRONT, BACK, FRONT_AND_BACK.
   207  	//
   208  	// http://www.khronos.org/opengles/sdk/docs/man3/html/glCullFace.xhtml
   209  	CullFace(mode Enum)
   210  
   211  	// DeleteBuffer deletes the given buffer object.
   212  	//
   213  	// http://www.khronos.org/opengles/sdk/docs/man3/html/glDeleteBuffers.xhtml
   214  	DeleteBuffer(v Buffer)
   215  
   216  	// DeleteFramebuffer deletes the given framebuffer object.
   217  	//
   218  	// http://www.khronos.org/opengles/sdk/docs/man3/html/glDeleteFramebuffers.xhtml
   219  	DeleteFramebuffer(v Framebuffer)
   220  
   221  	// DeleteProgram deletes the given program object.
   222  	//
   223  	// http://www.khronos.org/opengles/sdk/docs/man3/html/glDeleteProgram.xhtml
   224  	DeleteProgram(p Program)
   225  
   226  	// DeleteRenderbuffer deletes the given render buffer object.
   227  	//
   228  	// http://www.khronos.org/opengles/sdk/docs/man3/html/glDeleteRenderbuffers.xhtml
   229  	DeleteRenderbuffer(v Renderbuffer)
   230  
   231  	// DeleteShader deletes shader s.
   232  	//
   233  	// http://www.khronos.org/opengles/sdk/docs/man3/html/glDeleteShader.xhtml
   234  	DeleteShader(s Shader)
   235  
   236  	// DeleteTexture deletes the given texture object.
   237  	//
   238  	// http://www.khronos.org/opengles/sdk/docs/man3/html/glDeleteTextures.xhtml
   239  	DeleteTexture(v Texture)
   240  
   241  	// DeleteVertexArray deletes the given render buffer object.
   242  	//
   243  	// http://www.khronos.org/opengles/sdk/docs/man3/html/glDeleteVertexArrays.xhtml
   244  	DeleteVertexArray(v VertexArray)
   245  
   246  	// DepthFunc sets the function used for depth buffer comparisons.
   247  	//
   248  	// Valid fn values:
   249  	//	NEVER
   250  	//	LESS
   251  	//	EQUAL
   252  	//	LEQUAL
   253  	//	GREATER
   254  	//	NOTEQUAL
   255  	//	GEQUAL
   256  	//	ALWAYS
   257  	//
   258  	// http://www.khronos.org/opengles/sdk/docs/man3/html/glDepthFunc.xhtml
   259  	DepthFunc(fn Enum)
   260  
   261  	// DepthMask sets the depth buffer enabled for writing.
   262  	//
   263  	// http://www.khronos.org/opengles/sdk/docs/man3/html/glDepthMask.xhtml
   264  	DepthMask(flag bool)
   265  
   266  	// DepthRangef sets the mapping from normalized device coordinates to
   267  	// window coordinates.
   268  	//
   269  	// http://www.khronos.org/opengles/sdk/docs/man3/html/glDepthRangef.xhtml
   270  	DepthRangef(n, f float32)
   271  
   272  	// DetachShader detaches the shader s from the program p.
   273  	//
   274  	// http://www.khronos.org/opengles/sdk/docs/man3/html/glDetachShader.xhtml
   275  	DetachShader(p Program, s Shader)
   276  
   277  	// Disable disables various GL capabilities.
   278  	//
   279  	// http://www.khronos.org/opengles/sdk/docs/man3/html/glDisable.xhtml
   280  	Disable(cap Enum)
   281  
   282  	// DisableVertexAttribArray disables a vertex attribute array.
   283  	//
   284  	// http://www.khronos.org/opengles/sdk/docs/man3/html/glDisableVertexAttribArray.xhtml
   285  	DisableVertexAttribArray(a Attrib)
   286  
   287  	// DrawArrays renders geometric primitives from the bound data.
   288  	//
   289  	// http://www.khronos.org/opengles/sdk/docs/man3/html/glDrawArrays.xhtml
   290  	DrawArrays(mode Enum, first, count int)
   291  
   292  	// DrawElements renders primitives from a bound buffer.
   293  	//
   294  	// http://www.khronos.org/opengles/sdk/docs/man3/html/glDrawElements.xhtml
   295  	DrawElements(mode Enum, count int, ty Enum, offset int)
   296  
   297  	// TODO(crawshaw): consider DrawElements8 / DrawElements16 / DrawElements32
   298  
   299  	// Enable enables various GL capabilities.
   300  	//
   301  	// http://www.khronos.org/opengles/sdk/docs/man3/html/glEnable.xhtml
   302  	Enable(cap Enum)
   303  
   304  	// EnableVertexAttribArray enables a vertex attribute array.
   305  	//
   306  	// http://www.khronos.org/opengles/sdk/docs/man3/html/glEnableVertexAttribArray.xhtml
   307  	EnableVertexAttribArray(a Attrib)
   308  
   309  	// Finish blocks until the effects of all previously called GL
   310  	// commands are complete.
   311  	//
   312  	// http://www.khronos.org/opengles/sdk/docs/man3/html/glFinish.xhtml
   313  	Finish()
   314  
   315  	// Flush empties all buffers. It does not block.
   316  	//
   317  	// An OpenGL implementation may buffer network communication,
   318  	// the command stream, or data inside the graphics accelerator.
   319  	//
   320  	// http://www.khronos.org/opengles/sdk/docs/man3/html/glFlush.xhtml
   321  	Flush()
   322  
   323  	// FramebufferRenderbuffer attaches rb to the current frame buffer.
   324  	//
   325  	// http://www.khronos.org/opengles/sdk/docs/man3/html/glFramebufferRenderbuffer.xhtml
   326  	FramebufferRenderbuffer(target, attachment, rbTarget Enum, rb Renderbuffer)
   327  
   328  	// FramebufferTexture2D attaches the t to the current frame buffer.
   329  	//
   330  	// http://www.khronos.org/opengles/sdk/docs/man3/html/glFramebufferTexture2D.xhtml
   331  	FramebufferTexture2D(target, attachment, texTarget Enum, t Texture, level int)
   332  
   333  	// FrontFace defines which polygons are front-facing.
   334  	//
   335  	// Valid modes: CW, CCW.
   336  	//
   337  	// http://www.khronos.org/opengles/sdk/docs/man3/html/glFrontFace.xhtml
   338  	FrontFace(mode Enum)
   339  
   340  	// GenerateMipmap generates mipmaps for the current texture.
   341  	//
   342  	// http://www.khronos.org/opengles/sdk/docs/man3/html/glGenerateMipmap.xhtml
   343  	GenerateMipmap(target Enum)
   344  
   345  	// GetActiveAttrib returns details about an active attribute variable.
   346  	// A value of 0 for index selects the first active attribute variable.
   347  	// Permissible values for index range from 0 to the number of active
   348  	// attribute variables minus 1.
   349  	//
   350  	// http://www.khronos.org/opengles/sdk/docs/man3/html/glGetActiveAttrib.xhtml
   351  	GetActiveAttrib(p Program, index uint32) (name string, size int, ty Enum)
   352  
   353  	// GetActiveUniform returns details about an active uniform variable.
   354  	// A value of 0 for index selects the first active uniform variable.
   355  	// Permissible values for index range from 0 to the number of active
   356  	// uniform variables minus 1.
   357  	//
   358  	// http://www.khronos.org/opengles/sdk/docs/man3/html/glGetActiveUniform.xhtml
   359  	GetActiveUniform(p Program, index uint32) (name string, size int, ty Enum)
   360  
   361  	// GetAttachedShaders returns the shader objects attached to program p.
   362  	//
   363  	// http://www.khronos.org/opengles/sdk/docs/man3/html/glGetAttachedShaders.xhtml
   364  	GetAttachedShaders(p Program) []Shader
   365  
   366  	// GetAttribLocation returns the location of an attribute variable.
   367  	//
   368  	// http://www.khronos.org/opengles/sdk/docs/man3/html/glGetAttribLocation.xhtml
   369  	GetAttribLocation(p Program, name string) Attrib
   370  
   371  	// GetBooleanv returns the boolean values of parameter pname.
   372  	//
   373  	// Many boolean parameters can be queried more easily using IsEnabled.
   374  	//
   375  	// http://www.khronos.org/opengles/sdk/docs/man3/html/glGet.xhtml
   376  	GetBooleanv(dst []bool, pname Enum)
   377  
   378  	// GetFloatv returns the float values of parameter pname.
   379  	//
   380  	// http://www.khronos.org/opengles/sdk/docs/man3/html/glGet.xhtml
   381  	GetFloatv(dst []float32, pname Enum)
   382  
   383  	// GetIntegerv returns the int values of parameter pname.
   384  	//
   385  	// Single values may be queried more easily using GetInteger.
   386  	//
   387  	// http://www.khronos.org/opengles/sdk/docs/man3/html/glGet.xhtml
   388  	GetIntegerv(dst []int32, pname Enum)
   389  
   390  	// GetInteger returns the int value of parameter pname.
   391  	//
   392  	// http://www.khronos.org/opengles/sdk/docs/man3/html/glGet.xhtml
   393  	GetInteger(pname Enum) int
   394  
   395  	// GetBufferParameteri returns a parameter for the active buffer.
   396  	//
   397  	// http://www.khronos.org/opengles/sdk/docs/man3/html/glGetBufferParameter.xhtml
   398  	GetBufferParameteri(target, value Enum) int
   399  
   400  	// GetError returns the next error.
   401  	//
   402  	// http://www.khronos.org/opengles/sdk/docs/man3/html/glGetError.xhtml
   403  	GetError() Enum
   404  
   405  	// GetFramebufferAttachmentParameteri returns attachment parameters
   406  	// for the active framebuffer object.
   407  	//
   408  	// http://www.khronos.org/opengles/sdk/docs/man3/html/glGetFramebufferAttachmentParameteriv.xhtml
   409  	GetFramebufferAttachmentParameteri(target, attachment, pname Enum) int
   410  
   411  	// GetProgrami returns a parameter value for a program.
   412  	//
   413  	// http://www.khronos.org/opengles/sdk/docs/man3/html/glGetProgramiv.xhtml
   414  	GetProgrami(p Program, pname Enum) int
   415  
   416  	// GetProgramInfoLog returns the information log for a program.
   417  	//
   418  	// http://www.khronos.org/opengles/sdk/docs/man3/html/glGetProgramInfoLog.xhtml
   419  	GetProgramInfoLog(p Program) string
   420  
   421  	// GetRenderbufferParameteri returns a parameter value for a render buffer.
   422  	//
   423  	// http://www.khronos.org/opengles/sdk/docs/man3/html/glGetRenderbufferParameteriv.xhtml
   424  	GetRenderbufferParameteri(target, pname Enum) int
   425  
   426  	// GetShaderi returns a parameter value for a shader.
   427  	//
   428  	// http://www.khronos.org/opengles/sdk/docs/man3/html/glGetShaderiv.xhtml
   429  	GetShaderi(s Shader, pname Enum) int
   430  
   431  	// GetShaderInfoLog returns the information log for a shader.
   432  	//
   433  	// http://www.khronos.org/opengles/sdk/docs/man3/html/glGetShaderInfoLog.xhtml
   434  	GetShaderInfoLog(s Shader) string
   435  
   436  	// GetShaderPrecisionFormat returns range and precision limits for
   437  	// shader types.
   438  	//
   439  	// http://www.khronos.org/opengles/sdk/docs/man3/html/glGetShaderPrecisionFormat.xhtml
   440  	GetShaderPrecisionFormat(shadertype, precisiontype Enum) (rangeLow, rangeHigh, precision int)
   441  
   442  	// GetShaderSource returns source code of shader s.
   443  	//
   444  	// http://www.khronos.org/opengles/sdk/docs/man3/html/glGetShaderSource.xhtml
   445  	GetShaderSource(s Shader) string
   446  
   447  	// GetString reports current GL state.
   448  	//
   449  	// Valid name values:
   450  	//	EXTENSIONS
   451  	//	RENDERER
   452  	//	SHADING_LANGUAGE_VERSION
   453  	//	VENDOR
   454  	//	VERSION
   455  	//
   456  	// http://www.khronos.org/opengles/sdk/docs/man3/html/glGetString.xhtml
   457  	GetString(pname Enum) string
   458  
   459  	// GetTexParameterfv returns the float values of a texture parameter.
   460  	//
   461  	// http://www.khronos.org/opengles/sdk/docs/man3/html/glGetTexParameter.xhtml
   462  	GetTexParameterfv(dst []float32, target, pname Enum)
   463  
   464  	// GetTexParameteriv returns the int values of a texture parameter.
   465  	//
   466  	// http://www.khronos.org/opengles/sdk/docs/man3/html/glGetTexParameter.xhtml
   467  	GetTexParameteriv(dst []int32, target, pname Enum)
   468  
   469  	// GetUniformfv returns the float values of a uniform variable.
   470  	//
   471  	// http://www.khronos.org/opengles/sdk/docs/man3/html/glGetUniform.xhtml
   472  	GetUniformfv(dst []float32, src Uniform, p Program)
   473  
   474  	// GetUniformiv returns the float values of a uniform variable.
   475  	//
   476  	// http://www.khronos.org/opengles/sdk/docs/man3/html/glGetUniform.xhtml
   477  	GetUniformiv(dst []int32, src Uniform, p Program)
   478  
   479  	// GetUniformLocation returns the location of a uniform variable.
   480  	//
   481  	// http://www.khronos.org/opengles/sdk/docs/man3/html/glGetUniformLocation.xhtml
   482  	GetUniformLocation(p Program, name string) Uniform
   483  
   484  	// GetVertexAttribf reads the float value of a vertex attribute.
   485  	//
   486  	// http://www.khronos.org/opengles/sdk/docs/man3/html/glGetVertexAttrib.xhtml
   487  	GetVertexAttribf(src Attrib, pname Enum) float32
   488  
   489  	// GetVertexAttribfv reads float values of a vertex attribute.
   490  	//
   491  	// http://www.khronos.org/opengles/sdk/docs/man3/html/glGetVertexAttrib.xhtml
   492  	GetVertexAttribfv(dst []float32, src Attrib, pname Enum)
   493  
   494  	// GetVertexAttribi reads the int value of a vertex attribute.
   495  	//
   496  	// http://www.khronos.org/opengles/sdk/docs/man3/html/glGetVertexAttrib.xhtml
   497  	GetVertexAttribi(src Attrib, pname Enum) int32
   498  
   499  	// GetVertexAttribiv reads int values of a vertex attribute.
   500  	//
   501  	// http://www.khronos.org/opengles/sdk/docs/man3/html/glGetVertexAttrib.xhtml
   502  	GetVertexAttribiv(dst []int32, src Attrib, pname Enum)
   503  
   504  	// TODO(crawshaw): glGetVertexAttribPointerv
   505  
   506  	// Hint sets implementation-specific modes.
   507  	//
   508  	// http://www.khronos.org/opengles/sdk/docs/man3/html/glHint.xhtml
   509  	Hint(target, mode Enum)
   510  
   511  	// IsBuffer reports if b is a valid buffer.
   512  	//
   513  	// http://www.khronos.org/opengles/sdk/docs/man3/html/glIsBuffer.xhtml
   514  	IsBuffer(b Buffer) bool
   515  
   516  	// IsEnabled reports if cap is an enabled capability.
   517  	//
   518  	// http://www.khronos.org/opengles/sdk/docs/man3/html/glIsEnabled.xhtml
   519  	IsEnabled(cap Enum) bool
   520  
   521  	// IsFramebuffer reports if fb is a valid frame buffer.
   522  	//
   523  	// http://www.khronos.org/opengles/sdk/docs/man3/html/glIsFramebuffer.xhtml
   524  	IsFramebuffer(fb Framebuffer) bool
   525  
   526  	// IsProgram reports if p is a valid program object.
   527  	//
   528  	// http://www.khronos.org/opengles/sdk/docs/man3/html/glIsProgram.xhtml
   529  	IsProgram(p Program) bool
   530  
   531  	// IsRenderbuffer reports if rb is a valid render buffer.
   532  	//
   533  	// http://www.khronos.org/opengles/sdk/docs/man3/html/glIsRenderbuffer.xhtml
   534  	IsRenderbuffer(rb Renderbuffer) bool
   535  
   536  	// IsShader reports if s is valid shader.
   537  	//
   538  	// http://www.khronos.org/opengles/sdk/docs/man3/html/glIsShader.xhtml
   539  	IsShader(s Shader) bool
   540  
   541  	// IsTexture reports if t is a valid texture.
   542  	//
   543  	// http://www.khronos.org/opengles/sdk/docs/man3/html/glIsTexture.xhtml
   544  	IsTexture(t Texture) bool
   545  
   546  	// LineWidth specifies the width of lines.
   547  	//
   548  	// http://www.khronos.org/opengles/sdk/docs/man3/html/glLineWidth.xhtml
   549  	LineWidth(width float32)
   550  
   551  	// LinkProgram links the specified program.
   552  	//
   553  	// http://www.khronos.org/opengles/sdk/docs/man3/html/glLinkProgram.xhtml
   554  	LinkProgram(p Program)
   555  
   556  	// PixelStorei sets pixel storage parameters.
   557  	//
   558  	// http://www.khronos.org/opengles/sdk/docs/man3/html/glPixelStorei.xhtml
   559  	PixelStorei(pname Enum, param int32)
   560  
   561  	// PolygonOffset sets the scaling factors for depth offsets.
   562  	//
   563  	// http://www.khronos.org/opengles/sdk/docs/man3/html/glPolygonOffset.xhtml
   564  	PolygonOffset(factor, units float32)
   565  
   566  	// ReadPixels returns pixel data from a buffer.
   567  	//
   568  	// In GLES 3, the source buffer is controlled with ReadBuffer.
   569  	//
   570  	// http://www.khronos.org/opengles/sdk/docs/man3/html/glReadPixels.xhtml
   571  	ReadPixels(dst []byte, x, y, width, height int, format, ty Enum)
   572  
   573  	// ReleaseShaderCompiler frees resources allocated by the shader compiler.
   574  	//
   575  	// http://www.khronos.org/opengles/sdk/docs/man3/html/glReleaseShaderCompiler.xhtml
   576  	ReleaseShaderCompiler()
   577  
   578  	// RenderbufferStorage establishes the data storage, format, and
   579  	// dimensions of a renderbuffer object's image.
   580  	//
   581  	// http://www.khronos.org/opengles/sdk/docs/man3/html/glRenderbufferStorage.xhtml
   582  	RenderbufferStorage(target, internalFormat Enum, width, height int)
   583  
   584  	// SampleCoverage sets multisample coverage parameters.
   585  	//
   586  	// http://www.khronos.org/opengles/sdk/docs/man3/html/glSampleCoverage.xhtml
   587  	SampleCoverage(value float32, invert bool)
   588  
   589  	// Scissor defines the scissor box rectangle, in window coordinates.
   590  	//
   591  	// http://www.khronos.org/opengles/sdk/docs/man3/html/glScissor.xhtml
   592  	Scissor(x, y, width, height int32)
   593  
   594  	// TODO(crawshaw): ShaderBinary
   595  
   596  	// ShaderSource sets the source code of s to the given source code.
   597  	//
   598  	// http://www.khronos.org/opengles/sdk/docs/man3/html/glShaderSource.xhtml
   599  	ShaderSource(s Shader, src string)
   600  
   601  	// StencilFunc sets the front and back stencil test reference value.
   602  	//
   603  	// http://www.khronos.org/opengles/sdk/docs/man3/html/glStencilFunc.xhtml
   604  	StencilFunc(fn Enum, ref int, mask uint32)
   605  
   606  	// StencilFunc sets the front or back stencil test reference value.
   607  	//
   608  	// http://www.khronos.org/opengles/sdk/docs/man3/html/glStencilFuncSeparate.xhtml
   609  	StencilFuncSeparate(face, fn Enum, ref int, mask uint32)
   610  
   611  	// StencilMask controls the writing of bits in the stencil planes.
   612  	//
   613  	// http://www.khronos.org/opengles/sdk/docs/man3/html/glStencilMask.xhtml
   614  	StencilMask(mask uint32)
   615  
   616  	// StencilMaskSeparate controls the writing of bits in the stencil planes.
   617  	//
   618  	// http://www.khronos.org/opengles/sdk/docs/man3/html/glStencilMaskSeparate.xhtml
   619  	StencilMaskSeparate(face Enum, mask uint32)
   620  
   621  	// StencilOp sets front and back stencil test actions.
   622  	//
   623  	// http://www.khronos.org/opengles/sdk/docs/man3/html/glStencilOp.xhtml
   624  	StencilOp(fail, zfail, zpass Enum)
   625  
   626  	// StencilOpSeparate sets front or back stencil tests.
   627  	//
   628  	// http://www.khronos.org/opengles/sdk/docs/man3/html/glStencilOpSeparate.xhtml
   629  	StencilOpSeparate(face, sfail, dpfail, dppass Enum)
   630  
   631  	// TexImage2D writes a 2D texture image.
   632  	//
   633  	// http://www.khronos.org/opengles/sdk/docs/man3/html/glTexImage2D.xhtml
   634  	TexImage2D(target Enum, level int, internalFormat int, width, height int, format Enum, ty Enum, data []byte)
   635  
   636  	// TexSubImage2D writes a subregion of a 2D texture image.
   637  	//
   638  	// http://www.khronos.org/opengles/sdk/docs/man3/html/glTexSubImage2D.xhtml
   639  	TexSubImage2D(target Enum, level int, x, y, width, height int, format, ty Enum, data []byte)
   640  
   641  	// TexParameterf sets a float texture parameter.
   642  	//
   643  	// http://www.khronos.org/opengles/sdk/docs/man3/html/glTexParameter.xhtml
   644  	TexParameterf(target, pname Enum, param float32)
   645  
   646  	// TexParameterfv sets a float texture parameter array.
   647  	//
   648  	// http://www.khronos.org/opengles/sdk/docs/man3/html/glTexParameter.xhtml
   649  	TexParameterfv(target, pname Enum, params []float32)
   650  
   651  	// TexParameteri sets an integer texture parameter.
   652  	//
   653  	// http://www.khronos.org/opengles/sdk/docs/man3/html/glTexParameter.xhtml
   654  	TexParameteri(target, pname Enum, param int)
   655  
   656  	// TexParameteriv sets an integer texture parameter array.
   657  	//
   658  	// http://www.khronos.org/opengles/sdk/docs/man3/html/glTexParameter.xhtml
   659  	TexParameteriv(target, pname Enum, params []int32)
   660  
   661  	// Uniform1f writes a float uniform variable.
   662  	//
   663  	// http://www.khronos.org/opengles/sdk/docs/man3/html/glUniform.xhtml
   664  	Uniform1f(dst Uniform, v float32)
   665  
   666  	// Uniform1fv writes a [len(src)]float uniform array.
   667  	//
   668  	// http://www.khronos.org/opengles/sdk/docs/man3/html/glUniform.xhtml
   669  	Uniform1fv(dst Uniform, src []float32)
   670  
   671  	Uniform1fvP(dst Uniform, count int32, value *float32)
   672  
   673  	Uniform1fvUP(dst Uniform, count int32, value unsafe.Pointer)
   674  
   675  	// Uniform1i writes an int uniform variable.
   676  	//
   677  	// Uniform1i and Uniform1iv are the only two functions that may be used
   678  	// to load uniform variables defined as sampler types. Loading samplers
   679  	// with any other function will result in a INVALID_OPERATION error.
   680  	//
   681  	// http://www.khronos.org/opengles/sdk/docs/man3/html/glUniform.xhtml
   682  	Uniform1i(dst Uniform, v int)
   683  
   684  	// Uniform1iv writes a int uniform array of len(src) elements.
   685  	//
   686  	// Uniform1i and Uniform1iv are the only two functions that may be used
   687  	// to load uniform variables defined as sampler types. Loading samplers
   688  	// with any other function will result in a INVALID_OPERATION error.
   689  	//
   690  	// http://www.khronos.org/opengles/sdk/docs/man3/html/glUniform.xhtml
   691  	Uniform1iv(dst Uniform, src []int32)
   692  
   693  	Uniform1ivP(dst Uniform, count int32, value *int32)
   694  
   695  	Uniform1ivUP(dst Uniform, count int32, value unsafe.Pointer)
   696  
   697  	// Uniform2f writes a vec2 uniform variable.
   698  	//
   699  	// http://www.khronos.org/opengles/sdk/docs/man3/html/glUniform.xhtml
   700  	Uniform2f(dst Uniform, v0, v1 float32)
   701  
   702  	// Uniform2fv writes a vec2 uniform array of len(src)/2 elements.
   703  	//
   704  	// http://www.khronos.org/opengles/sdk/docs/man3/html/glUniform.xhtml
   705  	Uniform2fv(dst Uniform, src []float32)
   706  
   707  	Uniform2fvP(dst Uniform, count int32, value *float32)
   708  
   709  	Uniform2fvUP(dst Uniform, count int32, value unsafe.Pointer)
   710  
   711  	// Uniform2i writes an ivec2 uniform variable.
   712  	//
   713  	// http://www.khronos.org/opengles/sdk/docs/man3/html/glUniform.xhtml
   714  	Uniform2i(dst Uniform, v0, v1 int)
   715  
   716  	// Uniform2iv writes an ivec2 uniform array of len(src)/2 elements.
   717  	//
   718  	// http://www.khronos.org/opengles/sdk/docs/man3/html/glUniform.xhtml
   719  	Uniform2iv(dst Uniform, src []int32)
   720  
   721  	Uniform2ivP(dst Uniform, count int32, value *int32)
   722  
   723  	Uniform2ivUP(dst Uniform, count int32, value unsafe.Pointer)
   724  
   725  	// Uniform3f writes a vec3 uniform variable.
   726  	//
   727  	// http://www.khronos.org/opengles/sdk/docs/man3/html/glUniform.xhtml
   728  	Uniform3f(dst Uniform, v0, v1, v2 float32)
   729  
   730  	// Uniform3fv writes a vec3 uniform array of len(src)/3 elements.
   731  	//
   732  	// http://www.khronos.org/opengles/sdk/docs/man3/html/glUniform.xhtml
   733  	Uniform3fv(dst Uniform, src []float32)
   734  
   735  	Uniform3fvP(dst Uniform, count int32, value *float32)
   736  
   737  	Uniform3fvUP(dst Uniform, count int32, value unsafe.Pointer)
   738  
   739  	// Uniform3i writes an ivec3 uniform variable.
   740  	//
   741  	// http://www.khronos.org/opengles/sdk/docs/man3/html/glUniform.xhtml
   742  	Uniform3i(dst Uniform, v0, v1, v2 int32)
   743  
   744  	// Uniform3iv writes an ivec3 uniform array of len(src)/3 elements.
   745  	//
   746  	// http://www.khronos.org/opengles/sdk/docs/man3/html/glUniform.xhtml
   747  	Uniform3iv(dst Uniform, src []int32)
   748  
   749  	Uniform3ivP(dst Uniform, count int32, value *int32)
   750  
   751  	Uniform3ivUP(dst Uniform, count int32, value unsafe.Pointer)
   752  
   753  	// Uniform4f writes a vec4 uniform variable.
   754  	//
   755  	// http://www.khronos.org/opengles/sdk/docs/man3/html/glUniform.xhtml
   756  	Uniform4f(dst Uniform, v0, v1, v2, v3 float32)
   757  
   758  	// Uniform4fv writes a vec4 uniform array of len(src)/4 elements.
   759  	//
   760  	// http://www.khronos.org/opengles/sdk/docs/man3/html/glUniform.xhtml
   761  	Uniform4fv(dst Uniform, src []float32)
   762  
   763  	Uniform4fvP(dst Uniform, count int32, value *float32)
   764  
   765  	Uniform4fvUP(dst Uniform, count int32, value unsafe.Pointer)
   766  
   767  	// Uniform4i writes an ivec4 uniform variable.
   768  	//
   769  	// http://www.khronos.org/opengles/sdk/docs/man3/html/glUniform.xhtml
   770  	Uniform4i(dst Uniform, v0, v1, v2, v3 int32)
   771  
   772  	// Uniform4i writes an ivec4 uniform array of len(src)/4 elements.
   773  	//
   774  	// http://www.khronos.org/opengles/sdk/docs/man3/html/glUniform.xhtml
   775  	Uniform4iv(dst Uniform, src []int32)
   776  
   777  	Uniform4ivP(dst Uniform, count int32, value *int32)
   778  
   779  	Uniform4ivUP(dst Uniform, count int32, value unsafe.Pointer)
   780  
   781  	// UniformMatrix2fv writes 2x2 matrices. Each matrix uses four
   782  	// float32 values, so the number of matrices written is len(src)/4.
   783  	//
   784  	// Each matrix must be supplied in column major order.
   785  	//
   786  	// http://www.khronos.org/opengles/sdk/docs/man3/html/glUniform.xhtml
   787  	UniformMatrix2fv(dst Uniform, src []float32)
   788  
   789  	UniformMatrix2fvP(dst Uniform, count int32, value *float32)
   790  
   791  	UniformMatrix2fvUP(dst Uniform, count int32, value unsafe.Pointer)
   792  
   793  	// UniformMatrix3fv writes 3x3 matrices. Each matrix uses nine
   794  	// float32 values, so the number of matrices written is len(src)/9.
   795  	//
   796  	// Each matrix must be supplied in column major order.
   797  	//
   798  	// http://www.khronos.org/opengles/sdk/docs/man3/html/glUniform.xhtml
   799  	UniformMatrix3fv(dst Uniform, src []float32)
   800  
   801  	UniformMatrix3fvP(dst Uniform, count int32, value *float32)
   802  
   803  	UniformMatrix3fvUP(dst Uniform, count int32, value unsafe.Pointer)
   804  
   805  	// UniformMatrix4fv writes 4x4 matrices. Each matrix uses 16
   806  	// float32 values, so the number of matrices written is len(src)/16.
   807  	//
   808  	// Each matrix must be supplied in column major order.
   809  	//
   810  	// http://www.khronos.org/opengles/sdk/docs/man3/html/glUniform.xhtml
   811  	UniformMatrix4fv(dst Uniform, src []float32)
   812  
   813  	UniformMatrix4fvP(dst Uniform, count int32, value *float32)
   814  
   815  	UniformMatrix4fvUP(dst Uniform, count int32, value unsafe.Pointer)
   816  
   817  	// UseProgram sets the active program.
   818  	//
   819  	// http://www.khronos.org/opengles/sdk/docs/man3/html/glUseProgram.xhtml
   820  	UseProgram(p Program)
   821  
   822  	// ValidateProgram checks to see whether the executables contained in
   823  	// program can execute given the current OpenGL state.
   824  	//
   825  	// Typically only used for debugging.
   826  	//
   827  	// http://www.khronos.org/opengles/sdk/docs/man3/html/glValidateProgram.xhtml
   828  	ValidateProgram(p Program)
   829  
   830  	// VertexAttrib1f writes a float vertex attribute.
   831  	//
   832  	// http://www.khronos.org/opengles/sdk/docs/man3/html/glVertexAttrib.xhtml
   833  	VertexAttrib1f(dst Attrib, x float32)
   834  
   835  	// VertexAttrib1fv writes a float vertex attribute.
   836  	//
   837  	// http://www.khronos.org/opengles/sdk/docs/man3/html/glVertexAttrib.xhtml
   838  	VertexAttrib1fv(dst Attrib, src []float32)
   839  
   840  	// VertexAttrib2f writes a vec2 vertex attribute.
   841  	//
   842  	// http://www.khronos.org/opengles/sdk/docs/man3/html/glVertexAttrib.xhtml
   843  	VertexAttrib2f(dst Attrib, x, y float32)
   844  
   845  	// VertexAttrib2fv writes a vec2 vertex attribute.
   846  	//
   847  	// http://www.khronos.org/opengles/sdk/docs/man3/html/glVertexAttrib.xhtml
   848  	VertexAttrib2fv(dst Attrib, src []float32)
   849  
   850  	// VertexAttrib3f writes a vec3 vertex attribute.
   851  	//
   852  	// http://www.khronos.org/opengles/sdk/docs/man3/html/glVertexAttrib.xhtml
   853  	VertexAttrib3f(dst Attrib, x, y, z float32)
   854  
   855  	// VertexAttrib3fv writes a vec3 vertex attribute.
   856  	//
   857  	// http://www.khronos.org/opengles/sdk/docs/man3/html/glVertexAttrib.xhtml
   858  	VertexAttrib3fv(dst Attrib, src []float32)
   859  
   860  	// VertexAttrib4f writes a vec4 vertex attribute.
   861  	//
   862  	// http://www.khronos.org/opengles/sdk/docs/man3/html/glVertexAttrib.xhtml
   863  	VertexAttrib4f(dst Attrib, x, y, z, w float32)
   864  
   865  	// VertexAttrib4fv writes a vec4 vertex attribute.
   866  	//
   867  	// http://www.khronos.org/opengles/sdk/docs/man3/html/glVertexAttrib.xhtml
   868  	VertexAttrib4fv(dst Attrib, src []float32)
   869  
   870  	// VertexAttribPointer uses a bound buffer to define vertex attribute data.
   871  	//
   872  	// Direct use of VertexAttribPointer to load data into OpenGL is not
   873  	// supported via the Go bindings. Instead, use BindBuffer with an
   874  	// ARRAY_BUFFER and then fill it using BufferData.
   875  	//
   876  	// The size argument specifies the number of components per attribute,
   877  	// between 1-4. The stride argument specifies the byte offset between
   878  	// consecutive vertex attributes.
   879  	//
   880  	// http://www.khronos.org/opengles/sdk/docs/man3/html/glVertexAttribPointer.xhtml
   881  	VertexAttribPointer(dst Attrib, size int, ty Enum, normalized bool, stride, offset int)
   882  
   883  	// Viewport sets the viewport, an affine transformation that
   884  	// normalizes device coordinates to window coordinates.
   885  	//
   886  	// http://www.khronos.org/opengles/sdk/docs/man3/html/glViewport.xhtml
   887  	Viewport(x, y, width, height int)
   888  }
   889  
   890  // Context3 is an OpenGL ES 3 context.
   891  //
   892  // When the gl package is compiled with GL ES 3 support, the produced
   893  // Context object also implements the Context3 interface.
   894  type Context3 interface {
   895  	Context
   896  
   897  	// BlitFramebuffer copies a block of pixels between framebuffers.
   898  	//
   899  	// https://www.khronos.org/opengles/sdk/docs/man3/html/glBlitFramebuffer.xhtml
   900  	BlitFramebuffer(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1 int, mask uint, filter Enum)
   901  }
   902  
   903  // Worker is used by display driver code to execute OpenGL calls.
   904  //
   905  // Typically display driver code creates a gl.Context for an application,
   906  // and along with it establishes a locked OS thread to execute the cgo
   907  // calls:
   908  //
   909  //	go func() {
   910  //		runtime.LockOSThread()
   911  //		// ... platform-specific cgo call to bind a C OpenGL context
   912  //		// into thread-local storage.
   913  //
   914  //		glctx, worker := gl.NewContext()
   915  //		workAvailable := worker.WorkAvailable()
   916  //		go userAppCode(glctx)
   917  //		for {
   918  //			select {
   919  //			case <-workAvailable:
   920  //				worker.DoWork()
   921  //			case <-drawEvent:
   922  //				// ... platform-specific cgo call to draw screen
   923  //			}
   924  //		}
   925  //	}()
   926  //
   927  // This interface is an internal implementation detail and should only be used
   928  // by the package responsible for managing the screen, such as
   929  // github.com/thommil/tge-mobile/app.
   930  type Worker interface {
   931  	// WorkAvailable returns a channel that communicates when DoWork should be
   932  	// called.
   933  	WorkAvailable() <-chan struct{}
   934  
   935  	// DoWork performs any pending OpenGL calls.
   936  	DoWork()
   937  }