Home | History | Annotate | Download | only in jglfw
      1 /*******************************************************************************
      2  * Copyright 2011 See AUTHORS file.
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *   http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  * See the License for the specific language governing permissions and
     14  * limitations under the License.
     15  ******************************************************************************/
     16 
     17 package com.badlogic.gdx.backends.jglfw;
     18 
     19 import static com.badlogic.jglfw.utils.Memory.getPosition;
     20 
     21 import java.nio.Buffer;
     22 import java.nio.ByteBuffer;
     23 import java.nio.FloatBuffer;
     24 import java.nio.IntBuffer;
     25 
     26 import com.badlogic.gdx.graphics.GL20;
     27 import com.badlogic.jglfw.gl.GL;
     28 
     29 public class JglfwGL20 implements GL20 {
     30 	private ByteBuffer buffer = null;
     31 	private FloatBuffer floatBuffer = null;
     32 	private IntBuffer intBuffer = null;
     33 
     34 	private void ensureBufferCapacity (int numBytes) {
     35 		if (buffer == null || buffer.capacity() < numBytes) {
     36 			buffer = com.badlogic.gdx.utils.BufferUtils.newByteBuffer(numBytes);
     37 			floatBuffer = buffer.asFloatBuffer();
     38 			intBuffer = buffer.asIntBuffer();
     39 		}
     40 	}
     41 
     42 	private FloatBuffer toFloatBuffer (float v[], int offset, int count) {
     43 		ensureBufferCapacity(count << 2);
     44 		floatBuffer.clear();
     45 		com.badlogic.gdx.utils.BufferUtils.copy(v, floatBuffer, count, offset);
     46 		return floatBuffer;
     47 	}
     48 
     49 	private IntBuffer toIntBuffer (int v[], int offset, int count) {
     50 		ensureBufferCapacity(count << 2);
     51 		intBuffer.clear();
     52 		com.badlogic.gdx.utils.BufferUtils.copy(v, count, offset, intBuffer);
     53 		return intBuffer;
     54 	}
     55 
     56 	private IntBuffer toIntBuffer (int v) {
     57 		ensureBufferCapacity(4);
     58 		intBuffer.put(0, v);
     59 		intBuffer.position(0);
     60 		intBuffer.limit(1);
     61 		return intBuffer;
     62 	}
     63 
     64 	public void glActiveTexture (int texture) {
     65 		GL.glActiveTexture(texture);
     66 	}
     67 
     68 	public void glBindTexture (int target, int texture) {
     69 		GL.glBindTexture(target, texture);
     70 	}
     71 
     72 	public void glBlendFunc (int sfactor, int dfactor) {
     73 		GL.glBlendFunc(sfactor, dfactor);
     74 	}
     75 
     76 	public void glClear (int mask) {
     77 		GL.glClear(mask);
     78 	}
     79 
     80 	public void glClearColor (float red, float green, float blue, float alpha) {
     81 		GL.glClearColor(red, green, blue, alpha);
     82 	}
     83 
     84 	public void glClearDepthf (float depth) {
     85 		GL.glClearDepthf(depth);
     86 	}
     87 
     88 	public void glClearStencil (int s) {
     89 		GL.glClearStencil(s);
     90 	}
     91 
     92 	public void glColorMask (boolean red, boolean green, boolean blue, boolean alpha) {
     93 		GL.glColorMask(red, green, blue, alpha);
     94 	}
     95 
     96 	public void glCompressedTexImage2D (int target, int level, int internalformat, int width, int height, int border,
     97 		int imageSize, Buffer data) {
     98 		GL.glCompressedTexImage2D(target, level, internalformat, width, height, border, imageSize, data, getPosition(data));
     99 	}
    100 
    101 	public void glCompressedTexSubImage2D (int target, int level, int xoffset, int yoffset, int width, int height, int format,
    102 		int imageSize, Buffer data) {
    103 		GL.glCompressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, imageSize, data, getPosition(data));
    104 	}
    105 
    106 	public void glCopyTexImage2D (int target, int level, int internalformat, int x, int y, int width, int height, int border) {
    107 		GL.glCopyTexImage2D(target, level, internalformat, x, y, width, height, border);
    108 	}
    109 
    110 	public void glCopyTexSubImage2D (int target, int level, int xoffset, int yoffset, int x, int y, int width, int height) {
    111 		GL.glCopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height);
    112 	}
    113 
    114 	public void glCullFace (int mode) {
    115 		GL.glCullFace(mode);
    116 	}
    117 
    118 	public void glDeleteTextures (int n, IntBuffer textures) {
    119 		GL.glDeleteTextures(n, textures, getPosition(textures));
    120 	}
    121 
    122 	public void glDeleteTexture (int texture) {
    123 		glDeleteTextures(1, toIntBuffer(texture));
    124 	}
    125 
    126 	public void glDepthFunc (int func) {
    127 		GL.glDepthFunc(func);
    128 	}
    129 
    130 	public void glDepthMask (boolean flag) {
    131 		GL.glDepthMask(flag);
    132 	}
    133 
    134 	public void glDepthRangef (float zNear, float zFar) {
    135 		GL.glDepthRangef(zNear, zFar);
    136 	}
    137 
    138 	public void glDisable (int cap) {
    139 		GL.glDisable(cap);
    140 	}
    141 
    142 	public void glDrawArrays (int mode, int first, int count) {
    143 		GL.glDrawArrays(mode, first, count);
    144 	}
    145 
    146 	public void glDrawElements (int mode, int count, int type, Buffer indices) {
    147 		GL.glDrawElements(mode, count, type, indices, getPosition(indices));
    148 	}
    149 
    150 	public void glEnable (int cap) {
    151 		GL.glEnable(cap);
    152 	}
    153 
    154 	public void glFinish () {
    155 		GL.glFinish();
    156 	}
    157 
    158 	public void glFlush () {
    159 		GL.glFlush();
    160 	}
    161 
    162 	public void glFrontFace (int mode) {
    163 		GL.glFrontFace(mode);
    164 	}
    165 
    166 	public void glGenTextures (int n, IntBuffer textures) {
    167 		GL.glGenTextures(n, textures, getPosition(textures));
    168 	}
    169 
    170 	public int glGenTexture () {
    171 		ensureBufferCapacity(4);
    172 		intBuffer.position(0);
    173 		intBuffer.limit(1);
    174 		glGenTextures(1, intBuffer);
    175 		return intBuffer.get(0);
    176 	}
    177 
    178 	public int glGetError () {
    179 		return GL.glGetError();
    180 	}
    181 
    182 	public void glGetIntegerv (int pname, IntBuffer params) {
    183 		GL.glGetIntegerv(pname, params, getPosition(params));
    184 	}
    185 
    186 	public String glGetString (int name) {
    187 		return GL.glGetString(name);
    188 	}
    189 
    190 	public void glHint (int target, int mode) {
    191 		GL.glHint(target, mode);
    192 	}
    193 
    194 	public void glLineWidth (float width) {
    195 		GL.glLineWidth(width);
    196 	}
    197 
    198 	public void glPixelStorei (int pname, int param) {
    199 		GL.glPixelStorei(pname, param);
    200 	}
    201 
    202 	public void glPolygonOffset (float factor, float units) {
    203 		GL.glPolygonOffset(factor, units);
    204 	}
    205 
    206 	public void glReadPixels (int x, int y, int width, int height, int format, int type, Buffer pixels) {
    207 		GL.glReadPixels(x, y, width, height, format, type, pixels, getPosition(pixels));
    208 	}
    209 
    210 	public void glScissor (int x, int y, int width, int height) {
    211 		GL.glScissor(x, y, width, height);
    212 	}
    213 
    214 	public void glStencilFunc (int func, int ref, int mask) {
    215 		GL.glStencilFunc(func, ref, mask);
    216 	}
    217 
    218 	public void glStencilMask (int mask) {
    219 		GL.glStencilMask(mask);
    220 	}
    221 
    222 	public void glStencilOp (int fail, int zfail, int zpass) {
    223 		GL.glStencilOp(fail, zfail, zpass);
    224 	}
    225 
    226 	public void glTexImage2D (int target, int level, int internalFormat, int width, int height, int border, int format, int type,
    227 		Buffer pixels) {
    228 		GL.glTexImage2D(target, level, internalFormat, width, height, border, format, type, pixels, getPosition(pixels));
    229 	}
    230 
    231 	public void glTexParameterf (int target, int pname, float param) {
    232 		GL.glTexParameterf(target, pname, param);
    233 	}
    234 
    235 	public void glTexSubImage2D (int target, int level, int xoffset, int yoffset, int width, int height, int format, int type,
    236 		Buffer pixels) {
    237 		GL.glTexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels, getPosition(pixels));
    238 	}
    239 
    240 	public void glViewport (int x, int y, int width, int height) {
    241 		GL.glViewport(x, y, width, height);
    242 	}
    243 
    244 	public void glGetFloatv (int pname, FloatBuffer params) {
    245 		GL.glGetFloatv(pname, params, getPosition(params));
    246 	}
    247 
    248 	public void glGetTexParameterfv (int target, int pname, FloatBuffer params) {
    249 		GL.glGetTexParameterfv(target, pname, params, getPosition(params));
    250 	}
    251 
    252 	public void glTexParameterfv (int target, int pname, FloatBuffer params) {
    253 		GL.glTexParameterfv(target, pname, params, getPosition(params));
    254 	}
    255 
    256 	public void glBindBuffer (int target, int buffer) {
    257 		GL.glBindBuffer(target, buffer);
    258 	}
    259 
    260 	public void glBufferData (int target, int size, Buffer data, int usage) {
    261 		GL.glBufferData(target, size, data, getPosition(data), usage);
    262 	}
    263 
    264 	public void glBufferSubData (int target, int offset, int size, Buffer data) {
    265 		GL.glBufferSubData(target, offset, size, data, getPosition(data));
    266 	}
    267 
    268 	public void glDeleteBuffers (int n, IntBuffer buffers) {
    269 		GL.glDeleteBuffers(n, buffers, getPosition(buffers));
    270 	}
    271 
    272 	public void glDeleteBuffer (int buffer) {
    273 		glDeleteBuffers(1, toIntBuffer(buffer));
    274 	}
    275 
    276 	public void glGetBufferParameteriv (int target, int pname, IntBuffer params) {
    277 		GL.glGetBufferParameteriv(target, pname, params, getPosition(params));
    278 	}
    279 
    280 	public void glGenBuffers (int n, IntBuffer buffers) {
    281 		GL.glGenBuffers(n, buffers, getPosition(buffers));
    282 	}
    283 
    284 	public int glGenBuffer () {
    285 		ensureBufferCapacity(4);
    286 		intBuffer.position(0);
    287 		intBuffer.limit(1);
    288 		glGenBuffers(1, intBuffer);
    289 		return intBuffer.get(0);
    290 	}
    291 
    292 	public void glGetTexParameteriv (int target, int pname, IntBuffer params) {
    293 		GL.glGetTexParameteriv(target, pname, params, getPosition(params));
    294 	}
    295 
    296 	public boolean glIsBuffer (int buffer) {
    297 		return GL.glIsBuffer(buffer);
    298 	}
    299 
    300 	public boolean glIsEnabled (int cap) {
    301 		return GL.glIsEnabled(cap);
    302 	}
    303 
    304 	public boolean glIsTexture (int texture) {
    305 		return GL.glIsTexture(texture);
    306 	}
    307 
    308 	public void glTexParameteri (int target, int pname, int param) {
    309 		GL.glTexParameteri(target, pname, param);
    310 	}
    311 
    312 	public void glTexParameteriv (int target, int pname, IntBuffer params) {
    313 		GL.glTexParameteriv(target, pname, params, getPosition(params));
    314 	}
    315 
    316 	public void glDrawElements (int mode, int count, int type, int indices) {
    317 		GL.glDrawElements(mode, count, type, indices);
    318 	}
    319 
    320 	public void glAttachShader (int program, int shader) {
    321 		GL.glAttachShader(program, shader);
    322 	}
    323 
    324 	public void glBindAttribLocation (int program, int index, String name) {
    325 		GL.glBindAttribLocation(program, index, name);
    326 	}
    327 
    328 	public void glBindFramebuffer (int target, int framebuffer) {
    329 		GL.glBindFramebufferEXT(target, framebuffer);
    330 	}
    331 
    332 	public void glBindRenderbuffer (int target, int renderbuffer) {
    333 		GL.glBindRenderbufferEXT(target, renderbuffer);
    334 	}
    335 
    336 	public void glBlendColor (float red, float green, float blue, float alpha) {
    337 		GL.glBlendColor(red, green, blue, alpha);
    338 	}
    339 
    340 	public void glBlendEquation (int mode) {
    341 		GL.glBlendEquation(mode);
    342 	}
    343 
    344 	public void glBlendEquationSeparate (int modeRGB, int modeAlpha) {
    345 		GL.glBlendEquationSeparate(modeRGB, modeAlpha);
    346 	}
    347 
    348 	public void glBlendFuncSeparate (int srcRGB, int dstRGB, int srcAlpha, int dstAlpha) {
    349 		GL.glBlendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha);
    350 	}
    351 
    352 	public int glCheckFramebufferStatus (int target) {
    353 		return GL.glCheckFramebufferStatusEXT(target);
    354 	}
    355 
    356 	public void glCompileShader (int shader) {
    357 		GL.glCompileShader(shader);
    358 	}
    359 
    360 	public int glCreateProgram () {
    361 		return GL.glCreateProgram();
    362 	}
    363 
    364 	public int glCreateShader (int type) {
    365 		return GL.glCreateShader(type);
    366 	}
    367 
    368 	public void glDeleteFramebuffers (int n, IntBuffer framebuffers) {
    369 		GL.glDeleteFramebuffersEXT(n, framebuffers, getPosition(framebuffers));
    370 	}
    371 
    372 	public void glDeleteFramebuffer (int framebuffer) {
    373 		glDeleteFramebuffers(1, toIntBuffer(framebuffer));
    374 	}
    375 
    376 	public void glDeleteProgram (int program) {
    377 		GL.glDeleteProgram(program);
    378 	}
    379 
    380 	public void glDeleteRenderbuffers (int n, IntBuffer renderbuffers) {
    381 		GL.glDeleteRenderbuffersEXT(n, renderbuffers, getPosition(renderbuffers));
    382 	}
    383 
    384 	public void glDeleteRenderbuffer (int renderbuffer) {
    385 		glDeleteRenderbuffers(1, toIntBuffer(renderbuffer));
    386 	}
    387 
    388 	public void glDeleteShader (int shader) {
    389 		GL.glDeleteShader(shader);
    390 	}
    391 
    392 	public void glDetachShader (int program, int shader) {
    393 		GL.glDetachShader(program, shader);
    394 	}
    395 
    396 	public void glDisableVertexAttribArray (int index) {
    397 		GL.glDisableVertexAttribArray(index);
    398 	}
    399 
    400 	public void glEnableVertexAttribArray (int index) {
    401 		GL.glEnableVertexAttribArray(index);
    402 	}
    403 
    404 	public void glFramebufferRenderbuffer (int target, int attachment, int renderbuffertarget, int renderbuffer) {
    405 		GL.glFramebufferRenderbufferEXT(target, attachment, renderbuffertarget, renderbuffer);
    406 	}
    407 
    408 	public void glFramebufferTexture2D (int target, int attachment, int textarget, int texture, int level) {
    409 		GL.glFramebufferTexture2DEXT(target, attachment, textarget, texture, level);
    410 	}
    411 
    412 	public void glGenerateMipmap (int target) {
    413 		GL.glGenerateMipmapEXT(target);
    414 	}
    415 
    416 	public void glGenFramebuffers (int n, IntBuffer framebuffers) {
    417 		GL.glGenFramebuffersEXT(n, framebuffers, getPosition(framebuffers));
    418 	}
    419 
    420 	public int glGenFramebuffer () {
    421 		ensureBufferCapacity(4);
    422 		intBuffer.position(0);
    423 		intBuffer.limit(1);
    424 		glGenFramebuffers(1, intBuffer);
    425 		return intBuffer.get(0);
    426 	}
    427 
    428 	public void glGenRenderbuffers (int n, IntBuffer renderbuffers) {
    429 		GL.glGenRenderbuffersEXT(n, renderbuffers, getPosition(renderbuffers));
    430 	}
    431 
    432 	public int glGenRenderbuffer () {
    433 		ensureBufferCapacity(4);
    434 		intBuffer.position(0);
    435 		intBuffer.limit(1);
    436 		glGenRenderbuffers(1, intBuffer);
    437 		return intBuffer.get(0);
    438 	}
    439 
    440 	public String glGetActiveAttrib (int program, int index, IntBuffer size, Buffer type) {
    441 		return GL.glGetActiveAttrib(program, index, size, getPosition(size), type, getPosition(type));
    442 	}
    443 
    444 	public String glGetActiveUniform (int program, int index, IntBuffer size, Buffer type) {
    445 		return GL.glGetActiveUniform(program, index, size, getPosition(size), type, getPosition(type));
    446 	}
    447 
    448 	public void glGetAttachedShaders (int program, int maxcount, Buffer count, IntBuffer shaders) {
    449 		GL.glGetAttachedShaders(program, maxcount, count, getPosition(count), shaders, getPosition(shaders));
    450 	}
    451 
    452 	public int glGetAttribLocation (int program, String name) {
    453 		return GL.glGetAttribLocation(program, name);
    454 	}
    455 
    456 	public void glGetBooleanv (int pname, Buffer params) {
    457 		GL.glGetBooleanv(pname, params, getPosition(params));
    458 	}
    459 
    460 	public void glGetFramebufferAttachmentParameteriv (int target, int attachment, int pname, IntBuffer params) {
    461 		GL.glGetFramebufferAttachmentParameterivEXT(target, attachment, pname, params, getPosition(params));
    462 	}
    463 
    464 	public void glGetProgramiv (int program, int pname, IntBuffer params) {
    465 		GL.glGetProgramiv(program, pname, params, getPosition(params));
    466 	}
    467 
    468 	public String glGetProgramInfoLog (int program) {
    469 		return GL.glGetProgramInfoLog(program);
    470 	}
    471 
    472 	public void glGetRenderbufferParameteriv (int target, int pname, IntBuffer params) {
    473 		GL.glGetRenderbufferParameterivEXT(target, pname, params, getPosition(params));
    474 	}
    475 
    476 	public void glGetShaderiv (int shader, int pname, IntBuffer params) {
    477 		GL.glGetShaderiv(shader, pname, params, getPosition(params));
    478 	}
    479 
    480 	public String glGetShaderInfoLog (int shader) {
    481 		return GL.glGetShaderInfoLog(shader);
    482 	}
    483 
    484 	public void glGetShaderPrecisionFormat (int shadertype, int precisiontype, IntBuffer range, IntBuffer precision) {
    485 		GL.glGetShaderPrecisionFormat(shadertype, precisiontype, range, getPosition(range), precision, getPosition(precision));
    486 	}
    487 
    488 	public void glGetShaderSource (int shader, int bufsize, Buffer length, String source) {
    489 		throw new UnsupportedOperationException("Not implemented");
    490 	}
    491 
    492 	public void glGetUniformfv (int program, int location, FloatBuffer params) {
    493 		GL.glGetUniformfv(program, location, params, getPosition(params));
    494 	}
    495 
    496 	public void glGetUniformiv (int program, int location, IntBuffer params) {
    497 		GL.glGetUniformiv(program, location, params, getPosition(params));
    498 	}
    499 
    500 	public int glGetUniformLocation (int program, String name) {
    501 		return GL.glGetUniformLocation(program, name);
    502 	}
    503 
    504 	public void glGetVertexAttribfv (int index, int pname, FloatBuffer params) {
    505 		GL.glGetVertexAttribfv(index, pname, params, getPosition(params));
    506 	}
    507 
    508 	public void glGetVertexAttribiv (int index, int pname, IntBuffer params) {
    509 		GL.glGetVertexAttribiv(index, pname, params, getPosition(params));
    510 	}
    511 
    512 	public void glGetVertexAttribPointerv (int index, int pname, Buffer pointer) {
    513 		GL.glGetVertexAttribPointerv(index, pname, pointer, getPosition(pointer));
    514 	}
    515 
    516 	public boolean glIsFramebuffer (int framebuffer) {
    517 		return GL.glIsFramebufferEXT(framebuffer);
    518 	}
    519 
    520 	public boolean glIsProgram (int program) {
    521 		return GL.glIsProgram(program);
    522 	}
    523 
    524 	public boolean glIsRenderbuffer (int renderbuffer) {
    525 		return GL.glIsRenderbufferEXT(renderbuffer);
    526 	}
    527 
    528 	public boolean glIsShader (int shader) {
    529 		return GL.glIsShader(shader);
    530 	}
    531 
    532 	public void glLinkProgram (int program) {
    533 		GL.glLinkProgram(program);
    534 	}
    535 
    536 	public void glReleaseShaderCompiler () {
    537 		GL.glReleaseShaderCompiler();
    538 	}
    539 
    540 	public void glRenderbufferStorage (int target, int internalformat, int width, int height) {
    541 		GL.glRenderbufferStorageEXT(target, internalformat, width, height);
    542 	}
    543 
    544 	public void glSampleCoverage (float value, boolean invert) {
    545 		GL.glSampleCoverage(value, invert);
    546 	}
    547 
    548 	public void glShaderBinary (int n, IntBuffer shaders, int binaryformat, Buffer binary, int length) {
    549 		GL.glShaderBinary(n, shaders, getPosition(shaders), binaryformat, binary, getPosition(binary), length);
    550 	}
    551 
    552 	public void glShaderSource (int shader, String string) {
    553 		GL.glShaderSource(shader, string);
    554 	}
    555 
    556 	public void glStencilFuncSeparate (int face, int func, int ref, int mask) {
    557 		GL.glStencilFuncSeparate(face, func, ref, mask);
    558 	}
    559 
    560 	public void glStencilMaskSeparate (int face, int mask) {
    561 		GL.glStencilMaskSeparate(face, mask);
    562 	}
    563 
    564 	public void glStencilOpSeparate (int face, int fail, int zfail, int zpass) {
    565 		GL.glStencilOpSeparate(face, fail, zfail, zpass);
    566 	}
    567 
    568 	public void glUniform1f (int location, float x) {
    569 		GL.glUniform1f(location, x);
    570 	}
    571 
    572 	public void glUniform1fv (int location, int count, FloatBuffer v) {
    573 		GL.glUniform1fv(location, count, v, getPosition(v));
    574 	}
    575 
    576 	public void glUniform1fv (int location, int count, float[] v, int offset) {
    577 		glUniform1fv(location, count, toFloatBuffer(v, offset, count));
    578 	}
    579 
    580 	public void glUniform1i (int location, int x) {
    581 		GL.glUniform1i(location, x);
    582 	}
    583 
    584 	public void glUniform1iv (int location, int count, IntBuffer v) {
    585 		GL.glUniform1iv(location, count, v, getPosition(v));
    586 	}
    587 
    588 	public void glUniform1iv (int location, int count, int[] v, int offset) {
    589 		glUniform1iv(location, count, toIntBuffer(v, offset, count));
    590 	}
    591 
    592 	public void glUniform2f (int location, float x, float y) {
    593 		GL.glUniform2f(location, x, y);
    594 	}
    595 
    596 	public void glUniform2fv (int location, int count, FloatBuffer v) {
    597 		GL.glUniform2fv(location, count, v, getPosition(v));
    598 	}
    599 
    600 	public void glUniform2fv (int location, int count, float[] v, int offset) {
    601 		glUniform2fv(location, count, toFloatBuffer(v, offset, count << 1));
    602 	}
    603 
    604 	public void glUniform2i (int location, int x, int y) {
    605 		GL.glUniform2i(location, x, y);
    606 	}
    607 
    608 	public void glUniform2iv (int location, int count, IntBuffer v) {
    609 		GL.glUniform2iv(location, count, v, getPosition(v));
    610 	}
    611 
    612 	public void glUniform2iv (int location, int count, int[] v, int offset) {
    613 		glUniform2iv(location, count, toIntBuffer(v, offset, count<<1));
    614 	}
    615 
    616 	public void glUniform3f (int location, float x, float y, float z) {
    617 		GL.glUniform3f(location, x, y, z);
    618 	}
    619 
    620 	public void glUniform3fv (int location, int count, FloatBuffer v) {
    621 		GL.glUniform3fv(location, count, v, getPosition(v));
    622 	}
    623 
    624 	public void glUniform3fv (int location, int count, float[] v, int offset) {
    625 		glUniform3fv(location, count, toFloatBuffer(v, offset, count*3));
    626 	}
    627 
    628 	public void glUniform3i (int location, int x, int y, int z) {
    629 		GL.glUniform3i(location, x, y, z);
    630 	}
    631 
    632 	public void glUniform3iv (int location, int count, IntBuffer v) {
    633 		GL.glUniform3iv(location, count, v, getPosition(v));
    634 	}
    635 
    636 	public void glUniform3iv (int location, int count, int[] v, int offset) {
    637 		glUniform3iv(location, count, toIntBuffer(v, offset, count*3));
    638 	}
    639 
    640 	public void glUniform4f (int location, float x, float y, float z, float w) {
    641 		GL.glUniform4f(location, x, y, z, w);
    642 	}
    643 
    644 	public void glUniform4fv (int location, int count, FloatBuffer v) {
    645 		GL.glUniform4fv(location, count, v, getPosition(v));
    646 	}
    647 
    648 	public void glUniform4fv (int location, int count, float[] v, int offset) {
    649 		glUniform4fv(location, count, toFloatBuffer(v, offset, count << 2));
    650 	}
    651 
    652 	public void glUniform4i (int location, int x, int y, int z, int w) {
    653 		GL.glUniform4i(location, x, y, z, w);
    654 	}
    655 
    656 	public void glUniform4iv (int location, int count, IntBuffer v) {
    657 		GL.glUniform4iv(location, count, v, getPosition(v));
    658 	}
    659 
    660 	public void glUniform4iv (int location, int count, int[] v, int offset) {
    661 		glUniform4iv(location, count, toIntBuffer(v, offset, count << 2));
    662 	}
    663 
    664 	public void glUniformMatrix2fv (int location, int count, boolean transpose, FloatBuffer value) {
    665 		GL.glUniformMatrix2fv(location, count, transpose, value, getPosition(value));
    666 	}
    667 
    668 	public void glUniformMatrix2fv (int location, int count, boolean transpose, float[] value, int offset) {
    669 		glUniformMatrix2fv(location, count, transpose, toFloatBuffer(value, offset, count << 2));
    670 	}
    671 
    672 	public void glUniformMatrix3fv (int location, int count, boolean transpose, FloatBuffer value) {
    673 		GL.glUniformMatrix3fv(location, count, transpose, value, getPosition(value));
    674 	}
    675 
    676 	public void glUniformMatrix3fv (int location, int count, boolean transpose, float[] value, int offset) {
    677 		glUniformMatrix3fv(location, count, transpose, toFloatBuffer(value, offset, count * 9));
    678 	}
    679 
    680 	public void glUniformMatrix4fv (int location, int count, boolean transpose, FloatBuffer value) {
    681 		GL.glUniformMatrix4fv(location, count, transpose, value, getPosition(value));
    682 	}
    683 
    684 	public void glUniformMatrix4fv (int location, int count, boolean transpose, float[] value, int offset) {
    685 		glUniformMatrix4fv(location, count, transpose, toFloatBuffer(value, offset, count << 4));
    686 	}
    687 
    688 	public void glUseProgram (int program) {
    689 		GL.glUseProgram(program);
    690 	}
    691 
    692 	public void glValidateProgram (int program) {
    693 		GL.glValidateProgram(program);
    694 	}
    695 
    696 	public void glVertexAttrib1f (int indx, float x) {
    697 		GL.glVertexAttrib1f(indx, x);
    698 	}
    699 
    700 	public void glVertexAttrib1fv (int indx, FloatBuffer values) {
    701 		GL.glVertexAttrib1fv(indx, values, getPosition(values));
    702 	}
    703 
    704 	public void glVertexAttrib2f (int indx, float x, float y) {
    705 		GL.glVertexAttrib2f(indx, x, y);
    706 	}
    707 
    708 	public void glVertexAttrib2fv (int indx, FloatBuffer values) {
    709 		GL.glVertexAttrib2fv(indx, values, getPosition(values));
    710 	}
    711 
    712 	public void glVertexAttrib3f (int indx, float x, float y, float z) {
    713 		GL.glVertexAttrib3f(indx, x, y, z);
    714 	}
    715 
    716 	public void glVertexAttrib3fv (int indx, FloatBuffer values) {
    717 		GL.glVertexAttrib3fv(indx, values, getPosition(values));
    718 	}
    719 
    720 	public void glVertexAttrib4f (int indx, float x, float y, float z, float w) {
    721 		GL.glVertexAttrib4f(indx, x, y, z, w);
    722 	}
    723 
    724 	public void glVertexAttrib4fv (int indx, FloatBuffer values) {
    725 		GL.glVertexAttrib4fv(indx, values, getPosition(values));
    726 	}
    727 
    728 	public void glVertexAttribPointer (int indx, int size, int type, boolean normalized, int stride, Buffer ptr) {
    729 		GL.glVertexAttribPointer(indx, size, type, normalized, stride, ptr, getPosition(ptr));
    730 	}
    731 
    732 	public void glVertexAttribPointer (int indx, int size, int type, boolean normalized, int stride, int ptr) {
    733 		GL.glVertexAttribPointer(indx, size, type, normalized, stride, ptr);
    734 	}
    735 }
    736