github.com/thommil/tge-gl@v0.0.0-20190313100017-83d8f10f8fae/gl_mobile.go (about) 1 // Copyright (c) 2019 Thomas MILLET. All rights reserved. 2 // Copyright 2014 The Go Authors. All rights reserved. 3 4 // +build android ios 5 6 package gl 7 8 import ( 9 fmt "fmt" 10 unsafe "unsafe" 11 12 tge "github.com/thommil/tge" 13 gl "github.com/thommil/tge-mobile/gl" 14 ) 15 16 type plugin struct { 17 glContext gl.Context 18 } 19 20 func (p *plugin) Init(runtime tge.Runtime) error { 21 renderer := runtime.GetRenderer() 22 switch renderer.(type) { 23 case gl.Context: 24 p.glContext = renderer.(gl.Context) 25 default: 26 return fmt.Errorf("Runtime renderer must be a github.com/thommil/tge-mobile/gl.Context") 27 } 28 return nil 29 } 30 31 func (p *plugin) Dispose() { 32 p.glContext = nil 33 FlushCache() 34 } 35 36 // GetGLSLVersion gives the glsl version ti put in #version ${VERSION} 37 func GetGLSLVersion() string { 38 return "300 es" 39 } 40 41 // FlushCache free memory cache, should be called between scenes 42 func FlushCache() { 43 byteArrayBuffer = make([]byte, 0) 44 byteArrayBufferExtendFactor = 1 45 } 46 47 // ActiveTexture sets the active texture unit. 48 // 49 // http://www.khronos.org/opengles/sdk/docs/man3/html/glActiveTexture.xhtml 50 func ActiveTexture(texture Enum) { 51 _pluginInstance.glContext.ActiveTexture(gl.Enum(texture)) 52 53 } 54 55 // AttachShader attaches a shader to a program. 56 // 57 // http://www.khronos.org/opengles/sdk/docs/man3/html/glAttachShader.xhtml 58 func AttachShader(p Program, s Shader) { 59 _pluginInstance.glContext.AttachShader(gl.Program{Init: true, Value: uint32(p)}, gl.Shader{uint32(s)}) 60 } 61 62 // BindAttribLocation binds a vertex attribute index with a named 63 // variable. 64 // 65 // http://www.khronos.org/opengles/sdk/docs/man3/html/glBindAttribLocation.xhtml 66 func BindAttribLocation(p Program, a Attrib, name string) { 67 _pluginInstance.glContext.BindAttribLocation(gl.Program{Init: true, Value: uint32(p)}, gl.Attrib{uint(a)}, name+"\x00") 68 } 69 70 // BindBuffer binds a buffer. 71 // 72 // http://www.khronos.org/opengles/sdk/docs/man3/html/glBindBuffer.xhtml 73 func BindBuffer(target Enum, b Buffer) { 74 _pluginInstance.glContext.BindBuffer(gl.Enum(target), gl.Buffer{uint32(b)}) 75 } 76 77 // BindFramebuffer binds a framebuffer. 78 // 79 // http://www.khronos.org/opengles/sdk/docs/man3/html/glBindFramebuffer.xhtml 80 func BindFramebuffer(target Enum, fb Framebuffer) { 81 _pluginInstance.glContext.BindFramebuffer(gl.Enum(target), gl.Framebuffer{uint32(fb)}) 82 } 83 84 // BindRenderbuffer binds a render buffer. 85 // 86 // http://www.khronos.org/opengles/sdk/docs/man3/html/glBindRenderbuffer.xhtml 87 func BindRenderbuffer(target Enum, rb Renderbuffer) { 88 _pluginInstance.glContext.BindRenderbuffer(gl.Enum(target), gl.Renderbuffer{uint32(rb)}) 89 } 90 91 // BindTexture binds a texture. 92 // 93 // http://www.khronos.org/opengles/sdk/docs/man3/html/glBindTexture.xhtml 94 func BindTexture(target Enum, t Texture) { 95 _pluginInstance.glContext.BindTexture(gl.Enum(target), gl.Texture{uint32(t)}) 96 } 97 98 // BindVertexArray binds a vertex array. 99 // 100 // http://www.khronos.org/opengles/sdk/docs/man3/html/glBindVertexArray.xhtml 101 func BindVertexArray(rb VertexArray) { 102 _pluginInstance.glContext.BindVertexArray(gl.VertexArray{uint32(rb)}) 103 } 104 105 // BlendColor sets the blend color. 106 // 107 // http://www.khronos.org/opengles/sdk/docs/man3/html/glBlendColor.xhtml 108 func BlendColor(red, green, blue, alpha float32) { 109 _pluginInstance.glContext.BlendColor(red, green, blue, alpha) 110 } 111 112 // BlendEquation sets both RGB and alpha blend equations. 113 // 114 // http://www.khronos.org/opengles/sdk/docs/man3/html/glBlendEquation.xhtml 115 func BlendEquation(mode Enum) { 116 _pluginInstance.glContext.BlendEquation(gl.Enum(mode)) 117 } 118 119 // BlendEquationSeparate sets RGB and alpha blend equations separately. 120 // 121 // http://www.khronos.org/opengles/sdk/docs/man3/html/glBlendEquationSeparate.xhtml 122 func BlendEquationSeparate(modeRGB, modeAlpha Enum) { 123 _pluginInstance.glContext.BlendEquationSeparate(gl.Enum(modeRGB), gl.Enum(modeAlpha)) 124 } 125 126 // BlendFunc sets the pixel blending factors. 127 // 128 // http://www.khronos.org/opengles/sdk/docs/man3/html/glBlendFunc.xhtml 129 func BlendFunc(sfactor, dfactor Enum) { 130 _pluginInstance.glContext.BlendFunc(gl.Enum(sfactor), gl.Enum(dfactor)) 131 } 132 133 // BlendFunc sets the pixel RGB and alpha blending factors separately. 134 // 135 // http://www.khronos.org/opengles/sdk/docs/man3/html/glBlendFuncSeparate.xhtml 136 func BlendFuncSeparate(sfactorRGB, dfactorRGB, sfactorAlpha, dfactorAlpha Enum) { 137 _pluginInstance.glContext.BlendFuncSeparate(gl.Enum(sfactorRGB), gl.Enum(dfactorRGB), gl.Enum(sfactorAlpha), gl.Enum(dfactorAlpha)) 138 } 139 140 // BufferData creates a new data store for the bound buffer object. 141 // 142 // http://www.khronos.org/opengles/sdk/docs/man3/html/glBufferData.xhtml 143 func BufferData(target Enum, src []byte, usage Enum) { 144 _pluginInstance.glContext.BufferData(gl.Enum(target), src, gl.Enum(usage)) 145 } 146 147 // BufferInit creates a new unitialized data store for the bound buffer object. 148 // 149 // http://www.khronos.org/opengles/sdk/docs/man3/html/glBufferData.xhtml 150 func BufferInit(target Enum, size int, usage Enum) { 151 _pluginInstance.glContext.BufferInit(gl.Enum(target), size, gl.Enum(usage)) 152 } 153 154 // BufferSubData sets some of data in the bound buffer object. 155 // 156 // http://www.khronos.org/opengles/sdk/docs/man3/html/glBufferSubData.xhtml 157 func BufferSubData(target Enum, offset int, data []byte) { 158 _pluginInstance.glContext.BufferSubData(gl.Enum(target), offset, data) 159 } 160 161 // CheckFramebufferStatus reports the completeness status of the 162 // active framebuffer. 163 // 164 // http://www.khronos.org/opengles/sdk/docs/man3/html/glCheckFramebufferStatus.xhtml 165 func CheckFramebufferStatus(target Enum) Enum { 166 return Enum(_pluginInstance.glContext.CheckFramebufferStatus(gl.Enum(target))) 167 } 168 169 // Clear clears the window. 170 // 171 // The behavior of Clear is influenced by the pixel ownership test, 172 // the scissor test, dithering, and the buffer writemasks. 173 // 174 // http://www.khronos.org/opengles/sdk/docs/man3/html/glClear.xhtml 175 func Clear(mask Enum) { 176 _pluginInstance.glContext.Clear(gl.Enum(mask)) 177 } 178 179 // ClearColor specifies the RGBA values used to clear color buffers. 180 // 181 // http://www.khronos.org/opengles/sdk/docs/man3/html/glClearColor.xhtml 182 func ClearColor(red, green, blue, alpha float32) { 183 _pluginInstance.glContext.ClearColor(red, green, blue, alpha) 184 } 185 186 // ClearDepthf sets the depth value used to clear the depth buffer. 187 // 188 // http://www.khronos.org/opengles/sdk/docs/man3/html/glClearDepthf.xhtml 189 func ClearDepthf(d float32) { 190 _pluginInstance.glContext.ClearDepthf(d) 191 } 192 193 // ClearStencil sets the index used to clear the stencil buffer. 194 // 195 // http://www.khronos.org/opengles/sdk/docs/man3/html/glClearStencil.xhtml 196 func ClearStencil(s int) { 197 _pluginInstance.glContext.ClearStencil(s) 198 } 199 200 // ColorMask specifies whether color components in the framebuffer 201 // can be written. 202 // 203 // http://www.khronos.org/opengles/sdk/docs/man3/html/glColorMask.xhtml 204 func ColorMask(red, green, blue, alpha bool) { 205 _pluginInstance.glContext.ColorMask(red, green, blue, alpha) 206 } 207 208 // CompileShader compiles the source code of s. 209 // 210 // http://www.khronos.org/opengles/sdk/docs/man3/html/glCompileShader.xhtml 211 func CompileShader(s Shader) { 212 _pluginInstance.glContext.CompileShader(gl.Shader{uint32(s)}) 213 } 214 215 // CompressedTexImage2D writes a compressed 2D texture. 216 // 217 // http://www.khronos.org/opengles/sdk/docs/man3/html/glCompressedTexImage2D.xhtml 218 func CompressedTexImage2D(target Enum, level int, internalformat Enum, width, height, border int, data []byte) { 219 _pluginInstance.glContext.CompressedTexImage2D(gl.Enum(target), level, gl.Enum(internalformat), width, height, border, data) 220 } 221 222 // CompressedTexSubImage2D writes a subregion of a compressed 2D texture. 223 // 224 // http://www.khronos.org/opengles/sdk/docs/man3/html/glCompressedTexSubImage2D.xhtml 225 func CompressedTexSubImage2D(target Enum, level, xoffset, yoffset, width, height int, format Enum, data []byte) { 226 _pluginInstance.glContext.CompressedTexSubImage2D(gl.Enum(target), level, xoffset, yoffset, width, height, gl.Enum(format), data) 227 } 228 229 // CopyTexImage2D writes a 2D texture from the current framebuffer. 230 // 231 // http://www.khronos.org/opengles/sdk/docs/man3/html/glCopyTexImage2D.xhtml 232 func CopyTexImage2D(target Enum, level int, internalformat Enum, x, y, width, height, border int) { 233 _pluginInstance.glContext.CopyTexImage2D(gl.Enum(target), level, gl.Enum(internalformat), x, y, width, height, border) 234 } 235 236 // CopyTexSubImage2D writes a 2D texture subregion from the 237 // current framebuffer. 238 // 239 // http://www.khronos.org/opengles/sdk/docs/man3/html/glCopyTexSubImage2D.xhtml 240 func CopyTexSubImage2D(target Enum, level, xoffset, yoffset, x, y, width, height int) { 241 _pluginInstance.glContext.CopyTexSubImage2D(gl.Enum(target), level, xoffset, yoffset, x, y, width, height) 242 } 243 244 // CreateBuffer creates a buffer object. 245 // 246 // http://www.khronos.org/opengles/sdk/docs/man3/html/glGenBuffers.xhtml 247 func CreateBuffer() Buffer { 248 return Buffer(_pluginInstance.glContext.CreateBuffer().Value) 249 } 250 251 // CreateFramebuffer creates a framebuffer object. 252 // 253 // http://www.khronos.org/opengles/sdk/docs/man3/html/glGenFramebuffers.xhtml 254 func CreateFramebuffer() Framebuffer { 255 return Framebuffer(_pluginInstance.glContext.CreateFramebuffer().Value) 256 } 257 258 // CreateProgram creates a new empty program object. 259 // 260 // http://www.khronos.org/opengles/sdk/docs/man3/html/glCreateProgram.xhtml 261 func CreateProgram() Program { 262 return Program(_pluginInstance.glContext.CreateProgram().Value) 263 } 264 265 // CreateRenderbuffer create a renderbuffer object. 266 // 267 // http://www.khronos.org/opengles/sdk/docs/man3/html/glGenRenderbuffers.xhtml 268 func CreateRenderbuffer() Renderbuffer { 269 return Renderbuffer(_pluginInstance.glContext.CreateRenderbuffer().Value) 270 } 271 272 // CreateShader creates a new empty shader object. 273 // 274 // http://www.khronos.org/opengles/sdk/docs/man3/html/glCreateShader.xhtml 275 func CreateShader(ty Enum) Shader { 276 return Shader(_pluginInstance.glContext.CreateShader(gl.Enum(ty)).Value) 277 } 278 279 // CreateTexture creates a texture object. 280 // 281 // http://www.khronos.org/opengles/sdk/docs/man3/html/glGenTextures.xhtml 282 func CreateTexture() Texture { 283 return Texture(_pluginInstance.glContext.CreateTexture().Value) 284 } 285 286 // CreateTVertexArray creates a vertex array. 287 // 288 // http://www.khronos.org/opengles/sdk/docs/man3/html/glGenVertexArrays.xhtml 289 func CreateVertexArray() VertexArray { 290 return VertexArray(_pluginInstance.glContext.CreateVertexArray().Value) 291 } 292 293 // CullFace specifies which polygons are candidates for culling. 294 // 295 // Valid modes: FRONT, BACK, FRONT_AND_BACK. 296 // 297 // http://www.khronos.org/opengles/sdk/docs/man3/html/glCullFace.xhtml 298 func CullFace(mode Enum) { 299 _pluginInstance.glContext.CullFace(gl.Enum(mode)) 300 } 301 302 // DeleteBuffer deletes the given buffer object. 303 // 304 // http://www.khronos.org/opengles/sdk/docs/man3/html/glDeleteBuffers.xhtml 305 func DeleteBuffer(v Buffer) { 306 _pluginInstance.glContext.DeleteBuffer(gl.Buffer{uint32(v)}) 307 } 308 309 // DeleteFramebuffer deletes the given framebuffer object. 310 // 311 // http://www.khronos.org/opengles/sdk/docs/man3/html/glDeleteFramebuffers.xhtml 312 func DeleteFramebuffer(v Framebuffer) { 313 _pluginInstance.glContext.DeleteFramebuffer(gl.Framebuffer{uint32(v)}) 314 } 315 316 // DeleteProgram deletes the given program object. 317 // 318 // http://www.khronos.org/opengles/sdk/docs/man3/html/glDeleteProgram.xhtml 319 func DeleteProgram(p Program) { 320 _pluginInstance.glContext.DeleteProgram(gl.Program{Init: true, Value: uint32(p)}) 321 } 322 323 // DeleteRenderbuffer deletes the given render buffer object. 324 // 325 // http://www.khronos.org/opengles/sdk/docs/man3/html/glDeleteRenderbuffers.xhtml 326 func DeleteRenderbuffer(v Renderbuffer) { 327 _pluginInstance.glContext.DeleteRenderbuffer(gl.Renderbuffer{uint32(v)}) 328 } 329 330 // DeleteShader deletes shader s. 331 // 332 // http://www.khronos.org/opengles/sdk/docs/man3/html/glDeleteShader.xhtml 333 func DeleteShader(s Shader) { 334 _pluginInstance.glContext.DeleteShader(gl.Shader{uint32(s)}) 335 } 336 337 // DeleteTexture deletes the given texture object. 338 // 339 // http://www.khronos.org/opengles/sdk/docs/man3/html/glDeleteTextures.xhtml 340 func DeleteTexture(v Texture) { 341 _pluginInstance.glContext.DeleteTexture(gl.Texture{uint32(v)}) 342 } 343 344 // DeleteVertexArray deletes the given render buffer object. 345 // 346 // http://www.khronos.org/opengles/sdk/docs/man3/html/glDeleteVertexArrays.xhtml 347 func DeleteVertexArray(v VertexArray) { 348 _pluginInstance.glContext.DeleteVertexArray(gl.VertexArray{uint32(v)}) 349 } 350 351 // DepthFunc sets the function used for depth buffer comparisons. 352 // 353 // Valid fn values: 354 // NEVER 355 // LESS 356 // EQUAL 357 // LEQUAL 358 // GREATER 359 // NOTEQUAL 360 // GEQUAL 361 // ALWAYS 362 // 363 // http://www.khronos.org/opengles/sdk/docs/man3/html/glDepthFunc.xhtml 364 func DepthFunc(fn Enum) { 365 _pluginInstance.glContext.DepthFunc(gl.Enum(fn)) 366 } 367 368 // DepthMask sets the depth buffer enabled for writing. 369 // 370 // http://www.khronos.org/opengles/sdk/docs/man3/html/glDepthMask.xhtml 371 func DepthMask(flag bool) { 372 _pluginInstance.glContext.DepthMask(flag) 373 } 374 375 // DepthRangef sets the mapping from normalized device coordinates to 376 // window coordinates. 377 // 378 // http://www.khronos.org/opengles/sdk/docs/man3/html/glDepthRangef.xhtml 379 func DepthRangef(n, f float32) { 380 _pluginInstance.glContext.DepthRangef(n, f) 381 } 382 383 // DetachShader detaches the shader s from the program p. 384 // 385 // http://www.khronos.org/opengles/sdk/docs/man3/html/glDetachShader.xhtml 386 func DetachShader(p Program, s Shader) { 387 _pluginInstance.glContext.DetachShader(gl.Program{Init: true, Value: uint32(p)}, gl.Shader{uint32(s)}) 388 } 389 390 // Disable disables various GL capabilities. 391 // 392 // http://www.khronos.org/opengles/sdk/docs/man3/html/glDisable.xhtml 393 func Disable(cap Enum) { 394 _pluginInstance.glContext.Disable(gl.Enum(cap)) 395 } 396 397 // DisableVertexAttribArray disables a vertex attribute array. 398 // 399 // http://www.khronos.org/opengles/sdk/docs/man3/html/glDisableVertexAttribArray.xhtml 400 func DisableVertexAttribArray(a Attrib) { 401 _pluginInstance.glContext.DisableVertexAttribArray(gl.Attrib{uint(a)}) 402 } 403 404 // DrawArrays renders geometric primitives from the bound data. 405 // 406 // http://www.khronos.org/opengles/sdk/docs/man3/html/glDrawArrays.xhtml 407 func DrawArrays(mode Enum, first, count int) { 408 _pluginInstance.glContext.DrawArrays(gl.Enum(mode), first, count) 409 } 410 411 // DrawElements renders primitives from a bound buffer. 412 // 413 // http://www.khronos.org/opengles/sdk/docs/man3/html/glDrawElements.xhtml 414 func DrawElements(mode Enum, count int, ty Enum, offset int) { 415 _pluginInstance.glContext.DrawElements(gl.Enum(mode), count, gl.Enum(ty), offset) 416 } 417 418 // Enable enables various GL capabilities. 419 // 420 // http://www.khronos.org/opengles/sdk/docs/man3/html/glEnable.xhtml 421 func Enable(cap Enum) { 422 _pluginInstance.glContext.Enable(gl.Enum(cap)) 423 } 424 425 // EnableVertexAttribArray enables a vertex attribute array. 426 // 427 // http://www.khronos.org/opengles/sdk/docs/man3/html/glEnableVertexAttribArray.xhtml 428 func EnableVertexAttribArray(a Attrib) { 429 _pluginInstance.glContext.EnableVertexAttribArray(gl.Attrib{uint(a)}) 430 } 431 432 // Finish blocks until the effects of all previously called GL 433 // commands are complete. 434 // 435 // http://www.khronos.org/opengles/sdk/docs/man3/html/glFinish.xhtml 436 func Finish() { 437 _pluginInstance.glContext.Finish() 438 } 439 440 // Flush empties all buffers. It does not block. 441 // 442 // An OpenGL implementation may buffer network communication, 443 // the command stream, or data inside the graphics accelerator. 444 // 445 // http://www.khronos.org/opengles/sdk/docs/man3/html/glFlush.xhtml 446 func Flush() { 447 _pluginInstance.glContext.Flush() 448 } 449 450 // FramebufferRenderbuffer attaches rb to the current frame buffer. 451 // 452 // http://www.khronos.org/opengles/sdk/docs/man3/html/glFramebufferRenderbuffer.xhtml 453 func FramebufferRenderbuffer(target, attachment, rbTarget Enum, rb Renderbuffer) { 454 _pluginInstance.glContext.FramebufferRenderbuffer(gl.Enum(target), gl.Enum(attachment), gl.Enum(rbTarget), gl.Renderbuffer{uint32(rb)}) 455 } 456 457 // FramebufferTexture2D attaches the t to the current frame buffer. 458 // 459 // http://www.khronos.org/opengles/sdk/docs/man3/html/glFramebufferTexture2D.xhtml 460 func FramebufferTexture2D(target, attachment, texTarget Enum, t Texture, level int) { 461 _pluginInstance.glContext.FramebufferTexture2D(gl.Enum(target), gl.Enum(attachment), gl.Enum(texTarget), gl.Texture{uint32(t)}, level) 462 } 463 464 // FrontFace defines which polygons are front-facing. 465 // 466 // Valid modes: CW, CCW. 467 // 468 // http://www.khronos.org/opengles/sdk/docs/man3/html/glFrontFace.xhtml 469 func FrontFace(mode Enum) { 470 _pluginInstance.glContext.FrontFace(gl.Enum(mode)) 471 } 472 473 // GenerateMipmap generates mipmaps for the current texture. 474 // 475 // http://www.khronos.org/opengles/sdk/docs/man3/html/glGenerateMipmap.xhtml 476 func GenerateMipmap(target Enum) { 477 _pluginInstance.glContext.GenerateMipmap(gl.Enum(target)) 478 } 479 480 // GetActiveAttrib returns details about an active attribute variable. 481 // A value of 0 for index selects the first active attribute variable. 482 // Permissible values for index range from 0 to the number of active 483 // attribute variables minus 1. 484 // 485 // http://www.khronos.org/opengles/sdk/docs/man3/html/glGetActiveAttrib.xhtml 486 func GetActiveAttrib(p Program, index uint32) (name string, size int, ty Enum) { 487 n, s, t := _pluginInstance.glContext.GetActiveAttrib(gl.Program{Init: true, Value: uint32(p)}, index) 488 return n, s, Enum(t) 489 } 490 491 // GetActiveUniform returns details about an active uniform variable. 492 // A value of 0 for index selects the first active uniform variable. 493 // Permissible values for index range from 0 to the number of active 494 // uniform variables minus 1. 495 // 496 // http://www.khronos.org/opengles/sdk/docs/man3/html/glGetActiveUniform.xhtml 497 func GetActiveUniform(p Program, index uint32) (name string, size int, ty Enum) { 498 n, s, t := _pluginInstance.glContext.GetActiveUniform(gl.Program{Init: true, Value: uint32(p)}, index) 499 return n, s, Enum(t) 500 } 501 502 // GetAttachedShaders returns the shader objects attached to program p. 503 // 504 // http://www.khronos.org/opengles/sdk/docs/man3/html/glGetAttachedShaders.xhtml 505 func GetAttachedShaders(p Program) []Shader { 506 shaders := _pluginInstance.glContext.GetAttachedShaders(gl.Program{Init: true, Value: uint32(p)}) 507 s := make([]Shader, len(shaders)) 508 for i, el := range shaders { 509 s[i] = Shader(el.Value) 510 } 511 return s 512 } 513 514 // GetAttribLocation returns the location of an attribute variable. 515 // 516 // http://www.khronos.org/opengles/sdk/docs/man3/html/glGetAttribLocation.xhtml 517 func GetAttribLocation(p Program, name string) Attrib { 518 return Attrib(int32(_pluginInstance.glContext.GetAttribLocation(gl.Program{Init: true, Value: uint32(p)}, name).Value)) 519 } 520 521 // GetBooleanv returns the boolean values of parameter pname. 522 // 523 // Many boolean parameters can be queried more easily using IsEnabled. 524 // 525 // http://www.khronos.org/opengles/sdk/docs/man3/html/glGet.xhtml 526 func GetBooleanv(dst []bool, pname Enum) { 527 _pluginInstance.glContext.GetBooleanv(dst, gl.Enum(pname)) 528 } 529 530 // GetFloatv returns the float values of parameter pname. 531 // 532 // http://www.khronos.org/opengles/sdk/docs/man3/html/glGet.xhtml 533 func GetFloatv(dst []float32, pname Enum) { 534 _pluginInstance.glContext.GetFloatv(dst, gl.Enum(pname)) 535 } 536 537 // GetIntegerv returns the int values of parameter pname. 538 // 539 // Single values may be queried more easily using GetInteger. 540 // 541 // http://www.khronos.org/opengles/sdk/docs/man3/html/glGet.xhtml 542 func GetIntegerv(pname Enum, data []int32) { 543 _pluginInstance.glContext.GetIntegerv(data, gl.Enum(pname)) 544 } 545 546 // GetInteger returns the int value of parameter pname. 547 // 548 // http://www.khronos.org/opengles/sdk/docs/man3/html/glGet.xhtml 549 func GetInteger(pname Enum) int { 550 return _pluginInstance.glContext.GetInteger(gl.Enum(pname)) 551 } 552 553 // GetBufferParameteri returns a parameter for the active buffer. 554 // 555 // http://www.khronos.org/opengles/sdk/docs/man3/html/glGetBufferParameteriv.xhtml 556 func GetBufferParameteri(target, pname Enum) int { 557 return _pluginInstance.glContext.GetBufferParameteri(gl.Enum(target), gl.Enum(pname)) 558 } 559 560 // GetError returns the next error. 561 // 562 // http://www.khronos.org/opengles/sdk/docs/man3/html/glGetError.xhtml 563 func GetError() Enum { 564 return Enum(_pluginInstance.glContext.GetError()) 565 } 566 567 // GetBoundFramebuffer returns the currently bound framebuffer. 568 // Use this method instead of _pluginInstance.glContext.GetInteger(_pluginInstance.glContext.FRAMEBUFFER_BINDING) to 569 // enable support on all platforms 570 func GetBoundFramebuffer() Framebuffer { 571 b := make([]int32, 1) 572 _pluginInstance.glContext.GetIntegerv(b, gl.FRAMEBUFFER_BINDING) 573 return Framebuffer(uint32(b[0])) 574 } 575 576 // GetFramebufferAttachmentParameteri returns attachment parameters 577 // for the active framebuffer object. 578 // 579 // http://www.khronos.org/opengles/sdk/docs/man3/html/glGetFramebufferAttachmentParameteriv.xhtml 580 func GetFramebufferAttachmentParameteri(target, attachment, pname Enum) int { 581 return _pluginInstance.glContext.GetFramebufferAttachmentParameteri(gl.Enum(target), gl.Enum(attachment), gl.Enum(pname)) 582 } 583 584 // GetProgrami returns a parameter value for a program. 585 // 586 // http://www.khronos.org/opengles/sdk/docs/man3/html/glGetProgramiv.xhtml 587 func GetProgrami(p Program, pname Enum) int { 588 return _pluginInstance.glContext.GetProgrami(gl.Program{Init: true, Value: uint32(p)}, gl.Enum(pname)) 589 } 590 591 // GetProgramInfoLog returns the information log for a program. 592 // 593 // http://www.khronos.org/opengles/sdk/docs/man3/html/glGetProgramInfoLog.xhtml 594 func GetProgramInfoLog(p Program) string { 595 return _pluginInstance.glContext.GetProgramInfoLog(gl.Program{Init: true, Value: uint32(p)}) 596 } 597 598 // GetRenderbufferParameteri returns a parameter value for a render buffer. 599 // 600 // http://www.khronos.org/opengles/sdk/docs/man3/html/glGetRenderbufferParameteriv.xhtml 601 func GetRenderbufferParameteri(target, pname Enum) int { 602 return _pluginInstance.glContext.GetRenderbufferParameteri(gl.Enum(target), gl.Enum(pname)) 603 } 604 605 // GetRenderbufferParameteri returns a parameter value for a shader. 606 // 607 // http://www.khronos.org/opengles/sdk/docs/man3/html/glGetShaderiv.xhtml 608 func GetShaderi(s Shader, pname Enum) int { 609 return _pluginInstance.glContext.GetShaderi(gl.Shader{uint32(s)}, gl.Enum(pname)) 610 } 611 612 // GetShaderInfoLog returns the information log for a shader. 613 // 614 // http://www.khronos.org/opengles/sdk/docs/man3/html/glGetShaderInfoLog.xhtml 615 func GetShaderInfoLog(s Shader) string { 616 return _pluginInstance.glContext.GetShaderInfoLog(gl.Shader{uint32(s)}) 617 } 618 619 // GetShaderPrecisionFormat returns range and precision limits for 620 // shader types. 621 // 622 // http://www.khronos.org/opengles/sdk/docs/man3/html/glGetShaderPrecisionFormat.xhtml 623 func GetShaderPrecisionFormat(shadertype, precisiontype Enum) (rangeLow, rangeHigh, precision int) { 624 return _pluginInstance.glContext.GetShaderPrecisionFormat(gl.Enum(shadertype), gl.Enum(precisiontype)) 625 } 626 627 // GetShaderSource returns source code of shader s. 628 // 629 // http://www.khronos.org/opengles/sdk/docs/man3/html/glGetShaderSource.xhtml 630 func GetShaderSource(s Shader) string { 631 return _pluginInstance.glContext.GetShaderSource(gl.Shader{uint32(s)}) 632 } 633 634 // GetString reports current GL state. 635 // 636 // Valid name values: 637 // EXTENSIONS 638 // RENDERER 639 // SHADING_LANGUAGE_VERSION 640 // VENDOR 641 // VERSION 642 // 643 // http://www.khronos.org/opengles/sdk/docs/man3/html/glGetString.xhtml 644 func GetString(pname Enum) string { 645 return _pluginInstance.glContext.GetString(gl.Enum(pname)) 646 } 647 648 // GetTexParameterfv returns the float values of a texture parameter. 649 // 650 // http://www.khronos.org/opengles/sdk/docs/man3/html/glGetTexParameter.xhtml 651 func GetTexParameterfv(dst []float32, target, pname Enum) { 652 _pluginInstance.glContext.GetTexParameterfv(dst, gl.Enum(target), gl.Enum(pname)) 653 } 654 655 // GetTexParameteriv returns the int values of a texture parameter. 656 // 657 // http://www.khronos.org/opengles/sdk/docs/man3/html/glGetTexParameter.xhtml 658 func GetTexParameteriv(dst []int32, target, pname Enum) { 659 _pluginInstance.glContext.GetTexParameteriv(dst, gl.Enum(target), gl.Enum(pname)) 660 } 661 662 // GetUniformfv returns the float values of a uniform variable. 663 // 664 // http://www.khronos.org/opengles/sdk/docs/man3/html/glGetUniform.xhtml 665 func GetUniformfv(dst []float32, src Uniform, p Program) { 666 _pluginInstance.glContext.GetUniformfv(dst, gl.Uniform{int32(src)}, gl.Program{Init: true, Value: uint32(p)}) 667 } 668 669 // GetUniformiv returns the float values of a uniform variable. 670 // 671 // http://www.khronos.org/opengles/sdk/docs/man3/html/glGetUniform.xhtml 672 func GetUniformiv(dst []int32, src Uniform, p Program) { 673 _pluginInstance.glContext.GetUniformiv(dst, gl.Uniform{int32(src)}, gl.Program{Init: true, Value: uint32(p)}) 674 } 675 676 // GetUniformLocation returns the location of a uniform variable. 677 // 678 // http://www.khronos.org/opengles/sdk/docs/man3/html/glGetUniformLocation.xhtml 679 func GetUniformLocation(p Program, name string) Uniform { 680 return Uniform(_pluginInstance.glContext.GetUniformLocation(gl.Program{Init: true, Value: uint32(p)}, name).Value) 681 } 682 683 // GetVertexAttribf reads the float value of a vertex attribute. 684 // 685 // http://www.khronos.org/opengles/sdk/docs/man3/html/glGetVertexAttrib.xhtml 686 func GetVertexAttribf(src Attrib, pname Enum) float32 { 687 return _pluginInstance.glContext.GetVertexAttribf(gl.Attrib{uint(src)}, gl.Enum(pname)) 688 } 689 690 // GetVertexAttribfv reads float values of a vertex attribute. 691 // 692 // http://www.khronos.org/opengles/sdk/docs/man3/html/glGetVertexAttrib.xhtml 693 func GetVertexAttribfv(dst []float32, src Attrib, pname Enum) { 694 _pluginInstance.glContext.GetVertexAttribfv(dst, gl.Attrib{uint(src)}, gl.Enum(pname)) 695 } 696 697 // GetVertexAttribi reads the int value of a vertex attribute. 698 // 699 // http://www.khronos.org/opengles/sdk/docs/man3/html/glGetVertexAttrib.xhtml 700 func GetVertexAttribi(src Attrib, pname Enum) int32 { 701 return _pluginInstance.glContext.GetVertexAttribi(gl.Attrib{uint(src)}, gl.Enum(pname)) 702 } 703 704 // GetVertexAttribiv reads int values of a vertex attribute. 705 // 706 // http://www.khronos.org/opengles/sdk/docs/man3/html/glGetVertexAttrib.xhtml 707 func GetVertexAttribiv(dst []int32, src Attrib, pname Enum) { 708 _pluginInstance.glContext.GetVertexAttribiv(dst, gl.Attrib{uint(src)}, gl.Enum(pname)) 709 } 710 711 // Hint sets implementation-specific modes. 712 // 713 // http://www.khronos.org/opengles/sdk/docs/man3/html/glHint.xhtml 714 func Hint(target, mode Enum) { 715 _pluginInstance.glContext.Hint(gl.Enum(target), gl.Enum(mode)) 716 } 717 718 // IsBuffer reports if b is a valid buffer. 719 // 720 // http://www.khronos.org/opengles/sdk/docs/man3/html/glIsBuffer.xhtml 721 func IsBuffer(b Buffer) bool { 722 return _pluginInstance.glContext.IsBuffer(gl.Buffer{uint32(b)}) 723 } 724 725 // IsEnabled reports if cap is an enabled capability. 726 // 727 // http://www.khronos.org/opengles/sdk/docs/man3/html/glIsEnabled.xhtml 728 func IsEnabled(cap Enum) bool { 729 return _pluginInstance.glContext.IsEnabled(gl.Enum(cap)) 730 } 731 732 // IsFramebuffer reports if fb is a valid frame buffer. 733 // 734 // http://www.khronos.org/opengles/sdk/docs/man3/html/glIsFramebuffer.xhtml 735 func IsFramebuffer(fb Framebuffer) bool { 736 return _pluginInstance.glContext.IsFramebuffer(gl.Framebuffer{uint32(fb)}) 737 } 738 739 // IsProgram reports if p is a valid program object. 740 // 741 // http://www.khronos.org/opengles/sdk/docs/man3/html/glIsProgram.xhtml 742 func IsProgram(p Program) bool { 743 return _pluginInstance.glContext.IsProgram(gl.Program{Init: true, Value: uint32(p)}) 744 } 745 746 // IsRenderbuffer reports if rb is a valid render buffer. 747 // 748 // http://www.khronos.org/opengles/sdk/docs/man3/html/glIsRenderbuffer.xhtml 749 func IsRenderbuffer(rb Renderbuffer) bool { 750 return _pluginInstance.glContext.IsRenderbuffer(gl.Renderbuffer{uint32(rb)}) 751 } 752 753 // IsShader reports if s is valid shader. 754 // 755 // http://www.khronos.org/opengles/sdk/docs/man3/html/glIsShader.xhtml 756 func IsShader(s Shader) bool { 757 return _pluginInstance.glContext.IsShader(gl.Shader{uint32(s)}) 758 } 759 760 // IsTexture reports if t is a valid texture. 761 // 762 // http://www.khronos.org/opengles/sdk/docs/man3/html/glIsTexture.xhtml 763 func IsTexture(t Texture) bool { 764 return _pluginInstance.glContext.IsTexture(gl.Texture{uint32(t)}) 765 } 766 767 // LineWidth specifies the width of lines. 768 // 769 // http://www.khronos.org/opengles/sdk/docs/man3/html/glLineWidth.xhtml 770 func LineWidth(width float32) { 771 _pluginInstance.glContext.LineWidth(width) 772 } 773 774 // LinkProgram links the specified program. 775 // 776 // http://www.khronos.org/opengles/sdk/docs/man3/html/glLinkProgram.xhtml 777 func LinkProgram(p Program) { 778 _pluginInstance.glContext.LinkProgram(gl.Program{Init: true, Value: uint32(p)}) 779 } 780 781 // PixelStorei sets pixel storage parameters. 782 // 783 // http://www.khronos.org/opengles/sdk/docs/man3/html/glPixelStorei.xhtml 784 func PixelStorei(pname Enum, param int32) { 785 _pluginInstance.glContext.PixelStorei(gl.Enum(pname), param) 786 } 787 788 // PolygonOffset sets the scaling factors for depth offsets. 789 // 790 // http://www.khronos.org/opengles/sdk/docs/man3/html/glPolygonOffset.xhtml 791 func PolygonOffset(factor, units float32) { 792 _pluginInstance.glContext.PolygonOffset(factor, units) 793 } 794 795 // PolygonMode sets Polygon Mode. 796 // 797 // http://www.khronos.org/opengles/sdk/docs/man3/html/glPolygonMode.xhtml 798 func PolygonMode(face, mode Enum) { 799 fmt.Printf("WARNING: PolygonMode not implemented\n") 800 } 801 802 // ReadPixels returns pixel data from a buffer. 803 // 804 // http://www.khronos.org/opengles/sdk/docs/man3/html/glReadPixels.xhtml 805 func ReadPixels(dst []byte, x, y, width, height int, format, ty Enum) { 806 _pluginInstance.glContext.ReadPixels(dst, x, y, width, height, gl.Enum(format), gl.Enum(ty)) 807 } 808 809 // ReleaseShaderCompiler frees resources allocated by the shader compiler. 810 // 811 // http://www.khronos.org/opengles/sdk/docs/man3/html/glReleaseShaderCompiler.xhtml 812 func ReleaseShaderCompiler() { 813 _pluginInstance.glContext.ReleaseShaderCompiler() 814 } 815 816 // RenderbufferStorage establishes the data storage, format, and 817 // dimensions of a renderbuffer object's image. 818 // 819 // http://www.khronos.org/opengles/sdk/docs/man3/html/glRenderbufferStorage.xhtml 820 func RenderbufferStorage(target, internalFormat Enum, width, height int) { 821 _pluginInstance.glContext.RenderbufferStorage(gl.Enum(target), gl.Enum(internalFormat), width, height) 822 } 823 824 // SampleCoverage sets multisample coverage parameters. 825 // 826 // http://www.khronos.org/opengles/sdk/docs/man3/html/glSampleCoverage.xhtml 827 func SampleCoverage(value float32, invert bool) { 828 _pluginInstance.glContext.SampleCoverage(value, invert) 829 } 830 831 // Scissor defines the scissor box rectangle, in window coordinates. 832 // 833 // http://www.khronos.org/opengles/sdk/docs/man3/html/glScissor.xhtml 834 func Scissor(x, y, width, height int32) { 835 _pluginInstance.glContext.Scissor(x, y, width, height) 836 } 837 838 // ShaderSource sets the source code of s to the given source code. 839 // 840 // http://www.khronos.org/opengles/sdk/docs/man3/html/glShaderSource.xhtml 841 func ShaderSource(s Shader, src string) { 842 _pluginInstance.glContext.ShaderSource(gl.Shader{uint32(s)}, src) 843 } 844 845 // StencilFunc sets the front and back stencil test reference value. 846 // 847 // http://www.khronos.org/opengles/sdk/docs/man3/html/glStencilFunc.xhtml 848 func StencilFunc(fn Enum, ref int, mask uint32) { 849 _pluginInstance.glContext.StencilFunc(gl.Enum(fn), ref, mask) 850 } 851 852 // StencilFunc sets the front or back stencil test reference value. 853 // 854 // http://www.khronos.org/opengles/sdk/docs/man3/html/glStencilFuncSeparate.xhtml 855 func StencilFuncSeparate(face, fn Enum, ref int, mask uint32) { 856 _pluginInstance.glContext.StencilFuncSeparate(gl.Enum(face), gl.Enum(fn), ref, mask) 857 } 858 859 // StencilMask controls the writing of bits in the stencil planes. 860 // 861 // http://www.khronos.org/opengles/sdk/docs/man3/html/glStencilMask.xhtml 862 func StencilMask(mask uint32) { 863 _pluginInstance.glContext.StencilMask(mask) 864 } 865 866 // StencilMaskSeparate controls the writing of bits in the stencil planes. 867 // 868 // http://www.khronos.org/opengles/sdk/docs/man3/html/glStencilMaskSeparate.xhtml 869 func StencilMaskSeparate(face Enum, mask uint32) { 870 _pluginInstance.glContext.StencilMaskSeparate(gl.Enum(face), mask) 871 } 872 873 // StencilOp sets front and back stencil test actions. 874 // 875 // http://www.khronos.org/opengles/sdk/docs/man3/html/glStencilOp.xhtml 876 func StencilOp(fail, zfail, zpass Enum) { 877 _pluginInstance.glContext.StencilOp(gl.Enum(fail), gl.Enum(zfail), gl.Enum(zpass)) 878 } 879 880 // StencilOpSeparate sets front or back stencil tests. 881 // 882 // http://www.khronos.org/opengles/sdk/docs/man3/html/glStencilOpSeparate.xhtml 883 func StencilOpSeparate(face, sfail, dpfail, dppass Enum) { 884 _pluginInstance.glContext.StencilOpSeparate(gl.Enum(face), gl.Enum(sfail), gl.Enum(dpfail), gl.Enum(dppass)) 885 } 886 887 // TexImage2D writes a 2D texture image. 888 // 889 // http://www.khronos.org/opengles/sdk/docs/man3/html/glTexImage2D.xhtml 890 func TexImage2D(target Enum, level int, width, height int, format Enum, ty Enum, data []byte) { 891 _pluginInstance.glContext.TexImage2D(gl.Enum(target), level, int(format), width, height, gl.Enum(format), gl.Enum(ty), data) 892 } 893 894 // TexSubImage2D writes a subregion of a 2D texture image. 895 // 896 // http://www.khronos.org/opengles/sdk/docs/man3/html/glTexSubImage2D.xhtml 897 func TexSubImage2D(target Enum, level int, x, y, width, height int, format, ty Enum, data []byte) { 898 _pluginInstance.glContext.TexSubImage2D(gl.Enum(target), level, x, y, width, height, gl.Enum(format), gl.Enum(ty), data) 899 } 900 901 // TexParameterf sets a float texture parameter. 902 // 903 // http://www.khronos.org/opengles/sdk/docs/man3/html/glTexParameter.xhtml 904 func TexParameterf(target, pname Enum, param float32) { 905 _pluginInstance.glContext.TexParameterf(gl.Enum(target), gl.Enum(pname), param) 906 } 907 908 // TexParameterfv sets a float texture parameter array. 909 // 910 // http://www.khronos.org/opengles/sdk/docs/man3/html/glTexParameter.xhtml 911 func TexParameterfv(target, pname Enum, params []float32) { 912 _pluginInstance.glContext.TexParameterfv(gl.Enum(target), gl.Enum(pname), params) 913 } 914 915 // TexParameteri sets an integer texture parameter. 916 // 917 // http://www.khronos.org/opengles/sdk/docs/man3/html/glTexParameter.xhtml 918 func TexParameteri(target, pname Enum, param int) { 919 _pluginInstance.glContext.TexParameteri(gl.Enum(target), gl.Enum(pname), param) 920 } 921 922 // TexParameteriv sets an integer texture parameter array. 923 // 924 // http://www.khronos.org/opengles/sdk/docs/man3/html/glTexParameter.xhtml 925 func TexParameteriv(target, pname Enum, params []int32) { 926 _pluginInstance.glContext.TexParameteriv(gl.Enum(target), gl.Enum(pname), params) 927 } 928 929 // Uniform1f writes a float uniform variable. 930 // 931 // http://www.khronos.org/opengles/sdk/docs/man3/html/glUniform.xhtml 932 func Uniform1f(dst Uniform, v float32) { 933 _pluginInstance.glContext.Uniform1f(gl.Uniform{int32(dst)}, v) 934 } 935 936 // Uniform1fv writes a [len(src)]float uniform array. 937 // 938 // http://www.khronos.org/opengles/sdk/docs/man3/html/glUniform.xhtml 939 func Uniform1fv(dst Uniform, src []float32) { 940 _pluginInstance.glContext.Uniform1fv(gl.Uniform{int32(dst)}, src) 941 } 942 943 func Uniform1fvP(dst Uniform, count int32, value *float32) { 944 fmt.Println("Uniform1fvP") 945 } 946 947 func Uniform1fvUP(dst Uniform, count int32, value unsafe.Pointer) { 948 fmt.Println("Uniform1fvUP") 949 } 950 951 // Uniform1i writes an int uniform variable. 952 // 953 // Uniform1i and Uniform1iv are the only two functions that may be used 954 // to load uniform variables defined as sampler types. Loading samplers 955 // with any other function will result in a INVALID_OPERATION error. 956 // 957 // http://www.khronos.org/opengles/sdk/docs/man3/html/glUniform.xhtml 958 func Uniform1i(dst Uniform, v int) { 959 _pluginInstance.glContext.Uniform1i(gl.Uniform{int32(dst)}, v) 960 } 961 962 // Uniform1iv writes a int uniform array of len(src) elements. 963 // 964 // Uniform1i and Uniform1iv are the only two functions that may be used 965 // to load uniform variables defined as sampler types. Loading samplers 966 // with any other function will result in a INVALID_OPERATION error. 967 // 968 // http://www.khronos.org/opengles/sdk/docs/man3/html/glUniform.xhtml 969 func Uniform1iv(dst Uniform, src []int32) { 970 _pluginInstance.glContext.Uniform1iv(gl.Uniform{int32(dst)}, src) 971 } 972 973 func Uniform1ivP(dst Uniform, count int32, value *int32) { 974 _pluginInstance.glContext.Uniform1ivP(gl.Uniform{int32(dst)}, count, value) 975 } 976 977 func Uniform1ivUP(dst Uniform, count int32, value unsafe.Pointer) { 978 _pluginInstance.glContext.Uniform1ivUP(gl.Uniform{int32(dst)}, count, value) 979 } 980 981 // Uniform2f writes a vec2 uniform variable. 982 // 983 // http://www.khronos.org/opengles/sdk/docs/man3/html/glUniform.xhtml 984 func Uniform2f(dst Uniform, v0, v1 float32) { 985 _pluginInstance.glContext.Uniform2f(gl.Uniform{int32(dst)}, v0, v1) 986 } 987 988 // Uniform2fv writes a vec2 uniform array of len(src)/2 elements. 989 // 990 // http://www.khronos.org/opengles/sdk/docs/man3/html/glUniform.xhtml 991 func Uniform2fv(dst Uniform, src []float32) { 992 _pluginInstance.glContext.Uniform2fv(gl.Uniform{int32(dst)}, src) 993 } 994 995 func Uniform2fvP(dst Uniform, count int32, value *float32) { 996 _pluginInstance.glContext.Uniform2fvP(gl.Uniform{int32(dst)}, count, value) 997 } 998 999 func Uniform2fvUP(dst Uniform, count int32, value unsafe.Pointer) { 1000 _pluginInstance.glContext.Uniform2fvUP(gl.Uniform{int32(dst)}, count, value) 1001 } 1002 1003 // Uniform2i writes an ivec2 uniform variable. 1004 // 1005 // http://www.khronos.org/opengles/sdk/docs/man3/html/glUniform.xhtml 1006 func Uniform2i(dst Uniform, v0, v1 int) { 1007 _pluginInstance.glContext.Uniform2i(gl.Uniform{int32(dst)}, v0, v1) 1008 } 1009 1010 // Uniform2iv writes an ivec2 uniform array of len(src)/2 elements. 1011 // 1012 // http://www.khronos.org/opengles/sdk/docs/man3/html/glUniform.xhtml 1013 func Uniform2iv(dst Uniform, src []int32) { 1014 _pluginInstance.glContext.Uniform2iv(gl.Uniform{int32(dst)}, src) 1015 } 1016 1017 func Uniform2ivP(dst Uniform, count int32, value *int32) { 1018 _pluginInstance.glContext.Uniform2ivP(gl.Uniform{int32(dst)}, count, value) 1019 } 1020 1021 func Uniform2ivUP(dst Uniform, count int32, value unsafe.Pointer) { 1022 _pluginInstance.glContext.Uniform2ivUP(gl.Uniform{int32(dst)}, count, value) 1023 } 1024 1025 // Uniform3f writes a vec3 uniform variable. 1026 // 1027 // http://www.khronos.org/opengles/sdk/docs/man3/html/glUniform.xhtml 1028 func Uniform3f(dst Uniform, v0, v1, v2 float32) { 1029 _pluginInstance.glContext.Uniform3f(gl.Uniform{int32(dst)}, v0, v1, v2) 1030 } 1031 1032 // Uniform3fv writes a vec3 uniform array of len(src)/3 elements. 1033 // 1034 // http://www.khronos.org/opengles/sdk/docs/man3/html/glUniform.xhtml 1035 func Uniform3fv(dst Uniform, src []float32) { 1036 _pluginInstance.glContext.Uniform3fv(gl.Uniform{int32(dst)}, src) 1037 } 1038 1039 func Uniform3fvP(dst Uniform, count int32, value *float32) { 1040 _pluginInstance.glContext.Uniform3fvP(gl.Uniform{int32(dst)}, count, value) 1041 } 1042 1043 func Uniform3fvUP(dst Uniform, count int32, value unsafe.Pointer) { 1044 _pluginInstance.glContext.Uniform3fvUP(gl.Uniform{int32(dst)}, count, value) 1045 } 1046 1047 // Uniform3i writes an ivec3 uniform variable. 1048 // 1049 // http://www.khronos.org/opengles/sdk/docs/man3/html/glUniform.xhtml 1050 func Uniform3i(dst Uniform, v0, v1, v2 int32) { 1051 _pluginInstance.glContext.Uniform3i(gl.Uniform{int32(dst)}, v0, v1, v2) 1052 } 1053 1054 // Uniform3iv writes an ivec3 uniform array of len(src)/3 elements. 1055 // 1056 // http://www.khronos.org/opengles/sdk/docs/man3/html/glUniform.xhtml 1057 func Uniform3iv(dst Uniform, src []int32) { 1058 _pluginInstance.glContext.Uniform3iv(gl.Uniform{int32(dst)}, src) 1059 } 1060 1061 func Uniform3ivP(dst Uniform, count int32, value *int32) { 1062 _pluginInstance.glContext.Uniform3ivP(gl.Uniform{int32(dst)}, count, value) 1063 } 1064 1065 func Uniform3ivUP(dst Uniform, count int32, value unsafe.Pointer) { 1066 _pluginInstance.glContext.Uniform3ivUP(gl.Uniform{int32(dst)}, count, value) 1067 } 1068 1069 // Uniform4f writes a vec4 uniform variable. 1070 // 1071 // http://www.khronos.org/opengles/sdk/docs/man3/html/glUniform.xhtml 1072 func Uniform4f(dst Uniform, v0, v1, v2, v3 float32) { 1073 _pluginInstance.glContext.Uniform4f(gl.Uniform{int32(dst)}, v0, v1, v2, v3) 1074 } 1075 1076 // Uniform4fv writes a vec4 uniform array of len(src)/4 elements. 1077 // 1078 // http://www.khronos.org/opengles/sdk/docs/man3/html/glUniform.xhtml 1079 func Uniform4fv(dst Uniform, src []float32) { 1080 _pluginInstance.glContext.Uniform4fv(gl.Uniform{int32(dst)}, src) 1081 } 1082 1083 func Uniform4fvP(dst Uniform, count int32, value *float32) { 1084 _pluginInstance.glContext.Uniform4fvP(gl.Uniform{int32(dst)}, count, value) 1085 } 1086 1087 func Uniform4fvUP(dst Uniform, count int32, value unsafe.Pointer) { 1088 _pluginInstance.glContext.Uniform4fvUP(gl.Uniform{int32(dst)}, count, value) 1089 } 1090 1091 // Uniform4i writes an ivec4 uniform variable. 1092 // 1093 // http://www.khronos.org/opengles/sdk/docs/man3/html/glUniform.xhtml 1094 func Uniform4i(dst Uniform, v0, v1, v2, v3 int32) { 1095 _pluginInstance.glContext.Uniform4i(gl.Uniform{int32(dst)}, v0, v1, v2, v3) 1096 } 1097 1098 // Uniform4i writes an ivec4 uniform array of len(src)/4 elements. 1099 // 1100 // http://www.khronos.org/opengles/sdk/docs/man3/html/glUniform.xhtml 1101 func Uniform4iv(dst Uniform, src []int32) { 1102 _pluginInstance.glContext.Uniform4iv(gl.Uniform{int32(dst)}, src) 1103 } 1104 1105 func Uniform4ivP(dst Uniform, count int32, value *int32) { 1106 _pluginInstance.glContext.Uniform4ivP(gl.Uniform{int32(dst)}, count, value) 1107 } 1108 1109 func Uniform4ivUP(dst Uniform, count int32, value unsafe.Pointer) { 1110 _pluginInstance.glContext.Uniform4ivUP(gl.Uniform{int32(dst)}, count, value) 1111 } 1112 1113 // UniformMatrix2fv writes 2x2 matrices. Each matrix uses four 1114 // float32 values, so the number of matrices written is len(src)/4. 1115 // 1116 // Each matrix must be supplied in column major order. 1117 // 1118 // http://www.khronos.org/opengles/sdk/docs/man3/html/glUniform.xhtml 1119 func UniformMatrix2fv(dst Uniform, src []float32) { 1120 _pluginInstance.glContext.UniformMatrix2fv(gl.Uniform{int32(dst)}, src) 1121 } 1122 1123 func UniformMatrix2fvP(dst Uniform, count int32, transpose bool, value *float32) { 1124 _pluginInstance.glContext.UniformMatrix2fvP(gl.Uniform{int32(dst)}, count, value) 1125 } 1126 1127 func UniformMatrix2fvUP(dst Uniform, count int32, transpose bool, value unsafe.Pointer) { 1128 _pluginInstance.glContext.UniformMatrix2fvUP(gl.Uniform{int32(dst)}, count, value) 1129 } 1130 1131 // UniformMatrix3fv writes 3x3 matrices. Each matrix uses nine 1132 // float32 values, so the number of matrices written is len(src)/9. 1133 // 1134 // Each matrix must be supplied in column major order. 1135 // 1136 // http://www.khronos.org/opengles/sdk/docs/man3/html/glUniform.xhtml 1137 func UniformMatrix3fv(dst Uniform, src []float32) { 1138 _pluginInstance.glContext.UniformMatrix3fv(gl.Uniform{int32(dst)}, src) 1139 } 1140 1141 func UniformMatrix3fvP(dst Uniform, count int32, transpose bool, value *float32) { 1142 _pluginInstance.glContext.UniformMatrix3fvP(gl.Uniform{int32(dst)}, count, value) 1143 } 1144 1145 func UniformMatrix3fvUP(dst Uniform, count int32, transpose bool, value unsafe.Pointer) { 1146 _pluginInstance.glContext.UniformMatrix3fvUP(gl.Uniform{int32(dst)}, count, value) 1147 } 1148 1149 // UniformMatrix4fv writes 4x4 matrices. Each matrix uses 16 1150 // float32 values, so the number of matrices written is len(src)/16. 1151 // 1152 // Each matrix must be supplied in column major order. 1153 // 1154 // http://www.khronos.org/opengles/sdk/docs/man3/html/glUniform.xhtml 1155 func UniformMatrix4fv(dst Uniform, src []float32) { 1156 _pluginInstance.glContext.UniformMatrix4fv(gl.Uniform{int32(dst)}, src) 1157 } 1158 1159 func UniformMatrix4fvP(dst Uniform, count int32, transpose bool, value *float32) { 1160 _pluginInstance.glContext.UniformMatrix4fvP(gl.Uniform{int32(dst)}, count, value) 1161 } 1162 1163 func UniformMatrix4fvUP(dst Uniform, count int32, transpose bool, value unsafe.Pointer) { 1164 _pluginInstance.glContext.UniformMatrix4fvUP(gl.Uniform{int32(dst)}, count, value) 1165 } 1166 1167 // UseProgram sets the active program. 1168 // 1169 // http://www.khronos.org/opengles/sdk/docs/man3/html/glUseProgram.xhtml 1170 func UseProgram(p Program) { 1171 _pluginInstance.glContext.UseProgram(gl.Program{Init: true, Value: uint32(p)}) 1172 } 1173 1174 // ValidateProgram checks to see whether the executables contained in 1175 // program can execute given the current OpenGL state. 1176 // 1177 // Typically only used for debugging. 1178 // 1179 // http://www.khronos.org/opengles/sdk/docs/man3/html/glValidateProgram.xhtml 1180 func ValidateProgram(p Program) { 1181 _pluginInstance.glContext.ValidateProgram(gl.Program{Init: true, Value: uint32(p)}) 1182 } 1183 1184 // VertexAttrib1f writes a float vertex attribute. 1185 // 1186 // http://www.khronos.org/opengles/sdk/docs/man3/html/glVertexAttrib.xhtml 1187 func VertexAttrib1f(dst Attrib, x float32) { 1188 _pluginInstance.glContext.VertexAttrib1f(gl.Attrib{uint(int32(dst))}, x) 1189 } 1190 1191 // VertexAttrib1fv writes a float vertex attribute. 1192 // 1193 // http://www.khronos.org/opengles/sdk/docs/man3/html/glVertexAttrib.xhtml 1194 func VertexAttrib1fv(dst Attrib, src []float32) { 1195 _pluginInstance.glContext.VertexAttrib1fv(gl.Attrib{uint(int32(dst))}, src) 1196 } 1197 1198 // VertexAttrib2f writes a vec2 vertex attribute. 1199 // 1200 // http://www.khronos.org/opengles/sdk/docs/man3/html/glVertexAttrib.xhtml 1201 func VertexAttrib2f(dst Attrib, x, y float32) { 1202 _pluginInstance.glContext.VertexAttrib2f(gl.Attrib{uint(int32(dst))}, x, y) 1203 } 1204 1205 // VertexAttrib2fv writes a vec2 vertex attribute. 1206 // 1207 // http://www.khronos.org/opengles/sdk/docs/man3/html/glVertexAttrib.xhtml 1208 func VertexAttrib2fv(dst Attrib, src []float32) { 1209 _pluginInstance.glContext.VertexAttrib2fv(gl.Attrib{uint(int32(dst))}, src) 1210 } 1211 1212 // VertexAttrib3f writes a vec3 vertex attribute. 1213 // 1214 // http://www.khronos.org/opengles/sdk/docs/man3/html/glVertexAttrib.xhtml 1215 func VertexAttrib3f(dst Attrib, x, y, z float32) { 1216 _pluginInstance.glContext.VertexAttrib3f(gl.Attrib{uint(int32(dst))}, x, y, z) 1217 } 1218 1219 // VertexAttrib3fv writes a vec3 vertex attribute. 1220 // 1221 // http://www.khronos.org/opengles/sdk/docs/man3/html/glVertexAttrib.xhtml 1222 func VertexAttrib3fv(dst Attrib, src []float32) { 1223 _pluginInstance.glContext.VertexAttrib3fv(gl.Attrib{uint(int32(dst))}, src) 1224 } 1225 1226 // VertexAttrib4f writes a vec4 vertex attribute. 1227 // 1228 // http://www.khronos.org/opengles/sdk/docs/man3/html/glVertexAttrib.xhtml 1229 func VertexAttrib4f(dst Attrib, x, y, z, w float32) { 1230 _pluginInstance.glContext.VertexAttrib4f(gl.Attrib{uint(int32(dst))}, x, y, z, w) 1231 } 1232 1233 // VertexAttrib4fv writes a vec4 vertex attribute. 1234 // 1235 // http://www.khronos.org/opengles/sdk/docs/man3/html/glVertexAttrib.xhtml 1236 func VertexAttrib4fv(dst Attrib, src []float32) { 1237 _pluginInstance.glContext.VertexAttrib4fv(gl.Attrib{uint(int32(dst))}, src) 1238 } 1239 1240 // VertexAttribPointer uses a bound buffer to define vertex attribute data. 1241 // 1242 // http://www.khronos.org/opengles/sdk/docs/man3/html/glVertexAttribPointer.xhtml 1243 func VertexAttribPointer(dst Attrib, size int, ty Enum, normalized bool, stride, offset int) { 1244 _pluginInstance.glContext.VertexAttribPointer(gl.Attrib{uint(int32(dst))}, size, gl.Enum(ty), normalized, stride, offset) 1245 } 1246 1247 // Viewport sets the viewport, an affine transformation that 1248 // normalizes device coordinates to window coordinates. 1249 // 1250 // http://www.khronos.org/opengles/sdk/docs/man3/html/glViewport.xhtml 1251 func Viewport(x, y, width, height int) { 1252 _pluginInstance.glContext.Viewport(x, y, width, height) 1253 }