package.go (3317B)
1 // SPDX-License-Identifier: MIT 2 3 // Copyright (c) 2010 Khronos Group. 4 // This material may be distributed subject to the terms and conditions 5 // set forth in the Open Publication License, v 1.0, 8 June 1999. 6 // http://opencontent.org/openpub/. 7 // 8 // Copyright (c) 1991-2006 Silicon Graphics, Inc. 9 // This document is licensed under the SGI Free Software B License. 10 // For details, see http://oss.sgi.com/projects/FreeB. 11 12 //go:build !js 13 // +build !js 14 15 // Package gl implements Go bindings to OpenGL. 16 package gl 17 18 const ( 19 ZERO = 0 20 ONE = 1 21 SRC_ALPHA = 0x0302 22 DST_ALPHA = 0x0304 23 ONE_MINUS_SRC_ALPHA = 0x0303 24 ONE_MINUS_DST_ALPHA = 0x0305 25 DST_COLOR = 0x0306 26 27 ALWAYS = 0x0207 28 ARRAY_BUFFER = 0x8892 29 BLEND = 0x0BE2 30 CLAMP_TO_EDGE = 0x812F 31 COLOR_ATTACHMENT0 = 0x8CE0 32 COMPILE_STATUS = 0x8B81 33 DEPTH24_STENCIL8 = 0x88F0 34 DYNAMIC_DRAW = 0x88E8 35 ELEMENT_ARRAY_BUFFER = 0x8893 36 FALSE = 0 37 FLOAT = 0x1406 38 FRAGMENT_SHADER = 0x8B30 39 FRAMEBUFFER = 0x8D40 40 FRAMEBUFFER_BINDING = 0x8CA6 41 FRAMEBUFFER_COMPLETE = 0x8CD5 42 INFO_LOG_LENGTH = 0x8B84 43 INVERT = 0x150A 44 KEEP = 0x1E00 45 LINK_STATUS = 0x8B82 46 MAX_TEXTURE_SIZE = 0x0D33 47 NEAREST = 0x2600 48 NO_ERROR = 0 49 NOTEQUAL = 0x0205 50 PIXEL_PACK_BUFFER = 0x88EB 51 PIXEL_UNPACK_BUFFER = 0x88EC 52 READ_WRITE = 0x88BA 53 RENDERBUFFER = 0x8D41 54 RGBA = 0x1908 55 SHORT = 0x1402 56 STENCIL_ATTACHMENT = 0x8D20 57 STENCIL_BUFFER_BIT = 0x0400 58 STENCIL_TEST = 0x0B90 59 STREAM_DRAW = 0x88E0 60 TEXTURE0 = 0x84C0 61 TEXTURE_2D = 0x0DE1 62 TEXTURE_MAG_FILTER = 0x2800 63 TEXTURE_MIN_FILTER = 0x2801 64 TEXTURE_WRAP_S = 0x2802 65 TEXTURE_WRAP_T = 0x2803 66 TRIANGLES = 0x0004 67 TRUE = 1 68 SCISSOR_TEST = 0x0C11 69 UNPACK_ALIGNMENT = 0x0CF5 70 UNSIGNED_BYTE = 0x1401 71 UNSIGNED_SHORT = 0x1403 72 VERTEX_SHADER = 0x8B31 73 WRITE_ONLY = 0x88B9 74 ) 75 76 // Init initializes the OpenGL bindings by loading the function pointers (for 77 // each OpenGL function) from the active OpenGL context. 78 // 79 // It must be called under the presence of an active OpenGL context, e.g., 80 // always after calling window.MakeContextCurrent() and always before calling 81 // any OpenGL functions exported by this package. 82 // 83 // On Windows, Init loads pointers that are context-specific (and hence you 84 // must re-init if switching between OpenGL contexts, although not calling Init 85 // again after switching between OpenGL contexts may work if the contexts belong 86 // to the same graphics driver/device). 87 // 88 // On macOS and the other POSIX systems, the behavior is different, but code 89 // written compatible with the Windows behavior is compatible with macOS and the 90 // other POSIX systems. That is, always Init under an active OpenGL context, and 91 // always re-init after switching graphics contexts. 92 // 93 // For information about caveats of Init, you should read the "Platform Specific 94 // Function Retrieval" section of https://www.opengl.org/wiki/Load_OpenGL_Functions. 95 func Init() error { 96 return InitWithProcAddrFunc(getProcAddress) 97 }