Converted various GL sizes to buffer.remaining()

This commit is contained in:
Elias Naur 2003-08-02 15:21:55 +00:00
parent 11404dc8a1
commit 907d5f083d
14 changed files with 177 additions and 176 deletions

View File

@ -85,7 +85,7 @@ public final class Sys {
/**
* The ByteBuffer equivalent of the native NULL constant
*/
public static final ByteBuffer NULL;
// public static final ByteBuffer NULL;
private static boolean _debug;
@ -102,7 +102,7 @@ public final class Sys {
} finally {
DEBUG = _debug;
initialize();
NULL = nGetNULLValue();
// NULL = nGetNULLValue();
}
}
@ -132,7 +132,7 @@ public final class Sys {
/**
* Gets the native NULL constant value
*/
private static native ByteBuffer nGetNULLValue();
// private static native ByteBuffer nGetNULLValue();
/**
* Create a buffer representing an integer index. Use it with functions that in C can take

View File

@ -54,14 +54,14 @@ public class CoreGL11 implements CoreGL11Constants {
public static native void glClearColor(float red, float green, float blue, float alpha);
public static native void glClearAccum(float red, float green, float blue, float alpha);
public static native void glClear(int mask);
public static void glCallLists(int n, ByteBuffer lists) {
nglCallLists(n, GL_UNSIGNED_BYTE, lists, lists.position());
public static void glCallLists(ByteBuffer lists) {
nglCallLists(lists.remaining(), GL_UNSIGNED_BYTE, lists, lists.position());
}
public static void glCallLists(int n, ShortBuffer lists) {
nglCallLists(n, GL_UNSIGNED_SHORT, lists, lists.position() << 1);
public static void glCallLists(ShortBuffer lists) {
nglCallLists(lists.remaining(), GL_UNSIGNED_SHORT, lists, lists.position() << 1);
}
public static void glCallLists(int n, IntBuffer lists) {
nglCallLists(n, GL_UNSIGNED_INT, lists, lists.position() << 2);
nglCallLists(lists.remaining(), GL_UNSIGNED_INT, lists, lists.position() << 2);
}
private static native void nglCallLists(int n, int type, Buffer lists, int lists_offset);
public static native void glCallList(int list);
@ -76,8 +76,8 @@ public class CoreGL11 implements CoreGL11Constants {
public static native void glArrayElement(int i);
public static native void glClearDepth(double depth);
public static native void glDeleteLists(int list, int range);
public static void glDeleteTextures(int n, IntBuffer textures) {
nglDeleteTextures(n, textures, textures.position());
public static void glDeleteTextures(IntBuffer textures) {
nglDeleteTextures(textures.remaining(), textures, textures.position());
}
private static native void nglDeleteTextures(int n, IntBuffer textures, int textures_offset);
public static native void glCullFace(int mode);
@ -132,14 +132,14 @@ public class CoreGL11 implements CoreGL11Constants {
nglDrawPixels(width, height, format, type, pixels, pixels.position() << 2);
}
private static native void nglDrawPixels(int width, int height, int format, int type, Buffer pixels, int pixels_offset);
public static void glDrawElements(int mode, int count, ByteBuffer indices) {
nglDrawElements(mode, count, GL_UNSIGNED_BYTE, indices, indices.position());
public static void glDrawElements(int mode, ByteBuffer indices) {
nglDrawElements(mode, indices.remaining(), GL_UNSIGNED_BYTE, indices, indices.position());
}
public static void glDrawElements(int mode, int count, ShortBuffer indices) {
nglDrawElements(mode, count, GL_UNSIGNED_SHORT, indices, indices.position() << 1);
public static void glDrawElements(int mode, ShortBuffer indices) {
nglDrawElements(mode, indices.remaining(), GL_UNSIGNED_SHORT, indices, indices.position() << 1);
}
public static void glDrawElements(int mode, int count, IntBuffer indices) {
nglDrawElements(mode, count, GL_UNSIGNED_INT, indices, indices.position() << 2);
public static void glDrawElements(int mode, IntBuffer indices) {
nglDrawElements(mode, indices.remaining(), GL_UNSIGNED_INT, indices, indices.position() << 2);
}
private static native void nglDrawElements(int mode, int count, int type, Buffer indices, int indices_offset);
public static native void glDrawBuffer(int mode);
@ -147,8 +147,8 @@ public class CoreGL11 implements CoreGL11Constants {
public static native void glDepthRange(double zNear, double zFar);
public static native void glDepthMask(boolean flag);
public static native void glDepthFunc(int func);
public static void glFeedbackBuffer(int size, int type, FloatBuffer buffer) {
nglFeedbackBuffer(size, type, buffer, buffer.position());
public static void glFeedbackBuffer(int type, FloatBuffer buffer) {
nglFeedbackBuffer(buffer.remaining(), type, buffer, buffer.position());
}
private static native void nglFeedbackBuffer(int size, int type, FloatBuffer buffer, int buffer_offset);
public static void glGetPixelMap(int map, FloatBuffer values) {
@ -208,8 +208,8 @@ public class CoreGL11 implements CoreGL11Constants {
nglGetIntegerv(pname, params, params.position());
}
private static native void nglGetIntegerv(int pname, IntBuffer params, int params_offset);
public static void glGenTextures(int n, IntBuffer textures) {
nglGenTextures(n, textures, textures.position());
public static void glGenTextures(IntBuffer textures) {
nglGenTextures(textures.remaining(), textures, textures.position());
}
private static native void nglGenTextures(int n, IntBuffer textures, int textures_offset);
public static native int glGenLists(int range);
@ -362,16 +362,16 @@ public class CoreGL11 implements CoreGL11Constants {
public static native void glPixelTransferi(int pname, int param);
public static native void glPixelStoref(int pname, float param);
public static native void glPixelStorei(int pname, int param);
public static void glPixelMap(int map, int mapsize, FloatBuffer values) {
nglPixelMapfv(map, mapsize, values, values.position());
public static void glPixelMap(int map, FloatBuffer values) {
nglPixelMapfv(map, values.remaining(), values, values.position());
}
private static native void nglPixelMapfv(int map, int mapsize, FloatBuffer values, int values_offset);
public static void glPixelMap(int map, int mapsize, IntBuffer values) {
nglPixelMapuiv(map, mapsize, values, values.position());
public static void glPixelMap(int map, IntBuffer values) {
nglPixelMapuiv(map, values.remaining(), values, values.position());
}
private static native void nglPixelMapuiv(int map, int mapsize, IntBuffer values, int values_offset);
public static void glPixelMap(int map, int mapsize, ShortBuffer values) {
nglPixelMapusv(map, mapsize, values, values.position());
public static void glPixelMap(int map, ShortBuffer values) {
nglPixelMapusv(map, values.remaining(), values, values.position());
}
private static native void nglPixelMapusv(int map, int mapsize, ShortBuffer values, int values_offset);
public static native void glPassThrough(float token);
@ -396,8 +396,8 @@ public class CoreGL11 implements CoreGL11Constants {
}
private static native void nglMultMatrixf(FloatBuffer m, int m_offset);
public static native void glShadeModel(int mode);
public static void glSelectBuffer(int size, IntBuffer buffer) {
nglSelectBuffer(size, buffer, buffer.position());
public static void glSelectBuffer(IntBuffer buffer) {
nglSelectBuffer(buffer.remaining(), buffer, buffer.position());
}
private static native void nglSelectBuffer(int size, IntBuffer buffer, int buffer_offset);
public static native void glScissor(int x, int y, int width, int height);
@ -516,4 +516,3 @@ public class CoreGL11 implements CoreGL11Constants {
public static native void glViewport(int x, int y, int width, int height);
}

View File

@ -190,14 +190,14 @@ public class CoreGL12 extends CoreGL11 implements CoreGL12Constants {
nglGetSeparableFilter(target, format, type, row, Util.getOffset(row), column, Util.getOffset(column), span, Util.getOffset(span));
}
private static native void nglGetSeparableFilter(int target, int format, int type, Buffer row, int row_offset, Buffer column, int column_offset, Buffer span, int span_offset);
public static void glDrawRangeElements(int mode, int start, int end, int count, int type, ByteBuffer indices) {
nglDrawRangeElements(mode, start, end, count, type, indices, indices.position());
public static void glDrawRangeElements(int mode, int start, int end, int type, ByteBuffer indices) {
nglDrawRangeElements(mode, start, end, indices.remaining(), type, indices, indices.position());
}
public static void glDrawRangeElements(int mode, int start, int end, int count, int type, ShortBuffer indices) {
nglDrawRangeElements(mode, start, end, count, type, indices, indices.position() << 1);
public static void glDrawRangeElements(int mode, int start, int end, int type, ShortBuffer indices) {
nglDrawRangeElements(mode, start, end, indices.remaining(), type, indices, indices.position() << 1);
}
public static void glDrawRangeElements(int mode, int start, int end, int count, int type, IntBuffer indices) {
nglDrawRangeElements(mode, start, end, count, type, indices, indices.position() << 2);
public static void glDrawRangeElements(int mode, int start, int end, int type, IntBuffer indices) {
nglDrawRangeElements(mode, start, end, indices.remaining(), type, indices, indices.position() << 2);
}
private static native void nglDrawRangeElements(int mode, int start, int end, int count, int type, Buffer indices, int indices_offset);
public static void glTexImage3D(int target, int level, int internalFormat, int width, int height, int depth, int border, int format, int type, ByteBuffer pixels) {
@ -223,4 +223,3 @@ public class CoreGL12 extends CoreGL11 implements CoreGL12Constants {
public static native void glCopyTexSubImage3D(int target, int level, int xoffset, int yoffset, int zoffset, int x, int y, int width, int height);
}

View File

@ -51,8 +51,9 @@ public class CoreGL14 extends CoreGL13 implements CoreGL14Constants {
nglFogCoordPointer(GL_FLOAT, stride, data, data.position() << 2);
}
private static native void nglFogCoordPointer (int type, int stride, Buffer data, int data_offset);
public static void glMultiDrawArrays(int mode, IntBuffer piFirst, IntBuffer piCount, int primcount) {
nglMultiDrawArrays(mode, piFirst, piFirst.position(), piCount, piCount.position(), primcount);
public static void glMultiDrawArrays(int mode, IntBuffer piFirst, IntBuffer piCount) {
assert piFirst.remaining() == piCount.remaining(): "piFirst.remaining() != piCount.remaining()";
nglMultiDrawArrays(mode, piFirst, piFirst.position(), piCount, piCount.position(), piFirst.remaining());
}
private static native void nglMultiDrawArrays(int mode, IntBuffer piFirst, int piFirst_offset, IntBuffer piCount, int piCount_offset, int primcount);
/* public static native void glMultiDrawElements(int mode, int piCount, int type, int pIndices, int primcount);*/
@ -78,4 +79,3 @@ public class CoreGL14 extends CoreGL13 implements CoreGL14Constants {
public static native void glWindowPos3i (int x, int y, int z);
}

View File

@ -84,8 +84,9 @@ public class GL extends CoreGL14 implements GLConstants {
int arg3Rep,
int arg3Mod);
public static boolean glAreProgramsResidentNV(int n, IntBuffer piIDs, ByteBuffer pbResidences) {
return nglAreProgramsResidentNV(n, piIDs, piIDs.position(), pbResidences, pbResidences.position());
public static boolean glAreProgramsResidentNV(IntBuffer piIDs, ByteBuffer pbResidences) {
assert piIDs.remaining() == pbResidences.remaining(): "piIDs.remaining() != pbResidences.remaining()";
return nglAreProgramsResidentNV(piIDs.remaining(), piIDs, piIDs.position(), pbResidences, pbResidences.position());
}
private static native boolean nglAreProgramsResidentNV(int n, IntBuffer piIDs, int piIDs_offset, ByteBuffer pbResidences, int pbResidences_offset);
@ -268,25 +269,25 @@ public class GL extends CoreGL14 implements GLConstants {
public static native void glCurrentPaletteMatrixARB(int index);
public static void glDeleteFencesNV(int n, IntBuffer piFences) {
nglDeleteFencesNV(n, piFences, piFences.position());
public static void glDeleteFencesNV(IntBuffer piFences) {
nglDeleteFencesNV(piFences.remaining(), piFences, piFences.position());
}
private static native void nglDeleteFencesNV(int n, IntBuffer piFences, int piFences_offset);
public static native void glDeleteFragmentShaderATI(int id);
public static void glDeleteOcclusionQueriesNV(int n, IntBuffer piIDs) {
nglDeleteOcclusionQueriesNV(n, piIDs, piIDs.position());
public static void glDeleteOcclusionQueriesNV(IntBuffer piIDs) {
nglDeleteOcclusionQueriesNV(piIDs.remaining(), piIDs, piIDs.position());
}
private static native void nglDeleteOcclusionQueriesNV(int n, IntBuffer piIDs, int piIDs_offset);
public static void glDeleteProgramsARB(int n, IntBuffer piPrograms) {
nglDeleteProgramsARB(n, piPrograms, piPrograms.position());
public static void glDeleteProgramsARB(IntBuffer piPrograms) {
nglDeleteProgramsARB(piPrograms.remaining(), piPrograms, piPrograms.position());
}
private static native void nglDeleteProgramsARB(int n, IntBuffer piPrograms, int piPrograms_offset);
public static void glDeleteProgramsNV(int n, IntBuffer piIDs) {
nglDeleteProgramsNV(n, piIDs, piIDs.position());
public static void glDeleteProgramsNV(IntBuffer piIDs) {
nglDeleteProgramsNV(piIDs.remaining(), piIDs, piIDs.position());
}
private static native void nglDeleteProgramsNV(int n, IntBuffer piIDs, int piIDs_offset);
@ -304,14 +305,14 @@ public class GL extends CoreGL14 implements GLConstants {
int end,
int count);
public static void glDrawRangeElementsEXT(int mode, int start, int end, int count, ByteBuffer pIndices) {
nglDrawRangeElementsEXT(mode, start, end, count, GL_UNSIGNED_BYTE, pIndices, pIndices.position());
public static void glDrawRangeElementsEXT(int mode, int start, int end, ByteBuffer pIndices) {
nglDrawRangeElementsEXT(mode, start, end, pIndices.remaining(), GL_UNSIGNED_BYTE, pIndices, pIndices.position());
}
public static void glDrawRangeElementsEXT(int mode, int start, int end, int count, ShortBuffer pIndices) {
nglDrawRangeElementsEXT(mode, start, end, count, GL_UNSIGNED_SHORT, pIndices, pIndices.position()<<1);
public static void glDrawRangeElementsEXT(int mode, int start, int end, ShortBuffer pIndices) {
nglDrawRangeElementsEXT(mode, start, end, pIndices.remaining(), GL_UNSIGNED_SHORT, pIndices, pIndices.position()<<1);
}
public static void glDrawRangeElementsEXT(int mode, int start, int end, int count, IntBuffer pIndices) {
nglDrawRangeElementsEXT(mode, start, end, count, GL_UNSIGNED_INT, pIndices, pIndices.position()<<2);
public static void glDrawRangeElementsEXT(int mode, int start, int end, IntBuffer pIndices) {
nglDrawRangeElementsEXT(mode, start, end, pIndices.remaining(), GL_UNSIGNED_INT, pIndices, pIndices.position()<<2);
}
private static native void nglDrawRangeElementsEXT(int mode, int start, int end, int count, int type, Buffer pIndices, int pIndices_offset);
@ -364,25 +365,25 @@ public class GL extends CoreGL14 implements GLConstants {
public static native void glFreeObjectBufferATI(int buffer);
public static void glGenFencesNV(int n, IntBuffer piFences) {
nglGenFencesNV(n, piFences, piFences.position());
public static void glGenFencesNV(IntBuffer piFences) {
nglGenFencesNV(piFences.remaining(), piFences, piFences.position());
}
private static native void nglGenFencesNV(int n, IntBuffer piFences, int piFences_offset);
public static native int glGenFragmentShadersATI(int range);
public static void glGenOcclusionQueriesNV(int n, IntBuffer piIDs) {
nglGenOcclusionQueriesNV(n, piIDs, piIDs.position());
public static void glGenOcclusionQueriesNV(IntBuffer piIDs) {
nglGenOcclusionQueriesNV(piIDs.remaining(), piIDs, piIDs.position());
}
private static native void nglGenOcclusionQueriesNV(int n, IntBuffer piIDs, int piIDs_offset);
public static void glGenProgramsARB(int n, IntBuffer piPrograms) {
nglGenProgramsARB(n, piPrograms, piPrograms.position());
public static void glGenProgramsARB(IntBuffer piPrograms) {
nglGenProgramsARB(piPrograms.remaining(), piPrograms, piPrograms.position());
}
private static native void nglGenProgramsARB(int n, IntBuffer piPrograms, int piPrograms_offset);
public static void glGenProgramsNV(int n, IntBuffer piIDs) {
nglGenProgramsNV(n, piIDs, piIDs.position());
public static void glGenProgramsNV(IntBuffer piIDs) {
nglGenProgramsNV(piIDs.remaining(), piIDs, piIDs.position());
}
private static native void nglGenProgramsNV(int n, IntBuffer piIDs, int piIDs_offset);
@ -653,8 +654,8 @@ public class GL extends CoreGL14 implements GLConstants {
public static native boolean glIsVariantEnabledEXT(int id, int cap);
public static void glLoadProgramNV(int target, int id, int len, ByteBuffer pProgram) {
nglLoadProgramNV(target, id, len, pProgram, pProgram.position());
public static void glLoadProgramNV(int target, int id, ByteBuffer pProgram) {
nglLoadProgramNV(target, id, pProgram.remaining(), pProgram, pProgram.position());
}
private static native void nglLoadProgramNV(int target, int id, int len, ByteBuffer pProgram, int pProgram_offset);
@ -691,23 +692,24 @@ public class GL extends CoreGL14 implements GLConstants {
}
private static native void nglMatrixIndexPointerARB(int size, int type, int stride, Buffer pPointer, int pPointer_offset);
public static void glMatrixIndexuARB(int size, ByteBuffer pIndices) {
nglMatrixIndexubvARB(size, pIndices, pIndices.position());
public static void glMatrixIndexuARB(ByteBuffer pIndices) {
nglMatrixIndexubvARB(pIndices.remaining(), pIndices, pIndices.position());
}
private static native void nglMatrixIndexubvARB(int size, ByteBuffer pIndices, int pIndices_offset);
public static void glMatrixIndexuARB(int size, IntBuffer piIndices) {
nglMatrixIndexuivARB(size, piIndices, piIndices.position());
public static void glMatrixIndexuARB(IntBuffer piIndices) {
nglMatrixIndexuivARB(piIndices.remaining(), piIndices, piIndices.position());
}
private static native void nglMatrixIndexuivARB(int size, IntBuffer piIndices, int piIndices_offset);
public static void glMatrixIndexuARB(int size, ShortBuffer psIndices) {
nglMatrixIndexusvARB(size, psIndices, psIndices.position());
public static void glMatrixIndexuARB(ShortBuffer psIndices) {
nglMatrixIndexusvARB(psIndices.remaining(), psIndices, psIndices.position());
}
private static native void nglMatrixIndexusvARB(int size, ShortBuffer psIndices, int psIndices_offset);
public static void glMultiDrawArraysEXT(int mode, IntBuffer piFirst, IntBuffer piCount, int primcount) {
nglMultiDrawArraysEXT(mode, piFirst, piFirst.position(), piCount, piCount.position(), primcount);
public static void glMultiDrawArraysEXT(int mode, IntBuffer piFirst, IntBuffer piCount) {
assert piFirst.remaining() == piCount.remaining(): "piFirst.remaining() != piCount.remaining()";
nglMultiDrawArraysEXT(mode, piFirst, piFirst.position(), piCount, piCount.position(), piFirst.remaining());
}
private static native void nglMultiDrawArraysEXT(int mode, IntBuffer piFirst, int piFirst_offset, IntBuffer piCount, int piCount_offset, int primcount);
@ -766,16 +768,16 @@ public class GL extends CoreGL14 implements GLConstants {
private static native void nglMultTransposeMatrixfARB(FloatBuffer pfMtx, int pfMtx_offset);
public static int glNewObjectBufferATI(int size, ByteBuffer pPointer, int usage) {
return nglNewObjectBufferATI(size, pPointer, pPointer.position(), usage);
return nglNewObjectBufferATI(size, pPointer, pPointer != null ? pPointer.position() : 0, usage);
}
public static int glNewObjectBufferATI(int size, ShortBuffer pPointer, int usage) {
return nglNewObjectBufferATI(size, pPointer, pPointer.position()<<1, usage);
return nglNewObjectBufferATI(size, pPointer, pPointer != null ? pPointer.position()<<1 : 0, usage);
}
public static int glNewObjectBufferATI(int size, FloatBuffer pPointer, int usage) {
return nglNewObjectBufferATI(size, pPointer, pPointer.position()<<2, usage);
return nglNewObjectBufferATI(size, pPointer, pPointer != null ? pPointer.position()<<2 : 0, usage);
}
public static int glNewObjectBufferATI(int size, IntBuffer pPointer, int usage) {
return nglNewObjectBufferATI(size, pPointer, pPointer.position()<<2, usage);
return nglNewObjectBufferATI(size, pPointer, pPointer != null ? pPointer.position()<<2 : 0, usage);
}
private static native int nglNewObjectBufferATI(int size, Buffer pPointer, int pPointer_offset, int usage);
@ -843,13 +845,13 @@ public class GL extends CoreGL14 implements GLConstants {
}
private static native void nglProgramParameters4fvNV(int target, int index, int num, FloatBuffer pfParams, int pfParams_offset);
public static void glProgramStringARB(int target, int format, int len, ByteBuffer pString) {
nglProgramStringARB(target, format, len, pString, pString.position());
public static void glProgramStringARB(int target, int format, ByteBuffer pString) {
nglProgramStringARB(target, format, pString.remaining(), pString, pString.position());
}
private static native void nglProgramStringARB(int target, int format, int len, Buffer pString, int pString_offset);
public static void glRequestResidentProgramsNV(int n, IntBuffer piIDs) {
nglRequestResidentProgramsNV(n, piIDs, piIDs.position());
public static void glRequestResidentProgramsNV(IntBuffer piIDs) {
nglRequestResidentProgramsNV(piIDs.remaining(), piIDs, piIDs.position());
}
private static native void nglRequestResidentProgramsNV(int n, IntBuffer piIDs, int piIDs_offset);
@ -945,17 +947,17 @@ public class GL extends CoreGL14 implements GLConstants {
public static native void glUnlockArraysEXT();
public static void glUpdateObjectBufferATI(int buffer, int offset, int size, ByteBuffer pPointer, int preserve) {
nglUpdateObjectBufferATI(buffer, offset, size, pPointer, pPointer.position(), preserve);
public static void glUpdateObjectBufferATI(int buffer, int offset, ByteBuffer pPointer, int preserve) {
nglUpdateObjectBufferATI(buffer, offset, pPointer.remaining(), pPointer, pPointer.position(), preserve);
}
public static void glUpdateObjectBufferATI(int buffer, int offset, int size, ShortBuffer pPointer, int preserve) {
nglUpdateObjectBufferATI(buffer, offset, size, pPointer, pPointer.position()<<1, preserve);
public static void glUpdateObjectBufferATI(int buffer, int offset, ShortBuffer pPointer, int preserve) {
nglUpdateObjectBufferATI(buffer, offset, pPointer.remaining()<<1, pPointer, pPointer.position()<<1, preserve);
}
public static void glUpdateObjectBufferATI(int buffer, int offset, int size, FloatBuffer pPointer, int preserve) {
nglUpdateObjectBufferATI(buffer, offset, size, pPointer, pPointer.position()<<2, preserve);
public static void glUpdateObjectBufferATI(int buffer, int offset, FloatBuffer pPointer, int preserve) {
nglUpdateObjectBufferATI(buffer, offset, pPointer.remaining()<<2, pPointer, pPointer.position()<<2, preserve);
}
public static void glUpdateObjectBufferATI(int buffer, int offset, int size, IntBuffer pPointer, int preserve) {
nglUpdateObjectBufferATI(buffer, offset, size, pPointer, pPointer.position()<<2, preserve);
public static void glUpdateObjectBufferATI(int buffer, int offset, IntBuffer pPointer, int preserve) {
nglUpdateObjectBufferATI(buffer, offset, pPointer.remaining()<<2, pPointer, pPointer.position()<<2, preserve);
}
private static native void nglUpdateObjectBufferATI(int buffer, int offset, int size, Buffer pPointer, int pPointer_offset, int preserve);
@ -1016,7 +1018,7 @@ public class GL extends CoreGL14 implements GLConstants {
private static native void nglVariantusvEXT(int id, ShortBuffer psAddr, int psAddr_offset);
public static void glVertexArrayRangeNV(ByteBuffer pPointer) {
nglVertexArrayRangeNV(pPointer.capacity(), pPointer, pPointer.position());
nglVertexArrayRangeNV(pPointer.remaining(), pPointer, pPointer.position());
}
private static native void nglVertexArrayRangeNV(int size, Buffer pPointer, int pPointer_offset);
@ -1174,48 +1176,48 @@ public class GL extends CoreGL14 implements GLConstants {
}
private static native void nglVertexAttribPointerNV(int index, int size, int type, int stride, Buffer pPointer, int pPointer_offset);
public static void glVertexAttribs1NV(int index, int n, FloatBuffer pfV) {
nglVertexAttribs1fvNV(index, n, pfV, pfV.position());
public static void glVertexAttribs1NV(int index, FloatBuffer pfV) {
nglVertexAttribs1fvNV(index, pfV.remaining(), pfV, pfV.position());
}
private static native void nglVertexAttribs1fvNV(int index, int n, FloatBuffer pfV, int pfV_offset);
public static void glVertexAttribs1NV(int index, int n, ShortBuffer psV) {
nglVertexAttribs1svNV(index, n, psV, psV.position());
public static void glVertexAttribs1NV(int index, ShortBuffer psV) {
nglVertexAttribs1svNV(index, psV.remaining(), psV, psV.position());
}
private static native void nglVertexAttribs1svNV(int index, int n, ShortBuffer psV, int psV_offset);
public static void glVertexAttribs2NV(int index, int n, FloatBuffer pfV) {
nglVertexAttribs2fvNV(index, n, pfV, pfV.position());
public static void glVertexAttribs2NV(int index, FloatBuffer pfV) {
nglVertexAttribs2fvNV(index, pfV.remaining()>>1, pfV, pfV.position());
}
private static native void nglVertexAttribs2fvNV(int index, int n, FloatBuffer pfV, int pfV_offset);
public static void glVertexAttribs2NV(int index, int n, ShortBuffer psV) {
nglVertexAttribs2svNV(index, n, psV, psV.position());
public static void glVertexAttribs2NV(int index, ShortBuffer psV) {
nglVertexAttribs2svNV(index, psV.remaining()>>1, psV, psV.position());
}
private static native void nglVertexAttribs2svNV(int index, int n, ShortBuffer psV, int psV_offset);
public static void glVertexAttribs3NV(int index, int n, FloatBuffer pfV) {
nglVertexAttribs3fvNV(index, n, pfV, pfV.position());
public static void glVertexAttribs3NV(int index, FloatBuffer pfV) {
nglVertexAttribs3fvNV(index, pfV.remaining()/3, pfV, pfV.position());
}
private static native void nglVertexAttribs3fvNV(int index, int n, FloatBuffer pfV, int pfV_offset);
public static void glVertexAttribs3NV(int index, int n, ShortBuffer psV) {
nglVertexAttribs3svNV(index, n, psV, psV.position());
public static void glVertexAttribs3NV(int index, ShortBuffer psV) {
nglVertexAttribs3svNV(index, psV.remaining()/3, psV, psV.position());
}
private static native void nglVertexAttribs3svNV(int index, int n, ShortBuffer psV, int psV_offset);
public static void glVertexAttribs4NV(int index, int n, FloatBuffer pfV) {
nglVertexAttribs4fvNV(index, n, pfV, pfV.position());
public static void glVertexAttribs4NV(int index, FloatBuffer pfV) {
nglVertexAttribs4fvNV(index, pfV.remaining()>>2, pfV, pfV.position());
}
private static native void nglVertexAttribs4fvNV(int index, int n, FloatBuffer pfV, int pfV_offset);
public static void glVertexAttribs4NV(int index, int n, ShortBuffer psV) {
nglVertexAttribs4svNV(index, n, psV, psV.position());
public static void glVertexAttribs4NV(int index, ShortBuffer psV) {
nglVertexAttribs4svNV(index, psV.remaining()>>2, psV, psV.position());
}
private static native void nglVertexAttribs4svNV(int index, int n, ShortBuffer psV, int psV_offset);
public static void glVertexAttribs4uNV(int index, int n, ByteBuffer pV) {
nglVertexAttribs4ubvNV(index, n, pV, pV.position());
public static void glVertexAttribs4uNV(int index, ByteBuffer pV) {
nglVertexAttribs4ubvNV(index, pV.remaining()>>2, pV, pV.position());
}
private static native void nglVertexAttribs4ubvNV(int index, int n, ByteBuffer pV, int pV_offset);
@ -1265,18 +1267,18 @@ public class GL extends CoreGL14 implements GLConstants {
}
private static native void nglVertexWeightPointerEXT(int size, int type, int stride, Buffer pPointer, int pPointer_offset);
public static void glWeightARB(int size, ByteBuffer pWeights) {
nglWeightbvARB(size, pWeights, pWeights.position());
public static void glWeightARB(ByteBuffer pWeights) {
nglWeightbvARB(pWeights.remaining(), pWeights, pWeights.position());
}
private static native void nglWeightbvARB(int size, ByteBuffer pWeights, int pWeights_offset);
public static void glWeightARB(int size, FloatBuffer pfWeights) {
nglWeightfvARB(size, pfWeights, pfWeights.position());
nglWeightfvARB(pfWeights.remaining(), pfWeights, pfWeights.position());
}
private static native void nglWeightfvARB(int size, FloatBuffer pfWeights, int pfWeights_offset);
public static void glWeightARB(int size, IntBuffer piWeights) {
nglWeightivARB(size, piWeights, piWeights.position());
public static void glWeightARB(IntBuffer piWeights) {
nglWeightivARB(piWeights.remaining(), piWeights, piWeights.position());
}
private static native void nglWeightivARB(int size, IntBuffer piWeights, int piWeights_offset);
@ -1294,23 +1296,23 @@ public class GL extends CoreGL14 implements GLConstants {
}
private static native void nglWeightPointerARB(int size, int type, int stride, Buffer pPointer, int pPointer_offset);
public static void glWeightARB(int size, ShortBuffer psWeights) {
nglWeightsvARB(size, psWeights, psWeights.position());
public static void glWeightARB(ShortBuffer psWeights) {
nglWeightsvARB(psWeights.remaining(), psWeights, psWeights.position());
}
private static native void nglWeightsvARB(int size, ShortBuffer psWeights, int psWeights_offset);
public static void glWeightuARB(int size, ByteBuffer pWeights) {
nglWeightubvARB(size, pWeights, pWeights.position());
public static void glWeightuARB(ByteBuffer pWeights) {
nglWeightubvARB(pWeights.remaining(), pWeights, pWeights.position());
}
private static native void nglWeightubvARB(int size, ByteBuffer pWeights, int pWeights_offset);
public static void glWeightuARB(int size, IntBuffer piWeights) {
nglWeightuivARB(size, piWeights, piWeights.position());
public static void glWeightuARB(IntBuffer piWeights) {
nglWeightuivARB(piWeights.remaining(), piWeights, piWeights.position());
}
private static native void nglWeightuivARB(int size, IntBuffer piWeights, int piWeights_offset);
public static void glWeightuARB(int size, ShortBuffer psWeights) {
nglWeightusvARB(size, psWeights, psWeights.position());
public static void glWeightuARB(ShortBuffer psWeights) {
nglWeightusvARB(psWeights.remaining(), psWeights, psWeights.position());
}
private static native void nglWeightusvARB(int size, ShortBuffer psWeights, int psWeights_offset);
@ -1443,52 +1445,52 @@ public class GL extends CoreGL14 implements GLConstants {
int outW);
public static native void glBindBufferARB(int target, int buffer);
public static void glDeleteBuffersARB(int n, IntBuffer buffers) {
nglDeleteBuffersARB(n, buffers, buffers.position());
public static void glDeleteBuffersARB(IntBuffer buffers) {
nglDeleteBuffersARB(buffers.remaining(), buffers, buffers.position());
}
private static native void nglDeleteBuffersARB(int n, IntBuffer buffers, int buffers_offset);
public static void glGenBuffersARB(int n, IntBuffer buffers) {
nglGenBuffersARB(n, buffers, buffers.position());
public static void glGenBuffersARB(IntBuffer buffers) {
nglGenBuffersARB(buffers.remaining(), buffers, buffers.position());
}
private static native void nglGenBuffersARB(int n, IntBuffer buffers, int buffers_offset);
public static native boolean glIsBufferARB(int buffer);
public static void glBufferDataARB(int target, int size, ByteBuffer data, int usage) {
nglBufferDataARB(target, size, data, data.position(), usage);
nglBufferDataARB(target, size, data, data != null ? data.position() : 0, usage);
}
public static void glBufferDataARB(int target, int size, ShortBuffer data, int usage) {
nglBufferDataARB(target, size, data, data.position()<<1, usage);
nglBufferDataARB(target, size, data, data != null ? data.position()<<1 : 0, usage);
}
public static void glBufferDataARB(int target, int size, FloatBuffer data, int usage) {
nglBufferDataARB(target, size, data, data.position()<<2, usage);
nglBufferDataARB(target, size, data, data != null ? data.position()<<2 : 0, usage);
}
public static void glBufferDataARB(int target, int size, IntBuffer data, int usage) {
nglBufferDataARB(target, size, data, data.position()<<2, usage);
nglBufferDataARB(target, size, data, data != null ? data.position()<<2 : 0, usage);
}
private static native void nglBufferDataARB(int target, int size, Buffer data, int data_offset, int usage);
public static void glBufferSubDataARB(int target, int offset, int size, ByteBuffer data) {
nglBufferSubDataARB(target, offset, size, data, data.position());
public static void glBufferSubDataARB(int target, int offset, ByteBuffer data) {
nglBufferSubDataARB(target, offset, data.remaining(), data, data.position());
}
public static void glBufferSubDataARB(int target, int offset, int size, ShortBuffer data) {
nglBufferSubDataARB(target, offset, size, data, data.position()<<1);
public static void glBufferSubDataARB(int target, int offset, ShortBuffer data) {
nglBufferSubDataARB(target, offset, data.remaining()<<1, data, data.position()<<1);
}
public static void glBufferSubDataARB(int target, int offset, int size, FloatBuffer data) {
nglBufferSubDataARB(target, offset, size, data, data.position()<<2);
public static void glBufferSubDataARB(int target, int offset, FloatBuffer data) {
nglBufferSubDataARB(target, offset, data.remaining()<<2, data, data.position()<<2);
}
public static void glBufferSubDataARB(int target, int offset, int size, IntBuffer data) {
nglBufferSubDataARB(target, offset, size, data, data.position()<<2);
public static void glBufferSubDataARB(int target, int offset, IntBuffer data) {
nglBufferSubDataARB(target, offset, data.remaining()<<2, data, data.position()<<2);
}
private static native void nglBufferSubDataARB(int target, int offset, int size, Buffer data, int data_offset);
public static void glGetBufferSubDataARB(int target, int offset, int size, ByteBuffer data) {
nglGetBufferSubDataARB(target, offset, size, data, data.position());
public static void glGetBufferSubDataARB(int target, int offset, ByteBuffer data) {
nglGetBufferSubDataARB(target, offset, data.remaining(), data, data.position());
}
public static void glGetBufferSubDataARB(int target, int offset, int size, ShortBuffer data) {
nglGetBufferSubDataARB(target, offset, size, data, data.position()<<1);
public static void glGetBufferSubDataARB(int target, int offset, ShortBuffer data) {
nglGetBufferSubDataARB(target, offset, data.remaining()<<1, data, data.position()<<1);
}
public static void glGetBufferSubDataARB(int target, int offset, int size, IntBuffer data) {
nglGetBufferSubDataARB(target, offset, size, data, data.position()<<2);
public static void glGetBufferSubDataARB(int target, int offset, IntBuffer data) {
nglGetBufferSubDataARB(target, offset, data.remaining()<<2, data, data.position()<<2);
}
public static void glGetBufferSubDataARB(int target, int offset, int size, FloatBuffer data) {
nglGetBufferSubDataARB(target, offset, size, data, data.position()<<2);
public static void glGetBufferSubDataARB(int target, int offset, FloatBuffer data) {
nglGetBufferSubDataARB(target, offset, data.remaining()<<2, data, data.position()<<2);
}
private static native void nglGetBufferSubDataARB(int target, int offset, int size, Buffer data, int data_offset);
/**

View File

@ -133,7 +133,7 @@ public class Grass {
byte_buf.order(ByteOrder.nativeOrder());
GLCaps.determineAvailableExtensions();
System.out.println("Vertex program supported: " + GLCaps.GL_NV_vertex_program);
GL.glGenProgramsNV(1, byte_buf.asIntBuffer());
GL.glGenProgramsNV(byte_buf.asIntBuffer());
IntBuffer int_buf = byte_buf.asIntBuffer();
if (int_buf.get(0) == 0)
throw new RuntimeException("Could not allocate new vertex program id!");
@ -148,7 +148,6 @@ public class Grass {
GL.glLoadProgramNV(
GL.GL_VERTEX_PROGRAM_NV,
program_handle,
program_buf.remaining(),
program_buf);
/*gl.getIntegerv(GL.PROGRAM_ERROR_POSITION_NV, Sys.getDirectBufferAddress(int_buf));
System.out.println("error position: " + int_buf.get(0));*/

View File

@ -341,7 +341,7 @@ public class PbufferTest {
private void destroyTexture() {
IntBuffer buffer = ByteBuffer.allocateDirect(4).order(ByteOrder.nativeOrder()).asIntBuffer();
buffer.put(0, tex_handle);
GL.glDeleteTextures(1, buffer);
GL.glDeleteTextures(buffer);
}
/**
@ -400,7 +400,7 @@ public class PbufferTest {
GL.glEnable(GL.GL_TEXTURE_2D);
// Create shared texture
IntBuffer buffer = ByteBuffer.allocateDirect(4).order(ByteOrder.nativeOrder()).asIntBuffer();
GL.glGenTextures(1, buffer);
GL.glGenTextures(buffer);
tex_handle = buffer.get(0);
GL.glBindTexture(GL.GL_TEXTURE_2D, tex_handle);
GL.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_WRAP_S, GL.GL_CLAMP);

View File

@ -186,12 +186,12 @@ public final class VBOTest {
System.exit(1);
}
IntBuffer int_buffer = ByteBuffer.allocateDirect(4).order(ByteOrder.nativeOrder()).asIntBuffer();
GL.glGenBuffersARB(1, int_buffer);
GL.glGenBuffersARB(int_buffer);
buffer_id = int_buffer.get(0);
GL.glBindBufferARB(GL.GL_ARRAY_BUFFER_ARB, buffer_id);
vertices = ByteBuffer.allocateDirect(2*4*4).order(ByteOrder.nativeOrder()).asFloatBuffer();
vertices.put(-50).put(-50).put(50).put(-50).put(50).put(50).put(-50).put(50);
GL.glBufferDataARB(GL.GL_ARRAY_BUFFER_ARB, 2*4*4, Sys.NULL, GL.GL_STREAM_DRAW_ARB);
GL.glBufferDataARB(GL.GL_ARRAY_BUFFER_ARB, 2*4*4, (ByteBuffer)null, GL.GL_STREAM_DRAW_ARB);
ByteBuffer index_buffer = Sys.createIndexBuffer(0);
GL.glEnableClientState(GL.GL_VERTEX_ARRAY);
GL.glVertexPointer(2, 0, index_buffer.asFloatBuffer());
@ -206,8 +206,8 @@ public final class VBOTest {
*/
private static void cleanup() {
IntBuffer int_buffer = ByteBuffer.allocateDirect(4).order(ByteOrder.nativeOrder()).asIntBuffer();
int_buffer.put(buffer_id);
GL.glDeleteBuffersARB(1, int_buffer);
int_buffer.put(0, buffer_id);
GL.glDeleteBuffersARB(int_buffer);
Keyboard.destroy();
Mouse.destroy();
gl.destroy();

View File

@ -18,17 +18,8 @@ extern "C" {
#define org_lwjgl_Sys_REALTIME_PRIORITY 2L
/* Inaccessible static: LIBRARY_NAME */
/* Inaccessible static: DEBUG */
/* Inaccessible static: NULL */
/* Inaccessible static: _debug */
/* Inaccessible static: class_00024org_00024lwjgl_00024Sys */
/*
* Class: org_lwjgl_Sys
* Method: nGetNULLValue
* Signature: ()Ljava/nio/ByteBuffer;
*/
JNIEXPORT jobject JNICALL Java_org_lwjgl_Sys_nGetNULLValue
(JNIEnv *, jclass);
/*
* Class: org_lwjgl_Sys
* Method: createIndexBuffer

View File

@ -7,6 +7,8 @@
#ifdef __cplusplus
extern "C" {
#endif
/* Inaccessible static: _00024assertionsDisabled */
/* Inaccessible static: class_00024org_00024lwjgl_00024opengl_00024CoreGL14 */
/*
* Class: org_lwjgl_opengl_CoreGL14
* Method: glFogCoordf

View File

@ -47,7 +47,14 @@
#include "extgl.h"
#include "checkGLerror.h"
static inline jobject newBuffer(JNIEnv *env, void *p, int size) {
static inline void * safeGetBufferAddress(JNIEnv *env, jobject buffer) {
if (buffer == NULL)
return NULL;
else
return env->GetDirectBufferAddress(buffer);
}
static inline jobject safeNewBuffer(JNIEnv *env, void *p, int size) {
if (p == NULL)
return NULL;
else
@ -1368,7 +1375,7 @@ JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_GL_glGetVariantPointerEXT(JNIEnv
void *address;
glGetVariantPointervEXT((GLuint) p0, (GLuint) p1, &address);
CHECK_GL_ERROR
return newBuffer(env, address, size);
return safeNewBuffer(env, address, size);
}
/*
@ -1429,7 +1436,7 @@ JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_GL_glGetVertexAttribPointerARB(J
void *address;
glGetVertexAttribPointervARB((GLuint) p0, (GLuint) p1, &address);
CHECK_GL_ERROR
return newBuffer(env, address, size);
return safeNewBuffer(env, address, size);
}
/*
@ -1442,7 +1449,7 @@ JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_GL_glGetVertexAttribPointerNV(JN
void *address;
glGetVertexAttribPointervNV((GLuint) p0, (GLuint) p1, &address);
CHECK_GL_ERROR
return newBuffer(env, address, size);
return safeNewBuffer(env, address, size);
}
/*
@ -1812,7 +1819,7 @@ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_GL_nglMultTransposeMatrixfARB(JNIEn
JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_GL_nglNewObjectBufferATI(JNIEnv * env, jclass clazz, jint p0, jobject buffer, jint buffer_offset, jint p2)
{
CHECK_EXISTS(glNewObjectBufferATI)
const GLubyte *address = (const GLubyte *)env->GetDirectBufferAddress(buffer);
const GLubyte *address = (const GLubyte *)safeGetBufferAddress(env, buffer);
jint ret = (jint) glNewObjectBufferATI((GLint) p0, address + buffer_offset, (GLuint) p2);
CHECK_GL_ERROR
return ret;
@ -3063,7 +3070,7 @@ JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_GL_glXAllocateMemoryNV(JNIEnv *
#ifdef _X11
CHECK_EXISTS(glXAllocateMemoryNV)
void *mem_address = glXAllocateMemoryNV((GLint) size, (GLfloat) p1, (GLfloat) p2, (GLfloat) p3);
return newBuffer(env, mem_address, size);
return safeNewBuffer(env, mem_address, size);
#else
CHECK_EXISTS(NULL)
return 0;
@ -3093,7 +3100,7 @@ JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_GL_wglAllocateMemoryNV(JNIEnv *
#ifdef _WIN32
CHECK_EXISTS(wglAllocateMemoryNV)
void *mem_address = wglAllocateMemoryNV((GLint) size, (GLfloat) p1, (GLfloat) p2, (GLfloat) p3);
return newBuffer(env, mem_address, size);
return safeNewBuffer(env, mem_address, size);
#else
CHECK_EXISTS(NULL)
return 0;
@ -3590,7 +3597,7 @@ JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_GL_glIsBufferARB(JNIEnv *env, j
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_GL_nglBufferDataARB(JNIEnv *env, jclass clazz, jint target, jint size, jobject buffer, jint usage, jint buffer_offset)
{
CHECK_EXISTS(glBufferDataARB)
const GLvoid *address = (const GLvoid *)env->GetDirectBufferAddress(buffer);
const GLvoid *address = (const GLvoid *)safeGetBufferAddress(env, buffer);
glBufferDataARB((GLenum)target, (GLsizeiptrARB)size, address, (GLenum)usage + buffer_offset);
CHECK_GL_ERROR
}
@ -3636,7 +3643,7 @@ JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_GL_glMapBufferARB(JNIEnv *env, j
if (old_buffer_address == buffer_address)
return old_buffer;
}
return newBuffer(env, buffer_address, size);
return safeNewBuffer(env, buffer_address, size);
}
/*
@ -3676,5 +3683,5 @@ JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_GL_glGetBufferPointerARB(JNIEnv
void *pointer;
glGetBufferPointervARB((GLenum)target, (GLenum)pname, &pointer);
CHECK_GL_ERROR
return newBuffer(env, pointer, size);
return safeNewBuffer(env, pointer, size);
}

View File

@ -7,6 +7,8 @@
#ifdef __cplusplus
extern "C" {
#endif
/* Inaccessible static: _00024assertionsDisabled */
/* Inaccessible static: class_00024org_00024lwjgl_00024opengl_00024GL */
/*
* Class: org_lwjgl_opengl_GL
* Method: glActiveStencilFaceEXT

View File

@ -53,12 +53,12 @@ long int hires_timer; // Hires timer current time
* Method: nGetNULLValue
* Signature: ()I
*/
JNIEXPORT jobject JNICALL Java_org_lwjgl_Sys_nGetNULLValue
/*JNIEXPORT jobject JNICALL Java_org_lwjgl_Sys_nGetNULLValue
(JNIEnv *env, jclass clazz)
{
return env->NewDirectByteBuffer(NULL, 0);
}
*/
/*
* Class: org_lwjgl_Sys
* Method: createIndexBuffer

View File

@ -54,12 +54,12 @@ __int64 hires_timer; // Hires timer current time
* Method: nGetNULLValue
* Signature: ()I
*/
JNIEXPORT jobject JNICALL Java_org_lwjgl_Sys_nGetNULLValue
/*JNIEXPORT jobject JNICALL Java_org_lwjgl_Sys_nGetNULLValue
(JNIEnv *env, jclass clazz)
{
return env->NewDirectByteBuffer(NULL, 0);
}
*/
/*
* Class: org_lwjgl_Sys
* Method: createIndexBuffer