aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/com/jogamp
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2011-11-08 23:52:28 +0100
committerSven Gothel <[email protected]>2011-11-08 23:52:28 +0100
commit769b17ac6ebc5ae49fe37eba13d43fea77fdfd40 (patch)
treea34777b70b9d29c4ec1f68296829741721dd5124 /src/jogl/classes/com/jogamp
parent297c97d28bb3490177b5ff9441f3d6494d09b819 (diff)
OSX: SharedResource add knowledge of NPOT-, RECT- and Float-Texture features, used by pbuffer drawable before a current context.
- Also extract getNextPowerOf2() -> GLBuffers (remove redundancy)
Diffstat (limited to 'src/jogl/classes/com/jogamp')
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/GLBuffers.java13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/jogl/classes/com/jogamp/opengl/util/GLBuffers.java b/src/jogl/classes/com/jogamp/opengl/util/GLBuffers.java
index f2e742cda..62441d8b8 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/GLBuffers.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/GLBuffers.java
@@ -491,6 +491,19 @@ public class GLBuffers extends Buffers {
return sizeof(gl, tmp, elements * esize, width, height, depth, pack);
}
+
+ public static final int getNextPowerOf2(int number) {
+ if (((number-1) & number) == 0) {
+ //ex: 8 -> 0b1000; 8-1=7 -> 0b0111; 0b1000&0b0111 == 0
+ return number;
+ }
+ int power = 0;
+ while (number > 0) {
+ number = number>>1;
+ power++;
+ }
+ return (1<<power);
+ }
//----------------------------------------------------------------------
// Conversion routines