1 /*
2  * Copyright (c) 2002-2008 LWJGL Project
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are
7  * met:
8  *
9  * * Redistributions of source code must retain the above copyright
10  *   notice, this list of conditions and the following disclaimer.
11  *
12  * * Redistributions in binary form must reproduce the above copyright
13  *   notice, this list of conditions and the following disclaimer in the
14  *   documentation and/or other materials provided with the distribution.
15  *
16  * * Neither the name of 'LWJGL' nor the names of
17  *   its contributors may be used to endorse or promote products derived
18  *   from this software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
22  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  */
32 package org.lwjgl.opengl;
33 
34 import org.lwjgl.util.generator.*;
35 import org.lwjgl.util.generator.Alternate;
36 import org.lwjgl.util.generator.opengl.*;
37 
38 import java.nio.Buffer;
39 import java.nio.ByteBuffer;
40 import java.nio.IntBuffer;
41 
42 public interface GL31 {
43 
44 	// ----------------------------------------------------------
45 	// ----------------------[ OpenGL 3.1 ]----------------------
46 	// ----------------------------------------------------------
47 
48 	int GL_RED_SNORM = 0x8F90;
49 	int GL_RG_SNORM = 0x8F91;
50 	int GL_RGB_SNORM = 0x8F92;
51 	int GL_RGBA_SNORM = 0x8F93;
52 	int GL_R8_SNORM = 0x8F94;
53 	int GL_RG8_SNORM = 0x8F95;
54 	int GL_RGB8_SNORM = 0x8F96;
55 	int GL_RGBA8_SNORM = 0x8F97;
56 	int GL_R16_SNORM = 0x8F98;
57 	int GL_RG16_SNORM = 0x8F99;
58 	int GL_RGB16_SNORM = 0x8F9A;
59 	int GL_RGBA16_SNORM = 0x8F9B;
60 	int GL_SIGNED_NORMALIZED = 0x8F9C;
61 
62 	// ------------------------------------------------------------------
63 	// ----------------------[ ARB_draw_instanced ]----------------------
64 	// ------------------------------------------------------------------
65 
glDrawArraysInstanced(@Lenum int mode, int first, @GLsizei int count, @GLsizei int primcount)66 	void glDrawArraysInstanced(@GLenum int mode, int first, @GLsizei int count, @GLsizei int primcount);
67 
glDrawElementsInstanced(@Lenum int mode, @AutoSize(R) @GLsizei int count, @AutoType(R) @GLenum int type, @BufferObject(BufferKind.ElementVBO) @Const @GLubyte @GLushort @GLuint Buffer indices, @GLsizei int primcount)68 	void glDrawElementsInstanced(@GLenum int mode, @AutoSize("indices") @GLsizei int count, @AutoType("indices") @GLenum int type,
69 	                             @BufferObject(BufferKind.ElementVBO)
70 	                             @Const
71 	                             @GLubyte
72 	                             @GLushort
73 	                             @GLuint Buffer indices, @GLsizei int primcount);
74 
75 	// ---------------------------------------------------------------
76 	// ----------------------[ EXT_copy_buffer ]----------------------
77 	// ---------------------------------------------------------------
78 
79 	int GL_COPY_READ_BUFFER_BINDING = 0x8F36;
80 	int GL_COPY_WRITE_BUFFER_BINDING = 0x8F37;
81 
82 	int GL_COPY_READ_BUFFER = GL_COPY_READ_BUFFER_BINDING;
83 	int GL_COPY_WRITE_BUFFER = GL_COPY_WRITE_BUFFER_BINDING;
84 
glCopyBufferSubData(@Lenum int readtarget, @GLenum int writetarget, @GLintptr long readoffset, @GLintptr long writeoffset, @GLsizeiptr long size)85 	void glCopyBufferSubData(@GLenum int readtarget, @GLenum int writetarget, @GLintptr long readoffset, @GLintptr long writeoffset, @GLsizeiptr long size);
86 
87 	// --------------------------------------------------------------------
88 	// ----------------------[ NV_primitive_restart ]----------------------
89 	// --------------------------------------------------------------------
90 
91 	/**
92 	 * Accepted by the <cap> parameter of IsEnabled, and by
93 	 * the <pname> parameter of GetBooleanv, GetIntegerv, GetFloatv, and
94 	 * GetDoublev:
95 	 */
96 	int GL_PRIMITIVE_RESTART = 0x8F9D;
97 
98 	/**
99 	 * Accepted by the <pname> parameter of GetBooleanv, GetIntegerv,
100 	 * GetFloatv, and GetDoublev:
101 	 */
102 	int GL_PRIMITIVE_RESTART_INDEX = 0x8F9E;
103 
glPrimitiveRestartIndex(@Luint int index)104 	void glPrimitiveRestartIndex(@GLuint int index);
105 
106 	// -------------------------------------------------------------------------
107 	// ----------------------[ ARB_texture_buffer_object ]----------------------
108 	// -------------------------------------------------------------------------
109 
110 	/**
111 	 * Accepted by the <target> parameter of BindBuffer, BufferData,
112 	 * BufferSubData, MapBuffer, MapBufferRange, BindTexture, UnmapBuffer,
113 	 * GetBufferSubData, GetBufferParameteriv, GetBufferPointerv, and TexBuffer,
114 	 * and the <pname> parameter of GetBooleanv, GetDoublev, GetFloatv, and
115 	 * GetIntegerv:
116 	 */
117 	int GL_TEXTURE_BUFFER = 0x8C2A;
118 
119 	/**
120 	 * Accepted by the &lt;pname&gt; parameters of GetBooleanv, GetDoublev,
121 	 * GetFloatv, and GetIntegerv:
122 	 */
123 	int GL_MAX_TEXTURE_BUFFER_SIZE = 0x8C2B;
124 	int GL_TEXTURE_BINDING_BUFFER = 0x8C2C;
125 	int GL_TEXTURE_BUFFER_DATA_STORE_BINDING = 0x8C2D;
126 	int GL_TEXTURE_BUFFER_FORMAT = 0x8C2E;
127 
glTexBuffer(@Lenum int target, @GLenum int internalformat, @GLuint int buffer)128 	void glTexBuffer(@GLenum int target, @GLenum int internalformat, @GLuint int buffer);
129 
130 	// ---------------------------------------------------------------------
131 	// ----------------------[ ARB_texture_rectangle ]----------------------
132 	// ---------------------------------------------------------------------
133 
134 	/**
135 	 * Accepted by the &lt;cap&gt; parameter of Enable, Disable and IsEnabled;
136 	 * by the &lt;pname&gt; parameter of GetBooleanv, GetIntegerv, GetFloatv
137 	 * and GetDoublev; and by the &lt;target&gt; parameter of BindTexture,
138 	 * GetTexParameterfv, GetTexParameteriv, TexParameterf, TexParameteri,
139 	 * TexParameterfv and TexParameteriv:
140 	 * Accepted by the &lt;target&gt; parameter of GetTexImage,
141 	 * GetTexLevelParameteriv, GetTexLevelParameterfv, TexImage2D,
142 	 * CopyTexImage2D, TexSubImage2D and CopySubTexImage2D:
143 	 */
144 	int GL_TEXTURE_RECTANGLE = 0x84F5;
145 
146 	/**
147 	 * Accepted by the &lt;pname&gt; parameter of GetBooleanv, GetIntegerv,
148 	 * GetFloatv and GetDoublev:
149 	 */
150 	int GL_TEXTURE_BINDING_RECTANGLE = 0x84F6;
151 
152 	/**
153 	 * Accepted by the &lt;target&gt; parameter of GetTexLevelParameteriv,
154 	 * GetTexLevelParameterfv, GetTexParameteriv and TexImage2D:
155 	 */
156 	int GL_PROXY_TEXTURE_RECTANGLE = 0x84F7;
157 
158 	/**
159 	 * Accepted by the &lt;pname&gt; parameter of GetBooleanv, GetDoublev,
160 	 * GetIntegerv and GetFloatv:
161 	 */
162 	int GL_MAX_RECTANGLE_TEXTURE_SIZE = 0x84F8;
163 
164 	/**
165 	 * Returned by &lt;type&gt; parameter of GetActiveUniform when the location
166 	 * &lt;index&gt; for program object &lt;program&gt; is of type sampler2DRect:
167 	 */
168 	int GL_SAMPLER_2D_RECT = 0x8B63;
169 
170 	/**
171 	 * Returned by &lt;type&gt; parameter of GetActiveUniform when the location
172 	 * &lt;index&gt; for program object &lt;program&gt; is of type sampler2DRectShadow:
173 	 */
174 	int GL_SAMPLER_2D_RECT_SHADOW = 0x8B64;
175 
176 	// -------------------------------------------------------------------------
177 	// ----------------------[ ARB_uniform_buffer_object ]----------------------
178 	// -------------------------------------------------------------------------
179 
180 	/**
181 	 * Accepted by the &lt;target&gt; parameters of BindBuffer, BufferData,
182 	 * BufferSubData, MapBuffer, UnmapBuffer, GetBufferSubData, and
183 	 * GetBufferPointerv:
184 	 */
185 	int GL_UNIFORM_BUFFER = 0x8A11;
186 
187 	/**
188 	 * Accepted by the &lt;pname&gt; parameter of GetIntegeri_v, GetBooleanv,
189 	 * GetIntegerv, GetFloatv, and GetDoublev:
190 	 */
191 	int GL_UNIFORM_BUFFER_BINDING = 0x8A28;
192 
193 	/** Accepted by the &lt;pname&gt; parameter of GetIntegeri_v: */
194 	int GL_UNIFORM_BUFFER_START = 0x8A29;
195 	int GL_UNIFORM_BUFFER_SIZE = 0x8A2A;
196 
197 	/**
198 	 * Accepted by the &lt;pname&gt; parameter of GetBooleanv, GetIntegerv,
199 	 * GetFloatv, and GetDoublev:
200 	 */
201 	int GL_MAX_VERTEX_UNIFORM_BLOCKS = 0x8A2B;
202 	int GL_MAX_GEOMETRY_UNIFORM_BLOCKS = 0x8A2C;
203 	int GL_MAX_FRAGMENT_UNIFORM_BLOCKS = 0x8A2D;
204 	int GL_MAX_COMBINED_UNIFORM_BLOCKS = 0x8A2E;
205 	int GL_MAX_UNIFORM_BUFFER_BINDINGS = 0x8A2F;
206 	int GL_MAX_UNIFORM_BLOCK_SIZE = 0x8A30;
207 	int GL_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS = 0x8A31;
208 	int GL_MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS = 0x8A32;
209 	int GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS = 0x8A33;
210 	int GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT = 0x8A34;
211 
212 	/** Accepted by the &lt;pname&gt; parameter of GetProgramiv: */
213 	int GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH = 0x8A35;
214 	int GL_ACTIVE_UNIFORM_BLOCKS = 0x8A36;
215 
216 	/** Accepted by the &lt;pname&gt; parameter of GetActiveUniformsiv: */
217 	int GL_UNIFORM_TYPE = 0x8A37;
218 	int GL_UNIFORM_SIZE = 0x8A38;
219 	int GL_UNIFORM_NAME_LENGTH = 0x8A39;
220 	int GL_UNIFORM_BLOCK_INDEX = 0x8A3A;
221 	int GL_UNIFORM_OFFSET = 0x8A3B;
222 	int GL_UNIFORM_ARRAY_STRIDE = 0x8A3C;
223 	int GL_UNIFORM_MATRIX_STRIDE = 0x8A3D;
224 	int GL_UNIFORM_IS_ROW_MAJOR = 0x8A3E;
225 
226 	/** Accepted by the &lt;pname&gt; parameter of GetActiveUniformBlockiv: */
227 	int GL_UNIFORM_BLOCK_BINDING = 0x8A3F;
228 	int GL_UNIFORM_BLOCK_DATA_SIZE = 0x8A40;
229 	int GL_UNIFORM_BLOCK_NAME_LENGTH = 0x8A41;
230 	int GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS = 0x8A42;
231 	int GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES = 0x8A43;
232 	int GL_UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER = 0x8A44;
233 	int GL_UNIFORM_BLOCK_REFERENCED_BY_GEOMETRY_SHADER = 0x8A45;
234 	int GL_UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER = 0x8A46;
235 
236 	/** Returned by GetActiveUniformsiv and GetUniformBlockIndex */
237 	int GL_INVALID_INDEX = 0xFFFFFFFF;
238 
glGetUniformIndices(@Luint int program, @AutoSize(R) @GLsizei int uniformCount, @Const @NullTerminated(R) @GLchar @PointerArray(R) ByteBuffer uniformNames, @OutParameter @GLuint IntBuffer uniformIndices)239 	void glGetUniformIndices(@GLuint int program, @AutoSize("uniformIndices") @GLsizei int uniformCount,
240 	                         @Const @NullTerminated("uniformIndices.remaining()") @GLchar @PointerArray("uniformCount") ByteBuffer uniformNames,
241 	                         @OutParameter @GLuint IntBuffer uniformIndices);
242 
243 	@Alternate("glGetUniformIndices")
glGetUniformIndices(@Luint int program, @Constant(R) @GLsizei int uniformCount, @Const @NullTerminated @PointerArray(R) CharSequence[] uniformNames, @OutParameter @Check(R) @GLuint IntBuffer uniformIndices)244 	void glGetUniformIndices(@GLuint int program, @Constant("uniformNames.length") @GLsizei int uniformCount,
245 	                         @Const @NullTerminated @PointerArray("uniformCount") CharSequence[] uniformNames,
246 	                         @OutParameter @Check("uniformNames.length") @GLuint IntBuffer uniformIndices);
247 
248 	@StripPostfix("params")
glGetActiveUniformsiv(@Luint int program, @AutoSize(R) @GLsizei int uniformCount, @Const @GLuint IntBuffer uniformIndices, @GLenum int pname, @OutParameter @Check(R) @GLint IntBuffer params)249 	void glGetActiveUniformsiv(@GLuint int program, @AutoSize("uniformIndices") @GLsizei int uniformCount,
250 	                           @Const @GLuint IntBuffer uniformIndices,
251 	                           @GLenum int pname,
252 	                           @OutParameter @Check("uniformIndices.remaining()") @GLint IntBuffer params);
253 
254 	/** @deprecated Will be removed in 3.0. Use {@link #glGetActiveUniformsi} instead. */
255 	@Alternate("glGetActiveUniformsiv")
256 	@GLreturn("params")
257 	@StripPostfix("params")
258 	@Reuse(value = "GL31", method = "glGetActiveUniformsi")
259 	@Deprecated
glGetActiveUniformsiv(@Luint int program, @Constant(R) @GLsizei int uniformCount, @Constant(value = R, keepParam = true) int uniformIndex, @GLenum int pname, @OutParameter @GLint IntBuffer params)260 	void glGetActiveUniformsiv(@GLuint int program, @Constant("1") @GLsizei int uniformCount,
261 	                           @Constant(value = "MemoryUtil.getAddress(params.put(1, uniformIndex), 1)", keepParam = true) int uniformIndex, // Reuse params buffer
262 	                           @GLenum int pname,
263 	                           @OutParameter @GLint IntBuffer params);
264 
265 	@Alternate("glGetActiveUniformsiv")
266 	@GLreturn("params")
267 	@StripPostfix(value = "params", hasPostfix = false)
glGetActiveUniformsiv2(@Luint int program, @Constant(R) @GLsizei int uniformCount, @Constant(value = R, keepParam = true) int uniformIndex, @GLenum int pname, @OutParameter @GLint IntBuffer params)268 	void glGetActiveUniformsiv2(@GLuint int program, @Constant("1") @GLsizei int uniformCount,
269 	                            @Constant(value = "MemoryUtil.getAddress(params.put(1, uniformIndex), 1)", keepParam = true) int uniformIndex, // Reuse params buffer
270 	                            @GLenum int pname,
271 	                            @OutParameter @GLint IntBuffer params);
272 
glGetActiveUniformName(@Luint int program, @GLuint int uniformIndex, @AutoSize(R) @GLsizei int bufSize, @OutParameter @GLsizei @Check(value = R, canBeNull = true) IntBuffer length, @OutParameter @GLchar ByteBuffer uniformName)273 	void glGetActiveUniformName(@GLuint int program, @GLuint int uniformIndex, @AutoSize("uniformName") @GLsizei int bufSize,
274 	                            @OutParameter @GLsizei @Check(value = "1", canBeNull = true) IntBuffer length,
275 	                            @OutParameter @GLchar ByteBuffer uniformName);
276 
277 	@Alternate("glGetActiveUniformName")
278 	@GLreturn(value = "uniformName", maxLength = "bufSize")
glGetActiveUniformName2(@Luint int program, @GLuint int uniformIndex, @GLsizei int bufSize, @OutParameter @GLsizei @Constant(R) IntBuffer length, @OutParameter @GLchar ByteBuffer uniformName)279 	void glGetActiveUniformName2(@GLuint int program, @GLuint int uniformIndex, @GLsizei int bufSize,
280 	                             @OutParameter @GLsizei @Constant("MemoryUtil.getAddress0(uniformName_length)") IntBuffer length,
281 	                             @OutParameter @GLchar ByteBuffer uniformName);
282 
283 	@GLuint
glGetUniformBlockIndex(@Luint int program, @Const @NullTerminated @GLchar ByteBuffer uniformBlockName)284 	int glGetUniformBlockIndex(@GLuint int program, @Const @NullTerminated @GLchar ByteBuffer uniformBlockName);
285 
286 	@Alternate("glGetUniformBlockIndex")
287 	@GLuint
glGetUniformBlockIndex(@Luint int program, @NullTerminated CharSequence uniformBlockName)288 	int glGetUniformBlockIndex(@GLuint int program, @NullTerminated CharSequence uniformBlockName);
289 
290 	@StripPostfix("params")
glGetActiveUniformBlockiv(@Luint int program, @GLuint int uniformBlockIndex, @GLenum int pname, @OutParameter @Check(value = R) @GLint IntBuffer params)291 	void glGetActiveUniformBlockiv(@GLuint int program, @GLuint int uniformBlockIndex, @GLenum int pname,
292 	                               @OutParameter @Check(value = "16") @GLint IntBuffer params);
293 
294 	/** @deprecated Will be removed in 3.0. Use {@link #glGetActiveUniformBlocki} instead. */
295 	@Alternate("glGetActiveUniformBlockiv")
296 	@GLreturn("params")
297 	@StripPostfix("params")
298 	@Reuse(value = "GL31", method = "glGetActiveUniformBlocki")
299 	@Deprecated
glGetActiveUniformBlockiv2(@Luint int program, @GLuint int uniformBlockIndex, @GLenum int pname, @OutParameter @GLint IntBuffer params)300 	void glGetActiveUniformBlockiv2(@GLuint int program, @GLuint int uniformBlockIndex, @GLenum int pname,
301 	                                @OutParameter @GLint IntBuffer params);
302 
303 	@Alternate("glGetActiveUniformBlockiv")
304 	@GLreturn("params")
305 	@StripPostfix(value = "params", hasPostfix = false)
glGetActiveUniformBlockiv3(@Luint int program, @GLuint int uniformBlockIndex, @GLenum int pname, @OutParameter @GLint IntBuffer params)306 	void glGetActiveUniformBlockiv3(@GLuint int program, @GLuint int uniformBlockIndex, @GLenum int pname,
307 	                                @OutParameter @GLint IntBuffer params);
308 
glGetActiveUniformBlockName(@Luint int program, @GLuint int uniformBlockIndex, @AutoSize(R) @GLsizei int bufSize, @OutParameter @GLsizei @Check(value = R, canBeNull = true) IntBuffer length, @OutParameter @GLchar ByteBuffer uniformBlockName)309 	void glGetActiveUniformBlockName(@GLuint int program, @GLuint int uniformBlockIndex, @AutoSize("uniformBlockName") @GLsizei int bufSize,
310 	                                 @OutParameter @GLsizei @Check(value = "1", canBeNull = true) IntBuffer length,
311 	                                 @OutParameter @GLchar ByteBuffer uniformBlockName);
312 
313 	@Alternate("glGetActiveUniformBlockName")
314 	@GLreturn(value = "uniformBlockName", maxLength = "bufSize")
glGetActiveUniformBlockName2(@Luint int program, @GLuint int uniformBlockIndex, @GLsizei int bufSize, @OutParameter @GLsizei @Constant(R) IntBuffer length, @OutParameter @GLchar ByteBuffer uniformBlockName)315 	void glGetActiveUniformBlockName2(@GLuint int program, @GLuint int uniformBlockIndex, @GLsizei int bufSize,
316 	                                  @OutParameter @GLsizei @Constant("MemoryUtil.getAddress0(uniformBlockName_length)") IntBuffer length,
317 	                                  @OutParameter @GLchar ByteBuffer uniformBlockName);
318 
glUniformBlockBinding(@Luint int program, @GLuint int uniformBlockIndex, @GLuint int uniformBlockBinding)319 	void glUniformBlockBinding(@GLuint int program, @GLuint int uniformBlockIndex, @GLuint int uniformBlockBinding);
320 
321 }