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