aboutsummaryrefslogtreecommitdiffstats
path: root/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/org/jogamp/java3d/Jogl2es2DEPPipeline.java157
-rw-r--r--src/main/java/org/jogamp/java3d/Jogl2es2Pipeline.java592
2 files changed, 661 insertions, 88 deletions
diff --git a/src/main/java/org/jogamp/java3d/Jogl2es2DEPPipeline.java b/src/main/java/org/jogamp/java3d/Jogl2es2DEPPipeline.java
index 5310827..b242c26 100644
--- a/src/main/java/org/jogamp/java3d/Jogl2es2DEPPipeline.java
+++ b/src/main/java/org/jogamp/java3d/Jogl2es2DEPPipeline.java
@@ -26,20 +26,20 @@ import java.nio.FloatBuffer;
/**
* Separated from the actual pipeline for clarity of features that are not supported from the
- * Pipeline class for the JOGL rendering pipeline.
+ * Pipeline class for the JOGL2ES2 rendering pipeline.
*/
abstract class Jogl2es2DEPPipeline extends Pipeline
{
public static final String VALID_FORMAT_MESSAGE = "The Gl2ES2 pipeline only supports a subset of the Geometry data types and formats. \n"//
- + "You can now only pass in a TriangleArray, TriangleStripArray, TriangleFanArray, \n"//
- + "LineArray, LineStripArray, PointArray and the 6 Indexed equivilents (effectively QuadArray is removed). \n"//
- + "Each Geometry must have a format of GeometryArray.BY_REFERENCE = true and GeometryArray.INTERLEAVED = false. \n"//
- + "For non-indexed Geometry the format must also be GeometryArray.USE_NIO_BUFFER = true. \n"//
- + "Texture Coordinate generation is not supported, Texture Filter, Sharpen and combine are not supported. \n"//
- + "Texture3D, TextureCubeMap are not supported. \n"//
+ + "You cannot use QuadArray or IndexedQuadArray. \n"//
+ + "Texture Coordinate generation is not supported. \n" //
+ + "Texture Filter, Sharpen and combine are not supported. \n"//
+ + "Texture3D is not supported. \n"//
+ "Accum style anti-aliasing, rasters and decals are also not supported. \n"//
- + "Coordinates must be defind and float type, colors must be float type, if defined. \n"//
+ + "Coordinates must be defined and float type, colors must be float type, if defined. \n"//
+ "It is strongly recomended that you use the format GeometryArray.USE_NIO_BUFFER = true. \n"//
+ + "Use of IndexedGeometry by-copy or interleaved, by reference, Java arrays not yet implemented.\n" //
+ + "Use of IndexedGeometry interleaved, by reference, nio buffer not yet implemented.\n"//
+ "Note LineArray and LineStripArray will not render as nicely as the fixed function pipeline.";//
/**
@@ -53,33 +53,34 @@ abstract class Jogl2es2DEPPipeline extends Pipeline
// ---------------------------------------------------------------------
//
- // GeometryArrayRetained methods
+ // IndexedGeometryArrayRetained methods
//
- // used for GeometryArrays by Copy or interleaved
+ // by-copy or interleaved, by reference, Java arrays
@Override
@Deprecated
- void execute(Context ctx, GeometryArrayRetained geo, int geo_type, boolean isNonUniformScale, boolean useAlpha,
- boolean ignoreVertexColors, int startVIndex, int vcount, int vformat, int texCoordSetCount, int[] texCoordSetMap,
- int texCoordSetMapLen, int[] texUnitOffset, int numActiveTexUnitState, int vertexAttrCount, int[] vertexAttrSizes,
- float[] varray, float[] carray, int cDirty)
+ void executeIndexedGeometry(Context ctx, GeometryArrayRetained geo, int geo_type, boolean isNonUniformScale, boolean useAlpha,
+ boolean ignoreVertexColors, int initialIndexIndex, int indexCount, int vertexCount, int vformat, int vertexAttrCount,
+ int[] vertexAttrSizes, int texCoordSetCount, int[] texCoordSetMap, int texCoordSetMapLen, int[] texCoordSetOffset,
+ int numActiveTexUnitState, float[] varray, float[] carray, int cdirty, int[] indexCoord)
{
throw new UnsupportedOperationException(
- "Use of GeometryArrays (un-indexed) by Copy or interleaved not allowed.\n" + VALID_FORMAT_MESSAGE);
+ "Use of IndexedGeometry by-copy or interleaved, by reference, Java arrays not yet implemented.\n" + VALID_FORMAT_MESSAGE);
}
- // used by GeometryArray by Reference in interleaved format with NIO buffer
+ // interleaved, by reference, nio buffer
@Override
@Deprecated
- void executeInterleavedBuffer(Context ctx, GeometryArrayRetained geo, int geo_type, boolean isNonUniformScale, boolean useAlpha,
- boolean ignoreVertexColors, int startVIndex, int vcount, int vformat, int texCoordSetCount, int[] texCoordSetMap,
- int texCoordSetMapLen, int[] texUnitOffset, int numActiveTexUnit, FloatBuffer varray, float[] cdata, int cdirty)
+ void executeIndexedGeometryBuffer(Context ctx, GeometryArrayRetained geo, int geo_type, boolean isNonUniformScale, boolean useAlpha,
+ boolean ignoreVertexColors, int initialIndexIndex, int indexCount, int vertexCount, int vformat, int texCoordSetCount,
+ int[] texCoordSetMap, int texCoordSetMapLen, int[] texCoordSetOffset, int numActiveTexUnitState, FloatBuffer vdata,
+ float[] carray, int cDirty, int[] indexCoord)
{
throw new UnsupportedOperationException(
- "Use of GeometryArray (un-indexed) by Reference in interleaved format with NIO buffer.\n" + VALID_FORMAT_MESSAGE);
+ "Use of IndexedGeometry interleaved, by reference, nio buffer not yet implemented.\n" + VALID_FORMAT_MESSAGE);
}
- // used for GeometryArrays (PJ - I presume this means DList usage?)
+ // used for GeometryArrays (this means DisplayList usage)
@Override
@Deprecated
void buildGA(Context ctx, GeometryArrayRetained geo, int geo_type, boolean isNonUniformScale, boolean updateAlpha, float alpha,
@@ -87,10 +88,12 @@ abstract class Jogl2es2DEPPipeline extends Pipeline
int texCoordSetMapLen, int[] texCoordSetMapOffset, int vertexAttrCount, int[] vertexAttrSizes, double[] xform, double[] nxform,
float[] varray)
{
- throw new UnsupportedOperationException("DLists in use!.\n" + VALID_FORMAT_MESSAGE);
+ throw new UnsupportedOperationException("DisplayLists in use!. When using the gl2es2pipeline you should can use \n"
+ + "System.setProperty(\"j3d.displaylist\", \"false\"); to avoid this issue. \n"
+ + "Please note the recommended solution is to use NIO buffers. \n" + VALID_FORMAT_MESSAGE);
}
- // used to Build Dlist GeometryArray by Reference with java arrays
+ // used to Build DisplayList GeometryArray by Reference with java arrays
@Override
@Deprecated
void buildGAForByRef(Context ctx, GeometryArrayRetained geo, int geo_type, boolean isNonUniformScale, boolean updateAlpha, float alpha,
@@ -99,39 +102,12 @@ abstract class Jogl2es2DEPPipeline extends Pipeline
int[] vertexAttrSizes, int[] vertexAttrIndices, float[][] vertexAttrData, int texCoordMapLength, int[] tcoordsetmap,
int[] texIndices, int texStride, Object[] texCoords, double[] xform, double[] nxform)
{
- throw new UnsupportedOperationException("DLists in use!.\n" + VALID_FORMAT_MESSAGE);
- }
-
- // ---------------------------------------------------------------------
-
- //
- // IndexedGeometryArrayRetained methods
- //
-
- // by-copy or interleaved, by reference, Java arrays
- @Override
- @Deprecated
- void executeIndexedGeometry(Context ctx, GeometryArrayRetained geo, int geo_type, boolean isNonUniformScale, boolean useAlpha,
- boolean ignoreVertexColors, int initialIndexIndex, int indexCount, int vertexCount, int vformat, int vertexAttrCount,
- int[] vertexAttrSizes, int texCoordSetCount, int[] texCoordSetMap, int texCoordSetMapLen, int[] texCoordSetOffset,
- int numActiveTexUnitState, float[] varray, float[] carray, int cdirty, int[] indexCoord)
- {
- throw new UnsupportedOperationException(
- "Use of IndexedGeometry by-copy or interleaved, by reference, Java arrays.\n" + VALID_FORMAT_MESSAGE);
- }
-
- // interleaved, by reference, nio buffer
- @Override
- @Deprecated
- void executeIndexedGeometryBuffer(Context ctx, GeometryArrayRetained geo, int geo_type, boolean isNonUniformScale, boolean useAlpha,
- boolean ignoreVertexColors, int initialIndexIndex, int indexCount, int vertexCount, int vformat, int texCoordSetCount,
- int[] texCoordSetMap, int texCoordSetMapLen, int[] texCoordSetOffset, int numActiveTexUnitState, FloatBuffer vdata,
- float[] carray, int cDirty, int[] indexCoord)
- {
- throw new UnsupportedOperationException("Use of IndexedGeometry interleaved, by reference, nio buffer.\n" + VALID_FORMAT_MESSAGE);
+ throw new UnsupportedOperationException("DisplayLists in use!. When using the gl2es2pipeline you should can use \n"
+ + "System.setProperty(\"j3d.displaylist\", \"false\"); to avoid this issue. \n"
+ + "Please note the recommended solution is to use NIO buffers. \n" + VALID_FORMAT_MESSAGE);
}
- //PJ presume the word build means a draw list?
+ //DisplayList usage
// by-copy geometry
@Override
@Deprecated
@@ -140,7 +116,8 @@ abstract class Jogl2es2DEPPipeline extends Pipeline
int vertexAttrCount, int[] vertexAttrSizes, int texCoordSetCount, int[] texCoordSetMap, int texCoordSetMapLen,
int[] texCoordSetMapOffset, double[] xform, double[] nxform, float[] varray, int[] indexCoord)
{
- throw new UnsupportedOperationException("DLists in use!.\n" + VALID_FORMAT_MESSAGE);
+ throw new UnsupportedOperationException("DLists in use!. When using the gl2es2pipeline you should also use \n"
+ + "System.setProperty(\"j3d.displaylist\", \"false\"); to avoid this issue. \n" + VALID_FORMAT_MESSAGE);
}
// ---------------------------------------------------------------------
@@ -233,21 +210,21 @@ abstract class Jogl2es2DEPPipeline extends Pipeline
@Deprecated
void updateTexture2DLodOffset(Context ctx, float lodOffsetS, float lodOffsetT, float lodOffsetR)
{
- throw new UnsupportedOperationException("Not supported in the GL2ES2 pipeline.\n" + VALID_FORMAT_MESSAGE);
+ throw new UnsupportedOperationException("Texture2DLodOffset not supported in the GL2ES2 pipeline.\n" + VALID_FORMAT_MESSAGE);
}
@Override
@Deprecated
void updateTexture2DSharpenFunc(Context ctx, int numSharpenTextureFuncPts, float[] sharpenTextureFuncPts)
{
- throw new UnsupportedOperationException("Not supported in the GL2ES2 pipeline.\n" + VALID_FORMAT_MESSAGE);
+ throw new UnsupportedOperationException("Texture2DSharpenFunc not supported in the GL2ES2 pipeline.\n" + VALID_FORMAT_MESSAGE);
}
@Override
@Deprecated
void updateTexture2DFilter4Func(Context ctx, int numFilter4FuncPts, float[] filter4FuncPts)
{
- throw new UnsupportedOperationException("Not supported in the GL2ES2 pipeline.\n" + VALID_FORMAT_MESSAGE);
+ throw new UnsupportedOperationException("Texture2DFilter4Func not supported in the GL2ES2 pipeline.\n" + VALID_FORMAT_MESSAGE);
}
// ---------------------------------------------------------------------
@@ -259,7 +236,7 @@ abstract class Jogl2es2DEPPipeline extends Pipeline
@Deprecated
void bindTexture3D(Context ctx, int objectId, boolean enable)
{
- throw new UnsupportedOperationException("Not supported in the GL2ES2 pipeline.\n" + VALID_FORMAT_MESSAGE);
+ throw new UnsupportedOperationException("Texture3D not supported in the GL2ES2 pipeline.\n" + VALID_FORMAT_MESSAGE);
}
@Override
@@ -267,7 +244,7 @@ abstract class Jogl2es2DEPPipeline extends Pipeline
void updateTexture3DImage(Context ctx, int numLevels, int level, int textureFormat, int imageFormat, int width, int height, int depth,
int boundaryWidth, int dataType, Object data, boolean useAutoMipMap)
{
- throw new UnsupportedOperationException("Not supported in the GL2ES2 pipeline.\n" + VALID_FORMAT_MESSAGE);
+ throw new UnsupportedOperationException("Texture3D not supported in the GL2ES2 pipeline.\n" + VALID_FORMAT_MESSAGE);
}
@Override
@@ -276,21 +253,21 @@ abstract class Jogl2es2DEPPipeline extends Pipeline
int imgXOffset, int imgYOffset, int imgZOffset, int tilew, int tileh, int width, int height, int depth, int dataType,
Object data, boolean useAutoMipMap)
{
- throw new UnsupportedOperationException("Not supported in the GL2ES2 pipeline.\n" + VALID_FORMAT_MESSAGE);
+ throw new UnsupportedOperationException("Texture3D not supported in the GL2ES2 pipeline.\n" + VALID_FORMAT_MESSAGE);
}
@Override
@Deprecated
void updateTexture3DLodRange(Context ctx, int baseLevel, int maximumLevel, float minimumLod, float maximumLod)
{
- throw new UnsupportedOperationException("Not supported in the GL2ES2 pipeline.\n" + VALID_FORMAT_MESSAGE);
+ throw new UnsupportedOperationException("Texture3D not supported in the GL2ES2 pipeline.\n" + VALID_FORMAT_MESSAGE);
}
@Override
@Deprecated
void updateTexture3DLodOffset(Context ctx, float lodOffsetS, float lodOffsetT, float lodOffsetR)
{
- throw new UnsupportedOperationException("Not supported in the GL2ES2 pipeline.\n" + VALID_FORMAT_MESSAGE);
+ throw new UnsupportedOperationException("Texture3D not supported in the GL2ES2 pipeline.\n" + VALID_FORMAT_MESSAGE);
}
@Override
@@ -298,35 +275,35 @@ abstract class Jogl2es2DEPPipeline extends Pipeline
void updateTexture3DBoundary(Context ctx, int boundaryModeS, int boundaryModeT, int boundaryModeR, float boundaryRed,
float boundaryGreen, float boundaryBlue, float boundaryAlpha)
{
- throw new UnsupportedOperationException("Not supported in the GL2ES2 pipeline.\n" + VALID_FORMAT_MESSAGE);
+ throw new UnsupportedOperationException("Texture3D not supported in the GL2ES2 pipeline.\n" + VALID_FORMAT_MESSAGE);
}
@Override
@Deprecated
void updateTexture3DFilterModes(Context ctx, int minFilter, int magFilter)
{
- throw new UnsupportedOperationException("Not supported in the GL2ES2 pipeline.\n" + VALID_FORMAT_MESSAGE);
+ throw new UnsupportedOperationException("Texture3D not supported in the GL2ES2 pipeline.\n" + VALID_FORMAT_MESSAGE);
}
@Override
@Deprecated
void updateTexture3DSharpenFunc(Context ctx, int numSharpenTextureFuncPts, float[] sharpenTextureFuncPts)
{
- throw new UnsupportedOperationException("Not supported in the GL2ES2 pipeline.\n" + VALID_FORMAT_MESSAGE);
+ throw new UnsupportedOperationException("Texture3D not supported in the GL2ES2 pipeline.\n" + VALID_FORMAT_MESSAGE);
}
@Override
@Deprecated
void updateTexture3DFilter4Func(Context ctx, int numFilter4FuncPts, float[] filter4FuncPts)
{
- throw new UnsupportedOperationException("Not supported in the GL2ES2 pipeline.\n" + VALID_FORMAT_MESSAGE);
+ throw new UnsupportedOperationException("Texture3D not supported in the GL2ES2 pipeline.\n" + VALID_FORMAT_MESSAGE);
}
@Override
@Deprecated
void updateTexture3DAnisotropicFilter(Context ctx, float degree)
{
- throw new UnsupportedOperationException("Not supported in the GL2ES2 pipeline.\n" + VALID_FORMAT_MESSAGE);
+ throw new UnsupportedOperationException("Texture3D not supported in the GL2ES2 pipeline.\n" + VALID_FORMAT_MESSAGE);
}
// ---------------------------------------------------------------------
@@ -338,21 +315,21 @@ abstract class Jogl2es2DEPPipeline extends Pipeline
@Deprecated
void updateTextureCubeMapLodOffset(Context ctx, float lodOffsetS, float lodOffsetT, float lodOffsetR)
{
- throw new UnsupportedOperationException("Not supported in the GL2ES2 pipeline.\n" + VALID_FORMAT_MESSAGE);
+ throw new UnsupportedOperationException("TextureCubeMapLodOffset not supported in the GL2ES2 pipeline.\n" + VALID_FORMAT_MESSAGE);
}
@Override
@Deprecated
void updateTextureCubeMapSharpenFunc(Context ctx, int numSharpenTextureFuncPts, float[] sharpenTextureFuncPts)
{
- throw new UnsupportedOperationException("Not supported in the GL2ES2 pipeline.\n" + VALID_FORMAT_MESSAGE);
+ throw new UnsupportedOperationException("TextureCubeMapSharpenFunc not supported in the GL2ES2 pipeline.\n" + VALID_FORMAT_MESSAGE);
}
@Override
@Deprecated
void updateTextureCubeMapFilter4Func(Context ctx, int numFilter4FuncPts, float[] filter4FuncPts)
{
- throw new UnsupportedOperationException("Not supported in the GL2ES2 pipeline.\n" + VALID_FORMAT_MESSAGE);
+ throw new UnsupportedOperationException("TextureCubeMapFilter4Func not supported in the GL2ES2 pipeline.\n" + VALID_FORMAT_MESSAGE);
}
// ---------------------------------------------------------------------
@@ -366,42 +343,42 @@ abstract class Jogl2es2DEPPipeline extends Pipeline
@Deprecated
void accum(Context ctx, float value)
{
- throw new UnsupportedOperationException("Not supported in the GL2ES2 pipeline.\n" + VALID_FORMAT_MESSAGE);
+ throw new UnsupportedOperationException("accum not supported in the GL2ES2 pipeline.\n" + VALID_FORMAT_MESSAGE);
}
@Override
@Deprecated
void accumReturn(Context ctx)
{
- throw new UnsupportedOperationException("Not supported in the GL2ES2 pipeline.\n" + VALID_FORMAT_MESSAGE);
+ throw new UnsupportedOperationException("accum not supported in the GL2ES2 pipeline.\n" + VALID_FORMAT_MESSAGE);
}
@Override
@Deprecated
void clearAccum(Context ctx)
{
- throw new UnsupportedOperationException("Not supported in the GL2ES2 pipeline.\n" + VALID_FORMAT_MESSAGE);
+ throw new UnsupportedOperationException("accum not supported in the GL2ES2 pipeline.\n" + VALID_FORMAT_MESSAGE);
}
@Override
@Deprecated
boolean decal1stChildSetup(Context ctx)
{
- throw new UnsupportedOperationException("Not supported in the GL2ES2 pipeline.\n" + VALID_FORMAT_MESSAGE);
+ throw new UnsupportedOperationException("decal not supported in the GL2ES2 pipeline.\n" + VALID_FORMAT_MESSAGE);
}
@Override
@Deprecated
void decalNthChildSetup(Context ctx)
{
- throw new UnsupportedOperationException("Not supported in the GL2ES2 pipeline.\n" + VALID_FORMAT_MESSAGE);
+ throw new UnsupportedOperationException("decal not supported in the GL2ES2 pipeline.\n" + VALID_FORMAT_MESSAGE);
}
@Override
@Deprecated
void decalReset(Context ctx, boolean depthBufferEnable)
{
- throw new UnsupportedOperationException("Not supported in the GL2ES2 pipeline.\n" + VALID_FORMAT_MESSAGE);
+ throw new UnsupportedOperationException("decal not supported in the GL2ES2 pipeline.\n" + VALID_FORMAT_MESSAGE);
}
// The following three methods are used in multi-pass case
@@ -411,7 +388,7 @@ abstract class Jogl2es2DEPPipeline extends Pipeline
void textureFillBackground(Context ctx, float texMinU, float texMaxU, float texMinV, float texMaxV, float mapMinX, float mapMaxX,
float mapMinY, float mapMaxY, boolean useBilinearFilter)
{
- throw new UnsupportedOperationException("Not supported in the GL2ES2 pipeline.\n" + VALID_FORMAT_MESSAGE);
+ throw new UnsupportedOperationException("textureFillBackground not supported in the GL2ES2 pipeline.\n" + VALID_FORMAT_MESSAGE);
}
@@ -421,7 +398,7 @@ abstract class Jogl2es2DEPPipeline extends Pipeline
float mapMinY, float mapMaxY, float mapZ, float alpha, boolean useBilinearFilter)
{
- throw new UnsupportedOperationException("Not supported in the GL2ES2 pipeline.\n" + VALID_FORMAT_MESSAGE);
+ throw new UnsupportedOperationException("textureFillRaster not supported in the GL2ES2 pipeline.\n" + VALID_FORMAT_MESSAGE);
}
@Override
@@ -429,7 +406,7 @@ abstract class Jogl2es2DEPPipeline extends Pipeline
void executeRasterDepth(Context ctx, float posX, float posY, float posZ, int srcOffsetX, int srcOffsetY, int rasterWidth,
int rasterHeight, int depthWidth, int depthHeight, int depthFormat, Object depthData)
{
- throw new UnsupportedOperationException("Not supported in the GL2ES2 pipeline.\n" + VALID_FORMAT_MESSAGE);
+ throw new UnsupportedOperationException("executeRasterDepth not supported in the GL2ES2 pipeline.\n" + VALID_FORMAT_MESSAGE);
}
@@ -438,28 +415,36 @@ abstract class Jogl2es2DEPPipeline extends Pipeline
@Deprecated
void newDisplayList(Context ctx, int displayListId)
{
- throw new UnsupportedOperationException("Not supported in the GL2ES2 pipeline.\n" + VALID_FORMAT_MESSAGE);
+ throw new UnsupportedOperationException("DisplayLists in use!. When using the gl2es2pipeline you should can use \n"
+ + "System.setProperty(\"j3d.displaylist\", \"false\"); to avoid this issue. \n"
+ + "Please note the recommended solution is to use NIO buffers. \n" + VALID_FORMAT_MESSAGE);
}
@Override
@Deprecated
void endDisplayList(Context ctx)
{
- throw new UnsupportedOperationException("Not supported in the GL2ES2 pipeline.\n" + VALID_FORMAT_MESSAGE);
+ throw new UnsupportedOperationException("DisplayLists in use!. When using the gl2es2pipeline you should can use \n"
+ + "System.setProperty(\"j3d.displaylist\", \"false\"); to avoid this issue. \n"
+ + "Please note the recommended solution is to use NIO buffers. \n" + VALID_FORMAT_MESSAGE);
}
@Override
@Deprecated
void callDisplayList(Context ctx, int id, boolean isNonUniformScale)
{
- throw new UnsupportedOperationException("Not supported in the GL2ES2 pipeline.\n" + VALID_FORMAT_MESSAGE);
+ throw new UnsupportedOperationException("DisplayLists in use!. When using the gl2es2pipeline you should can use \n"
+ + "System.setProperty(\"j3d.displaylist\", \"false\"); to avoid this issue. \n"
+ + "Please note the recommended solution is to use NIO buffers. \n" + VALID_FORMAT_MESSAGE);
}
@Override
@Deprecated
void freeDisplayList(Context ctx, int id)
{
- throw new UnsupportedOperationException("Not supported in the GL2ES2 pipeline.\n" + VALID_FORMAT_MESSAGE);
+ throw new UnsupportedOperationException("DisplayLists in use!. When using the gl2es2pipeline you should can use \n"
+ + "System.setProperty(\"j3d.displaylist\", \"false\"); to avoid this issue. \n"
+ + "Please note the recommended solution is to use NIO buffers. \n" + VALID_FORMAT_MESSAGE);
}
@Override
@@ -468,7 +453,7 @@ abstract class Jogl2es2DEPPipeline extends Pipeline
void texturemapping(Context ctx, int px, int py, int minX, int minY, int maxX, int maxY, int texWidth, int texHeight, int rasWidth,
int format, int objectId, byte[] imageYdown, int winWidth, int winHeight)
{
- throw new UnsupportedOperationException("Not supported in the GL2ES2 pipeline.\n" + VALID_FORMAT_MESSAGE);
+ throw new UnsupportedOperationException("texturemapping not supported in the GL2ES2 pipeline.\n" + VALID_FORMAT_MESSAGE);
}
@Override
@@ -476,6 +461,6 @@ abstract class Jogl2es2DEPPipeline extends Pipeline
// nothing seems to call this in Canvas3D either
boolean initTexturemapping(Context ctx, int texWidth, int texHeight, int objectId)
{
- throw new UnsupportedOperationException("Not supported in the GL2ES2 pipeline.\n" + VALID_FORMAT_MESSAGE);
+ throw new UnsupportedOperationException("texturemapping not supported in the GL2ES2 pipeline.\n" + VALID_FORMAT_MESSAGE);
}
}
diff --git a/src/main/java/org/jogamp/java3d/Jogl2es2Pipeline.java b/src/main/java/org/jogamp/java3d/Jogl2es2Pipeline.java
index 4052552..58d3af0 100644
--- a/src/main/java/org/jogamp/java3d/Jogl2es2Pipeline.java
+++ b/src/main/java/org/jogamp/java3d/Jogl2es2Pipeline.java
@@ -93,11 +93,13 @@ import com.jogamp.opengl.Threading;
*/
class Jogl2es2Pipeline extends Jogl2es2DEPPipeline
{
- private static final boolean DO_OUTPUT_ERRORS = false;
+ private static final boolean DO_OUTPUT_ERRORS = true;
// Currently prints for entry points already implemented
static final boolean VERBOSE = false;
// Debugging output for graphics configuration selection
private static final boolean DEBUG_CONFIG = false;
+ // Prints extra debugging information
+ private static final boolean EXTRA_DEBUGGING = false;
private static final boolean OUTPUT_PER_FRAME_STATS = false;
@@ -230,6 +232,490 @@ class Jogl2es2Pipeline extends Jogl2es2DEPPipeline
}
}
+ // ---------------------------------------------------------------------
+
+ //
+ // GeometryArrayRetained methods
+ //
+
+ // used for GeometryArrays by Copy or interleaved
+ @Override
+ void execute(Context ctx, GeometryArrayRetained geo, int geo_type, boolean isNonUniformScale, boolean useAlpha,
+ boolean ignoreVertexColors, int startVIndex, int vcount, int vformat, int texCoordSetCount, int[] texCoordSetMap,
+ int texCoordSetMapLen, int[] texUnitOffset, int numActiveTexUnitState, int vertexAttrCount, int[] vertexAttrSizes,
+ float[] varray, float[] carray, int cDirty)
+ {
+ if (VERBOSE)
+ System.err.println("JoglPipeline.execute()");
+
+ executeGeometryArray(ctx, geo, geo_type, isNonUniformScale, useAlpha, ignoreVertexColors, startVIndex, vcount, vformat,
+ texCoordSetCount, texCoordSetMap, texCoordSetMapLen, texUnitOffset, numActiveTexUnitState, vertexAttrCount, vertexAttrSizes,
+ varray, null, carray, cDirty);
+ }
+
+ // used by GeometryArray by Reference in interleaved format with NIO buffer
+ @Override
+ void executeInterleavedBuffer(Context ctx, GeometryArrayRetained geo, int geo_type, boolean isNonUniformScale, boolean useAlpha,
+ boolean ignoreVertexColors, int startVIndex, int vcount, int vformat, int texCoordSetCount, int[] texCoordSetMap,
+ int texCoordSetMapLen, int[] texUnitOffset, int numActiveTexUnit, FloatBuffer varray, float[] cdata, int cdirty)
+ {
+ if (VERBOSE)
+ System.err.println("JoglPipeline.executeInterleavedBuffer()");
+
+ executeGeometryArray(ctx, geo, geo_type, isNonUniformScale, useAlpha, ignoreVertexColors, startVIndex, vcount, vformat,
+ texCoordSetCount, texCoordSetMap, texCoordSetMapLen, texUnitOffset, numActiveTexUnit, 0, null, null, varray, cdata, cdirty);
+ }
+
+ private void executeGeometryArray(Context absCtx, GeometryArrayRetained geo, int geo_type, boolean isNonUniformScale, boolean useAlpha,
+ boolean ignoreVertexColors, int startVIndex, int vcount, int vformat, int texCoordSetCount, int[] texCoordSetMap,
+ int texCoordSetMapLen, int[] texCoordSetMapOffset, int numActiveTexUnitState, int vertexAttrCount, int[] vertexAttrSizes,
+ float[] varray, FloatBuffer varrayBuffer, float[] carray, int cDirty)
+ {
+ if (VERBOSE)
+ System.err.println("JoglPipeline.executeGeometryArray()");
+
+ Jogl2es2Context ctx = (Jogl2es2Context) absCtx;
+ int shaderProgramId = ctx.shaderProgramId;
+
+ if (shaderProgramId != -1)
+ {
+ GL2ES2 gl = ctx.gl2es2();
+ ProgramData pd = ctx.programData;
+ LocationData locs = pd.programToLocationData;
+
+ setFFPAttributes(ctx, gl, shaderProgramId, pd, vformat);
+
+ int stride = 0, coordoff = 0, normoff = 0, coloroff = 0, texCoordoff = 0;
+ int texSize = 0, texStride = 0;
+ int vAttrOff = 0;
+ int vAttrStride = 0;
+ int bstride = 0, cbstride = 0;
+ FloatBuffer verts = null;
+ FloatBuffer clrs = null;
+ int[] sarray = null;
+ int[] start_array = null;
+
+ if (EXTRA_DEBUGGING)
+ {
+ System.err.println("Vertex format: " + getVertexDescription(vformat));
+ System.err.println("Geometry type: " + getGeometryDescription(geo_type));
+ if (carray != null)
+ {
+ System.err.println(" Separate color array");
+ }
+ else
+ {
+ System.err.println(" Colors (if any) interleaved");
+ }
+ }
+
+ if ((vformat & GeometryArray.COORDINATES) != 0)
+ {
+ stride += 3;
+ }
+ if ((vformat & GeometryArray.NORMALS) != 0)
+ {
+ stride += 3;
+ coordoff += 3;
+ }
+ if ((vformat & GeometryArray.COLOR) != 0)
+ {
+ if ((vformat & GeometryArray.WITH_ALPHA) != 0)
+ {
+ stride += 4;
+ normoff += 4;
+ coordoff += 4;
+ }
+ else
+ { /* Handle the case of executeInterleaved 3f */
+ stride += 3;
+ normoff += 3;
+ coordoff += 3;
+ }
+ }
+ if ((vformat & GeometryArray.TEXTURE_COORDINATE) != 0)
+ {
+ if (EXTRA_DEBUGGING)
+ {
+ System.err.println(" Number of tex coord sets: " + texCoordSetCount);
+ }
+ if ((vformat & GeometryArray.TEXTURE_COORDINATE_2) != 0)
+ {
+ texSize = 2;
+ texStride = 2 * texCoordSetCount;
+ }
+ else if ((vformat & GeometryArray.TEXTURE_COORDINATE_3) != 0)
+ {
+ texSize = 3;
+ texStride = 3 * texCoordSetCount;
+ }
+ else if ((vformat & GeometryArray.TEXTURE_COORDINATE_4) != 0)
+ {
+ texSize = 4;
+ texStride = 4 * texCoordSetCount;
+ }
+ stride += texStride;
+ normoff += texStride;
+ coloroff += texStride;
+ coordoff += texStride;
+ }
+ if ((vformat & GeometryArray.VERTEX_ATTRIBUTES) != 0)
+ {
+ for (int i = 0; i < vertexAttrCount; i++)
+ {
+ vAttrStride += vertexAttrSizes[i];
+ }
+ stride += vAttrStride;
+ normoff += vAttrStride;
+ coloroff += vAttrStride;
+ coordoff += vAttrStride;
+ texCoordoff += vAttrStride;
+ }
+
+ bstride = stride * Buffers.SIZEOF_FLOAT;
+
+ if (geo_type == GeometryRetained.GEO_TYPE_TRI_STRIP_SET || geo_type == GeometryRetained.GEO_TYPE_TRI_FAN_SET
+ || geo_type == GeometryRetained.GEO_TYPE_LINE_STRIP_SET)
+ {
+ sarray = ((GeometryStripArrayRetained) geo).stripVertexCounts;
+ start_array = ((GeometryStripArrayRetained) geo).stripStartOffsetIndices;
+ }
+
+ // We have to copy if the data isn't specified using NIO
+ if (varray != null)
+ {
+ verts = getVertexArrayBuffer(varray);
+ }
+ else if (varrayBuffer != null)
+ {
+ verts = varrayBuffer;
+ }
+ else
+ {
+ // This should never happen
+ throw new AssertionError("Unable to get vertex pointer");
+ }
+
+ // using byRef interleaved array and has a separate pointer, then ..
+ int cstride = stride;
+ if (carray != null)
+ {
+ clrs = getColorArrayBuffer(carray);
+ cstride = 4;
+ }
+ else
+ {
+ // FIXME: need to "auto-slice" this buffer later
+ clrs = verts;
+ }
+
+ cbstride = cstride * Buffers.SIZEOF_FLOAT;
+
+ int startVertex = stride * startVIndex;
+ int startClrs = cstride * startVIndex;
+ if (clrs == verts)
+ {
+ startClrs += coloroff;
+ }
+
+
+ if (EXTRA_DEBUGGING) {
+ System.err.println(" startVertex: " + startVertex);
+ System.err.println(" stride: " + stride);
+ System.err.println(" bstride: " + bstride);
+ System.err.println(" normoff: " + normoff);
+ System.err.println(" coloroff: " + coloroff);
+ System.err.println(" coordoff: " + coordoff);
+ System.err.println(" texCoordoff: " + texCoordoff);
+ }
+
+ GeometryData gd = loadAllBuffers(ctx, gl, geo, ignoreVertexColors, vcount, vformat, vformat, verts, startVertex, clrs,
+ startClrs);
+
+ // not required second time around for VAO (except morphable coords)
+ boolean bindingRequired = true;
+ if (ctx.gl2es3() != null)
+ {
+ if (gd.vaoId == -1)
+ {
+ int[] tmp = new int[1];
+ ctx.gl2es3().glGenVertexArrays(1, tmp, 0);
+ gd.vaoId = tmp[0];
+ if (DO_OUTPUT_ERRORS)
+ outputErrors(ctx);
+ }
+ else
+ {
+ bindingRequired = false;
+ }
+ ctx.gl2es3().glBindVertexArray(gd.vaoId);
+ if (DO_OUTPUT_ERRORS)
+ outputErrors(ctx);
+ }
+
+ if (bindingRequired)
+ {
+ // always do coords
+ gl.glBindBuffer(GL2ES2.GL_ARRAY_BUFFER, gd.geoToCoordBuf);
+ gl.glVertexAttribPointer(locs.glVertex, 3, GL2ES2.GL_FLOAT, false, bstride,
+ (startVertex + coordoff) * Buffers.SIZEOF_FLOAT);
+ gl.glEnableVertexAttribArray(locs.glVertex);
+
+ if (DO_OUTPUT_ERRORS)
+ outputErrors(ctx);
+
+ if (OUTPUT_PER_FRAME_STATS)
+ ctx.perFrameStats.glVertexAttribPointerCoord++;
+ if (OUTPUT_PER_FRAME_STATS)
+ ctx.perFrameStats.coordCount += gd.geoToCoordBufSize;
+
+ if (((vformat & GeometryArray.COLOR) != 0) && locs.glColor != -1 && !ignoreVertexColors)
+ {
+ if (gd.geoToColorBuf == -1)
+ {
+ new Throwable("Buffer load issue!").printStackTrace();
+ }
+ else
+ {
+ int sz = ((vformat & GeometryArray.WITH_ALPHA) != 0) ? 4 : 3;
+
+ gl.glBindBuffer(GL2ES2.GL_ARRAY_BUFFER, gd.geoToColorBuf);
+ gl.glVertexAttribPointer(locs.glColor, sz, GL2ES2.GL_FLOAT, false, cbstride,
+ (startVertex + coloroff) * Buffers.SIZEOF_FLOAT);
+ gl.glEnableVertexAttribArray(locs.glColor);
+ if (DO_OUTPUT_ERRORS)
+ outputErrors(ctx);
+
+ if (OUTPUT_PER_FRAME_STATS)
+ ctx.perFrameStats.glVertexAttribPointerColor++;
+ }
+ }
+ else if (locs.glColor != -1)
+ {
+ // ignoreVertexcolors will have been set in FFP now as the glColors is unbound
+ gl.glDisableVertexAttribArray(locs.glColor);
+ if (OUTPUT_PER_FRAME_STATS)
+ ctx.perFrameStats.glDisableVertexAttribArray++;
+ }
+
+ if (((vformat & GeometryArray.NORMALS) != 0) && locs.glNormal != -1)
+ {
+ if (gd.geoToCoordBuf == -1)
+ {
+ new Throwable("Buffer load issue!").printStackTrace();
+ }
+ else
+ {
+ gl.glBindBuffer(GL2ES2.GL_ARRAY_BUFFER, gd.geoToCoordBuf);
+ gl.glVertexAttribPointer(locs.glNormal, 3, GL2ES2.GL_FLOAT, false, bstride,
+ (startVertex + normoff) * Buffers.SIZEOF_FLOAT);
+ gl.glEnableVertexAttribArray(locs.glNormal);
+ if (DO_OUTPUT_ERRORS)
+ outputErrors(ctx);
+
+ if (OUTPUT_PER_FRAME_STATS)
+ ctx.perFrameStats.glVertexAttribPointerNormals++;
+ }
+ }
+ else
+ {
+ if (locs.glNormal != -1)
+ {
+ gl.glDisableVertexAttribArray(locs.glNormal);
+ if (OUTPUT_PER_FRAME_STATS)
+ ctx.perFrameStats.glDisableVertexAttribArray++;
+ }
+ }
+
+ if ((vformat & GeometryArray.VERTEX_ATTRIBUTES) != 0)
+ {
+
+ int vAttrOffset = startVertex + vAttrOff;
+ for (int index = 0; index < vertexAttrCount; index++)
+ {
+ Integer attribLoc = locs.genAttIndexToLoc.get(index);
+ if (attribLoc != null && attribLoc.intValue() != -1)
+ {
+ int sz = vertexAttrSizes[index];
+
+ gl.glBindBuffer(GL2ES2.GL_ARRAY_BUFFER, gd.geoToCoordBuf);
+ gl.glVertexAttribPointer(attribLoc.intValue(), sz, GL2ES2.GL_FLOAT, false, bstride,
+ (startVertex + vAttrOffset) * Buffers.SIZEOF_FLOAT);
+ gl.glEnableVertexAttribArray(attribLoc.intValue());
+ vAttrOffset += vertexAttrSizes[index];
+ if (DO_OUTPUT_ERRORS)
+ outputErrors(ctx);
+
+ if (OUTPUT_PER_FRAME_STATS)
+ ctx.perFrameStats.glVertexAttribPointerUserAttribs++;
+
+ }
+ }
+ }
+
+ if ((vformat & GeometryArray.TEXTURE_COORDINATE) != 0)
+ {
+ boolean[] texSetsBound = new boolean[texCoordSetMapLen];
+ for (int texUnit = 0; texUnit < numActiveTexUnitState && texUnit < texCoordSetMapLen; texUnit++)
+ {
+ int texSet = texCoordSetMap[texUnit];
+ if (texSet != -1 && locs.glMultiTexCoord[texSet] != -1 && !texSetsBound[texSet])
+ {
+ texSetsBound[texSet] = true;
+ gl.glBindBuffer(GL2ES2.GL_ARRAY_BUFFER, gd.geoToCoordBuf);
+ gl.glVertexAttribPointer(locs.glMultiTexCoord[texUnit], texSize, GL2ES2.GL_FLOAT, true, bstride,
+ (startVertex + texCoordoff + texCoordSetMapOffset[texUnit]) * Buffers.SIZEOF_FLOAT);
+ gl.glEnableVertexAttribArray(locs.glMultiTexCoord[texUnit]);
+ if (DO_OUTPUT_ERRORS)
+ outputErrors(ctx);
+
+ if (OUTPUT_PER_FRAME_STATS)
+ ctx.perFrameStats.enableTexCoordPointer++;
+
+ }
+ }
+
+ }
+ if (DO_OUTPUT_ERRORS)
+ outputErrors(ctx);
+ }
+
+ //////////////////////////////////////////////
+
+ if (geo_type == GeometryRetained.GEO_TYPE_TRI_STRIP_SET || geo_type == GeometryRetained.GEO_TYPE_TRI_FAN_SET
+ || geo_type == GeometryRetained.GEO_TYPE_LINE_STRIP_SET)
+ {
+ int primType = 0;
+
+ //FIXME: GL_LINE and GL_LINE_STRIP simply go from one vertex to the next drawing a line between
+ // each pair, what I want is a line between each set of 3 (that are not jumpers)
+
+ if (ctx.polygonMode == PolygonAttributes.POLYGON_LINE)
+ geo_type = GeometryRetained.GEO_TYPE_LINE_STRIP_SET;
+
+ switch (geo_type)
+ {
+ case GeometryRetained.GEO_TYPE_TRI_STRIP_SET:
+ primType = GL2ES2.GL_TRIANGLE_STRIP;
+ break;
+ case GeometryRetained.GEO_TYPE_TRI_FAN_SET:
+ primType = GL2ES2.GL_TRIANGLE_FAN;
+ break;
+ case GeometryRetained.GEO_TYPE_LINE_STRIP_SET:
+ primType = GL2ES2.GL_LINE_LOOP;
+ break;
+ }
+
+ for (int i = 0; i < sarray.length; i++)
+ {
+ if (sarray[i] > 0)
+ {
+ gl.glDrawArrays(primType, start_array[i], sarray[i]);
+ if (DO_OUTPUT_ERRORS)
+ outputErrors(ctx);
+ if (OUTPUT_PER_FRAME_STATS)
+ ctx.perFrameStats.glDrawStripArraysStrips++;
+ }
+ }
+ if (OUTPUT_PER_FRAME_STATS)
+ ctx.perFrameStats.glDrawStripArrays++;
+ }
+ else
+ {
+ //need to override if polygonAttributes says so
+
+ if (ctx.polygonMode == PolygonAttributes.POLYGON_LINE)
+ geo_type = GeometryRetained.GEO_TYPE_LINE_SET;
+ else if (ctx.polygonMode == PolygonAttributes.POLYGON_POINT)
+ geo_type = GeometryRetained.GEO_TYPE_POINT_SET;
+
+ switch (geo_type)
+ {
+ case GeometryRetained.GEO_TYPE_QUAD_SET:
+ throw new UnsupportedOperationException("QuadArray.\n" + VALID_FORMAT_MESSAGE);
+ case GeometryRetained.GEO_TYPE_TRI_SET:
+ gl.glDrawArrays(GL2ES2.GL_TRIANGLES, 0, vcount);
+ break;
+ case GeometryRetained.GEO_TYPE_POINT_SET:
+ gl.glDrawArrays(GL2ES2.GL_POINTS, 0, vcount);
+ break;
+ case GeometryRetained.GEO_TYPE_LINE_SET:
+ gl.glDrawArrays(GL2ES2.GL_LINES, 0, vcount);
+ break;
+ }
+ if (DO_OUTPUT_ERRORS)
+ outputErrors(ctx);
+
+ if (OUTPUT_PER_FRAME_STATS)
+ ctx.perFrameStats.glDrawArrays++;
+ }
+ }
+ else
+
+ {
+ if (!NO_PROGRAM_WARNING_GIVEN)
+ System.err.println("Execute called with no shader Program in use!");
+ NO_PROGRAM_WARNING_GIVEN = true;
+ }
+
+ if (DO_OUTPUT_ERRORS)
+
+ outputErrors(ctx);
+
+ }
+
+ //----------------------------------------------------------------------
+ // Private helper methods for GeometryArrayRetained
+ //
+
+
+ private static String getVertexDescription(int vformat)
+ {
+ String res = "";
+ if ((vformat & GeometryArray.COORDINATES) != 0)
+ res += "COORDINATES ";
+ if ((vformat & GeometryArray.NORMALS) != 0)
+ res += "NORMALS ";
+ if ((vformat & GeometryArray.COLOR) != 0)
+ res += "COLOR ";
+ if ((vformat & GeometryArray.WITH_ALPHA) != 0)
+ res += "(WITH_ALPHA) ";
+ if ((vformat & GeometryArray.TEXTURE_COORDINATE) != 0)
+ res += "TEXTURE_COORDINATE ";
+ if ((vformat & GeometryArray.TEXTURE_COORDINATE_2) != 0)
+ res += "(2) ";
+ if ((vformat & GeometryArray.TEXTURE_COORDINATE_3) != 0)
+ res += "(3) ";
+ if ((vformat & GeometryArray.TEXTURE_COORDINATE_4) != 0)
+ res += "(4) ";
+ if ((vformat & GeometryArray.VERTEX_ATTRIBUTES) != 0)
+ res += "VERTEX_ATTRIBUTES ";
+ return res;
+ }
+
+ private static String getGeometryDescription(int geo_type)
+ {
+ switch (geo_type)
+ {
+ case GeometryRetained.GEO_TYPE_TRI_STRIP_SET:
+ return "GEO_TYPE_TRI_STRIP_SET";
+ case GeometryRetained.GEO_TYPE_TRI_FAN_SET:
+ return "GEO_TYPE_TRI_FAN_SET";
+ case GeometryRetained.GEO_TYPE_LINE_STRIP_SET:
+ return "GEO_TYPE_LINE_STRIP_SET";
+ case GeometryRetained.GEO_TYPE_QUAD_SET:
+ return "GEO_TYPE_QUAD_SET";
+ case GeometryRetained.GEO_TYPE_TRI_SET:
+ return "GEO_TYPE_TRI_SET";
+ case GeometryRetained.GEO_TYPE_POINT_SET:
+ return "GEO_TYPE_POINT_SET";
+ case GeometryRetained.GEO_TYPE_LINE_SET:
+ return "GEO_TYPE_LINE_SET";
+ default:
+ return "(unknown " + geo_type + ")";
+ }
+ }
+
// used by GeometryArray by Reference with NIO buffer
// non indexed
@@ -325,7 +811,6 @@ class Jogl2es2Pipeline extends Jogl2es2DEPPipeline
// used by GeometryArray by Reference with java arrays
// non indexed
@Override
- @Deprecated
void executeVA(Context ctx, GeometryArrayRetained geo, int geo_type, boolean isNonUniformScale, boolean ignoreVertexColors, int vcount,
int vformat, int vdefined, int initialCoordIndex, float[] vfcoords, double[] vdcoords, int initialColorIndex, float[] cfdata,
byte[] cbdata, int initialNormalIndex, float[] ndata, int vertexAttrCount, int[] vertexAttrSizes, int[] vertexAttrIndices,
@@ -2305,6 +2790,105 @@ class Jogl2es2Pipeline extends Jogl2es2DEPPipeline
}
private static GeometryData loadAllBuffers(Jogl2es2Context ctx, GL2ES2 gl, GeometryArrayRetained geo, boolean ignoreVertexColors,
+ int vertexCount, int vformat, int vdefined, FloatBuffer fverts, int startVertex, FloatBuffer fclrs, int startClrs)
+ {
+ if (VERBOSE)
+ System.err.println("private static GeometryData loadAllBuffers");
+
+ GeometryData gd = ctx.allGeometryData.get(geo.nativeId);
+ if (gd == null)
+ {
+ gd = new GeometryData();
+ geo.nativeId = gd.nativeId;
+ ctx.allGeometryData.put(geo.nativeId, gd);
+ }
+
+ if (gd.geoToCoordBuf == -1)
+ {
+ // can it change ever? (GeometryArray.ALLOW_REF_DATA_WRITE is just my indicator of this feature)
+ boolean morphable = geo.source.getCapability(GeometryArray.ALLOW_REF_DATA_WRITE)
+ || geo.source.getCapability(GeometryArray.ALLOW_COORDINATE_WRITE);
+
+ fverts.position(startVertex);
+
+ if (morphable)
+ {
+ int[] tmp = new int[2];
+ gl.glGenBuffers(2, tmp, 0);
+ gd.geoToCoordBuf = tmp[0];
+ gd.geoToCoordBuf1 = tmp[0];
+ gd.geoToCoordBuf2 = tmp[1];
+ gl.glBindBuffer(GL2ES2.GL_ARRAY_BUFFER, gd.geoToCoordBuf1);
+ int usage = morphable ? GL2ES2.GL_DYNAMIC_DRAW : GL2ES2.GL_STATIC_DRAW;
+ gl.glBufferData(GL2ES2.GL_ARRAY_BUFFER, (fverts.remaining() * Float.SIZE / 8), fverts, usage);
+
+ gl.glBindBuffer(GL2ES2.GL_ARRAY_BUFFER, gd.geoToCoordBuf2);
+ gl.glBufferData(GL2ES2.GL_ARRAY_BUFFER, (fverts.remaining() * Float.SIZE / 8), fverts, usage);
+ }
+ else
+ {
+ int[] tmp = new int[1];
+ gl.glGenBuffers(1, tmp, 0);
+ gd.geoToCoordBuf = tmp[0];
+
+ gl.glBindBuffer(GL2ES2.GL_ARRAY_BUFFER, gd.geoToCoordBuf);
+ int usage = morphable ? GL2ES2.GL_DYNAMIC_DRAW : GL2ES2.GL_STATIC_DRAW;
+ gl.glBufferData(GL2ES2.GL_ARRAY_BUFFER, (fverts.remaining() * Float.SIZE / 8), fverts, usage);
+ }
+ if (DO_OUTPUT_ERRORS)
+ outputErrors(ctx);
+
+ gd.geoToCoordBufSize = fverts.remaining();
+
+ if (ctx.allGeometryData.size() % 500 == 0)
+ {
+ System.out.println("Coord buffer count " + ctx.allGeometryData.size());
+ }
+
+ if (OUTPUT_PER_FRAME_STATS)
+ ctx.perFrameStats.glBufferData++;
+
+ }
+
+ if (!ignoreVertexColors)
+ {
+
+ if (gd.geoToColorBuf == -1)
+ {
+
+ if (fclrs != null)
+ {
+ if (fclrs != fverts)
+ {
+ fclrs.position(startClrs);
+ int[] tmp = new int[1];
+ gl.glGenBuffers(1, tmp, 0);
+ gd.geoToColorBuf = tmp[0];
+
+ gl.glBindBuffer(GL2ES2.GL_ARRAY_BUFFER, gd.geoToColorBuf);
+ gl.glBufferData(GL2ES2.GL_ARRAY_BUFFER, fclrs.remaining() * Float.SIZE / 8, fclrs, GL2ES2.GL_STATIC_DRAW);
+ }
+ else
+ {
+ gd.geoToColorBuf = gd.geoToCoordBuf;
+ }
+ if (DO_OUTPUT_ERRORS)
+ outputErrors(ctx);
+
+ if (OUTPUT_PER_FRAME_STATS)
+ ctx.perFrameStats.glBufferData++;
+ }
+
+ }
+ }
+
+ if (DO_OUTPUT_ERRORS)
+ outputErrors(ctx);
+
+ return gd;
+ }
+
+ private static GeometryData loadAllBuffers(Jogl2es2Context ctx, GL2ES2 gl, GeometryArrayRetained geo, boolean ignoreVertexColors,
int vertexCount, int vformat, int vdefined, FloatBuffer fverts, DoubleBuffer dverts, FloatBuffer fclrs, ByteBuffer bclrs,
FloatBuffer norms, int vertexAttrCount, int[] vertexAttrSizes, FloatBuffer[] vertexAttrBufs, int texCoordMapLength,
int[] texCoordSetMap, int texStride, Object[] texCoords)
@@ -7172,6 +7756,7 @@ class Jogl2es2Pipeline extends Jogl2es2DEPPipeline
{
buf.put(array);
buf.rewind();
+ buf.limit(array.length);
}
return buf;
}
@@ -7202,6 +7787,7 @@ class Jogl2es2Pipeline extends Jogl2es2DEPPipeline
{
buf.put(array);
buf.rewind();
+ buf.limit(array.length);
}
return buf;
}
@@ -7232,6 +7818,7 @@ class Jogl2es2Pipeline extends Jogl2es2DEPPipeline
{
buf.put(array);
buf.rewind();
+ buf.limit(array.length);
}
return buf;
}
@@ -7281,6 +7868,7 @@ class Jogl2es2Pipeline extends Jogl2es2DEPPipeline
}
buf.put(cur);
buf.rewind();
+ buf.limit(cur.length);
}
return bufs;