From 769b17ac6ebc5ae49fe37eba13d43fea77fdfd40 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Tue, 8 Nov 2011 23:52:28 +0100 Subject: 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) --- src/jogl/classes/com/jogamp/opengl/util/GLBuffers.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/jogl/classes/com/jogamp/opengl') 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<