summaryrefslogtreecommitdiffstats
path: root/make/config/jogl/gl-impl-CustomJavaCode-embedded.java
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2009-10-17 13:44:12 -0700
committerSven Gothel <[email protected]>2009-10-17 13:44:12 -0700
commit4d493ac36bd5d763d2af3243e799bbaef3679594 (patch)
tree3017bab34a8824f706e3ba63f835aaffd3317222 /make/config/jogl/gl-impl-CustomJavaCode-embedded.java
parent5ae314adc19c660f26f32839b2cc224cdccfbb59 (diff)
All tracker are aggregated in the GLContext now
and used within the GL*Impl. New GLStateTracker: - Tracking client/server states - Currently supports PixelStorei - Prologued in glPixelStorei and glGetIntegerv, the latter will return the tracked state if available and not call the GL method. Impacts performance and ES1 compatibility (supports ALIGNMENT). Fixed 'imageSizeInBytes' calculation: - skipPixels and skipRows is a static one time offset
Diffstat (limited to 'make/config/jogl/gl-impl-CustomJavaCode-embedded.java')
-rw-r--r--make/config/jogl/gl-impl-CustomJavaCode-embedded.java20
1 files changed, 11 insertions, 9 deletions
diff --git a/make/config/jogl/gl-impl-CustomJavaCode-embedded.java b/make/config/jogl/gl-impl-CustomJavaCode-embedded.java
index 2d4cd1372..c803a06a4 100644
--- a/make/config/jogl/gl-impl-CustomJavaCode-embedded.java
+++ b/make/config/jogl/gl-impl-CustomJavaCode-embedded.java
@@ -3,10 +3,10 @@ private int[] imageSizeTemp = new int[1];
/** Helper for more precise computation of number of bytes that will
be touched by a pixel pack or unpack operation. */
private int imageSizeInBytes(int bytesPerElement,
- int w, int h, int d,
+ int width, int height, int depth,
int dimensions,
boolean pack) {
- int rowLength = w;
+ int rowLength;
int alignment = 1;
if (pack) {
@@ -17,10 +17,12 @@ private int imageSizeInBytes(int bytesPerElement,
alignment = imageSizeTemp[0];
}
// Try to deal somewhat correctly with potentially invalid values
- rowLength = Math.max(0, rowLength);
+ height = Math.max(0, height);
alignment = Math.max(1, alignment);
- h = Math.max(0, h);
+
+ rowLength = Math.max(0, width); // > 0 && >= width
int rowLengthInBytes = rowLength * bytesPerElement;
+
if (alignment > 1) {
int modulus = rowLengthInBytes % alignment;
if (modulus > 0) {
@@ -28,10 +30,10 @@ private int imageSizeInBytes(int bytesPerElement,
}
}
- int size = 0;
- if (dimensions == 1) {
- return rowLengthInBytes;
- } else {
- return h * rowLengthInBytes;
+ int size = height * rowLengthInBytes; // height == 1 for 1D
+ if(dimensions==3) {
+ size *= depth;
}
+
+ return size;
}