package.go (2933B)
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 // +build !js 13 14 // Package gl implements Go bindings to OpenGL. 15 package gl 16 17 const ( 18 VERTEX_SHADER = 0x8B31 19 FRAGMENT_SHADER = 0x8B30 20 ARRAY_BUFFER = 0x8892 21 ELEMENT_ARRAY_BUFFER = 0x8893 22 DYNAMIC_DRAW = 0x88E8 23 STREAM_DRAW = 0x88E0 24 PIXEL_UNPACK_BUFFER = 0x88EC 25 SHORT = 0x1402 26 FLOAT = 0x1406 27 28 ZERO = 0 29 ONE = 1 30 SRC_ALPHA = 0x0302 31 DST_ALPHA = 0x0304 32 ONE_MINUS_SRC_ALPHA = 0x0303 33 ONE_MINUS_DST_ALPHA = 0x0305 34 DST_COLOR = 0x0306 35 36 FALSE = 0 37 TRUE = 1 38 39 BLEND = 0x0BE2 40 CLAMP_TO_EDGE = 0x812F 41 COLOR_ATTACHMENT0 = 0x8CE0 42 COMPILE_STATUS = 0x8B81 43 FRAMEBUFFER = 0x8D40 44 FRAMEBUFFER_BINDING = 0x8CA6 45 FRAMEBUFFER_COMPLETE = 0x8CD5 46 INFO_LOG_LENGTH = 0x8B84 47 LINK_STATUS = 0x8B82 48 MAX_TEXTURE_SIZE = 0x0D33 49 NEAREST = 0x2600 50 NO_ERROR = 0 51 READ_WRITE = 0x88BA 52 RGBA = 0x1908 53 TEXTURE0 = 0x84C0 54 TEXTURE_2D = 0x0DE1 55 TEXTURE_MAG_FILTER = 0x2800 56 TEXTURE_MIN_FILTER = 0x2801 57 TEXTURE_WRAP_S = 0x2802 58 TEXTURE_WRAP_T = 0x2803 59 TRIANGLES = 0x0004 60 UNPACK_ALIGNMENT = 0x0CF5 61 UNSIGNED_BYTE = 0x1401 62 UNSIGNED_SHORT = 0x1403 63 WRITE_ONLY = 0x88B9 64 ) 65 66 // Init initializes the OpenGL bindings by loading the function pointers (for 67 // each OpenGL function) from the active OpenGL context. 68 // 69 // It must be called under the presence of an active OpenGL context, e.g., 70 // always after calling window.MakeContextCurrent() and always before calling 71 // any OpenGL functions exported by this package. 72 // 73 // On Windows, Init loads pointers that are context-specific (and hence you 74 // must re-init if switching between OpenGL contexts, although not calling Init 75 // again after switching between OpenGL contexts may work if the contexts belong 76 // to the same graphics driver/device). 77 // 78 // On macOS and the other POSIX systems, the behavior is different, but code 79 // written compatible with the Windows behavior is compatible with macOS and the 80 // other POSIX systems. That is, always Init under an active OpenGL context, and 81 // always re-init after switching graphics contexts. 82 // 83 // For information about caveats of Init, you should read the "Platform Specific 84 // Function Retrieval" section of https://www.opengl.org/wiki/Load_OpenGL_Functions. 85 func Init() error { 86 return InitWithProcAddrFunc(getProcAddress) 87 }