From 556d92b63555a085b25e32b1cd55afce24edd07a Mon Sep 17 00:00:00 2001
From: Sven Gothel format
cannot be handled.
*/
- public static Type determine(int format) throws IllegalArgumentException {
+ public static Type determine(final int format) throws IllegalArgumentException {
switch(format) {
case GL.GL_RGBA4:
case GL.GL_RGB5_A1:
@@ -135,7 +135,7 @@ public class FBObject {
private int name;
- protected Attachment(Type type, int iFormat, int width, int height, int name) {
+ protected Attachment(final Type type, final int iFormat, final int width, final int height, final int name) {
this.type = type;
this.format = iFormat;
this.width = width;
@@ -148,7 +148,7 @@ public class FBObject {
* @param caps the destination for format bits
* @param rgba8Avail whether rgba8 is available
*/
- public final void formatToGLCapabilities(GLCapabilities caps, boolean rgba8Avail) {
+ public final void formatToGLCapabilities(final GLCapabilities caps, final boolean rgba8Avail) {
final int _format;
switch(format) {
case GL.GL_RGBA:
@@ -224,11 +224,11 @@ public class FBObject {
public final int getWidth() { return width; }
/** height of attachment */
public final int getHeight() { return height; }
- /* pp */ final void setSize(int w, int h) { width = w; height = h; }
+ /* pp */ final void setSize(final int w, final int h) { width = w; height = h; }
/** buffer name [1..max], maybe a texture or renderbuffer name, depending on type. */
public final int getName() { return name; }
- /* pp */ final void setName(int n) { name = n; }
+ /* pp */ final void setName(final int n) { name = n; }
/**
* Initializes the attachment and set it's parameter, if uninitialized, i.e. name is zero
.
@@ -263,7 +263,7 @@ public class FBObject {
* {@inheritDoc}
*/
@Override
- public boolean equals(Object o) {
+ public boolean equals(final Object o) {
if( this == o ) return true;
if( ! ( o instanceof Attachment ) ) return false;
final Attachment a = (Attachment)o;
@@ -299,7 +299,7 @@ public class FBObject {
"; name "+toHexString(name)+", obj "+toHexString(objectHashCode())+"]";
}
- public static Type getType(int attachmentPoint, int maxColorAttachments) {
+ public static Type getType(final int attachmentPoint, final int maxColorAttachments) {
if( GL.GL_COLOR_ATTACHMENT0 <= attachmentPoint && attachmentPoint < GL.GL_COLOR_ATTACHMENT0+maxColorAttachments ) {
return Type.COLOR;
}
@@ -326,16 +326,16 @@ public class FBObject {
* @param height
* @param name
*/
- public RenderAttachment(Type type, int iFormat, int samples, int width, int height, int name) {
+ public RenderAttachment(final Type type, final int iFormat, final int samples, final int width, final int height, final int name) {
super(validateType(type), iFormat, width, height, name);
this.samples = samples;
}
/** number of samples, or zero for no multisampling */
public final int getSamples() { return samples; }
- /* pp */ final void setSamples(int s) { samples = s; }
+ /* pp */ final void setSamples(final int s) { samples = s; }
- private static Type validateType(Type type) {
+ private static Type validateType(final Type type) {
switch(type) {
case DEPTH_STENCIL:
case DEPTH:
@@ -354,7 +354,7 @@ public class FBObject {
* {@inheritDoc}
*/
@Override
- public boolean equals(Object o) {
+ public boolean equals(final Object o) {
if( this == o ) return true;
if( ! ( o instanceof RenderAttachment ) ) return false;
return super.equals(o) &&
@@ -376,7 +376,7 @@ public class FBObject {
}
@Override
- public boolean initialize(GL gl) throws GLException {
+ public boolean initialize(final GL gl) throws GLException {
final boolean init = 0 == getName();
if( init ) {
checkPreGLError(gl);
@@ -405,7 +405,7 @@ public class FBObject {
}
@Override
- public void free(GL gl) {
+ public void free(final GL gl) {
final int[] name = new int[] { getName() };
if( 0 != name[0] ) {
if(DEBUG) {
@@ -425,7 +425,7 @@ public class FBObject {
/** Color render buffer attachment */
public static class ColorAttachment extends RenderAttachment implements Colorbuffer {
- public ColorAttachment(int iFormat, int samples, int width, int height, int name) {
+ public ColorAttachment(final int iFormat, final int samples, final int width, final int height, final int name) {
super(Type.COLOR, iFormat, samples, width, height, name);
}
}
@@ -448,8 +448,8 @@ public class FBObject {
* @param wrapT
* @param name
*/
- public TextureAttachment(Type type, int iFormat, int width, int height, int dataFormat, int dataType,
- int magFilter, int minFilter, int wrapS, int wrapT, int name) {
+ public TextureAttachment(final Type type, final int iFormat, final int width, final int height, final int dataFormat, final int dataType,
+ final int magFilter, final int minFilter, final int wrapS, final int wrapT, final int name) {
super(validateType(type), iFormat, width, height, name);
this.dataFormat = dataFormat;
this.dataType = dataType;
@@ -459,7 +459,7 @@ public class FBObject {
this.wrapT = wrapT;
}
- private static Type validateType(Type type) {
+ private static Type validateType(final Type type) {
switch(type) {
case COLOR_TEXTURE:
case DEPTH_TEXTURE:
@@ -475,7 +475,7 @@ public class FBObject {
* @throws GLException if texture generation and setup fails. The just created texture name will be deleted in this case.
*/
@Override
- public boolean initialize(GL gl) throws GLException {
+ public boolean initialize(final GL gl) throws GLException {
final boolean init = 0 == getName();
if( init ) {
checkPreGLError(gl);
@@ -520,7 +520,7 @@ public class FBObject {
}
@Override
- public void free(GL gl) {
+ public void free(final GL gl) {
final int[] name = new int[] { getName() };
if( 0 != name[0] ) {
if(DEBUG) {
@@ -540,7 +540,7 @@ public class FBObject {
"; name "+toHexString(getName())+", obj "+toHexString(objectHashCode())+"]";
}
}
- static String toHexString(int v) {
+ static String toHexString(final int v) {
return "0x"+Integer.toHexString(v);
}
@@ -556,7 +556,7 @@ public class FBObject {
* @param height texture height
* @return the created and uninitialized color {@link TextureAttachment}
*/
- public static final TextureAttachment createColorTextureAttachment(GL gl, boolean alpha, int width, int height) {
+ public static final TextureAttachment createColorTextureAttachment(final GL gl, final boolean alpha, final int width, final int height) {
return createColorTextureAttachment(gl, alpha, width, height, GL.GL_NEAREST, GL.GL_NEAREST, GL.GL_CLAMP_TO_EDGE, GL.GL_CLAMP_TO_EDGE);
}
@@ -605,8 +605,8 @@ public class FBObject {
* @param wrapT if > 0 value for {@link GL#GL_TEXTURE_WRAP_T}
* @return the created and uninitialized color {@link TextureAttachment}
*/
- public static final TextureAttachment createColorTextureAttachment(GL gl, boolean alpha, int width, int height,
- int magFilter, int minFilter, int wrapS, int wrapT) {
+ public static final TextureAttachment createColorTextureAttachment(final GL gl, final boolean alpha, final int width, final int height,
+ final int magFilter, final int minFilter, final int wrapS, final int wrapT) {
final int textureInternalFormat, textureDataFormat, textureDataType;
if(gl.isGLES3()) {
textureInternalFormat = alpha ? GL.GL_RGBA8 : GL.GL_RGB8;
@@ -640,13 +640,13 @@ public class FBObject {
* @param wrapT if > 0 value for {@link GL#GL_TEXTURE_WRAP_T}
* @return the created and uninitialized color {@link TextureAttachment}
*/
- public static final TextureAttachment createColorTextureAttachment(int internalFormat, int width, int height, int dataFormat, int dataType,
- int magFilter, int minFilter, int wrapS, int wrapT) {
+ public static final TextureAttachment createColorTextureAttachment(final int internalFormat, final int width, final int height, final int dataFormat, final int dataType,
+ final int magFilter, final int minFilter, final int wrapS, final int wrapT) {
return new TextureAttachment(Type.COLOR_TEXTURE, internalFormat, width, height, dataFormat, dataType,
magFilter, minFilter, wrapS, wrapT, 0 /* name */);
}
- private static boolean hasAlpha(int format) {
+ private static boolean hasAlpha(final int format) {
switch(format) {
case GL.GL_RGBA8:
case GL.GL_RGBA4:
@@ -689,7 +689,7 @@ public class FBObject {
// ColorAttachment helper ..
//
- private final void validateColorAttachmentPointRange(int point) {
+ private final void validateColorAttachmentPointRange(final int point) {
if(!initialized) {
throw new GLException("FBO not initialized");
}
@@ -701,14 +701,14 @@ public class FBObject {
}
}
- private final void validateAddColorAttachment(int point, Colorbuffer ca) {
+ private final void validateAddColorAttachment(final int point, final Colorbuffer ca) {
validateColorAttachmentPointRange(point);
if( null != colorAttachmentPoints[point] ) {
throw new IllegalArgumentException("Cannot attach "+ca+", attachment point already in use by "+colorAttachmentPoints[point]+", "+this);
}
}
- private final void addColorAttachment(int point, Colorbuffer ca) {
+ private final void addColorAttachment(final int point, final Colorbuffer ca) {
validateColorAttachmentPointRange(point);
final Colorbuffer c = colorAttachmentPoints[point];
if( null != c && c != ca ) {
@@ -718,7 +718,7 @@ public class FBObject {
colorAttachmentCount++;
}
- private final void removeColorAttachment(int point, Colorbuffer ca) {
+ private final void removeColorAttachment(final int point, final Colorbuffer ca) {
validateColorAttachmentPointRange(point);
final Colorbuffer c = colorAttachmentPoints[point];
if( null != c && c != ca ) {
@@ -736,7 +736,7 @@ public class FBObject {
* @see #attachTexture2D(GL, int, boolean, int, int, int, int)
* @see #attachTexture2D(GL, int, int, int, int, int, int, int, int)
*/
- public final Colorbuffer getColorbuffer(int attachmentPoint) {
+ public final Colorbuffer getColorbuffer(final int attachmentPoint) {
validateColorAttachmentPointRange(attachmentPoint);
return colorAttachmentPoints[attachmentPoint];
}
@@ -750,7 +750,7 @@ public class FBObject {
* @param ca the {@link Colorbuffer} to look for.
* @return -1 if the {@link Colorbuffer} could not be found, otherwise [0..{@link #getMaxColorAttachments()}-1]
*/
- public final int getColorbufferAttachmentPoint(Colorbuffer ca) {
+ public final int getColorbufferAttachmentPoint(final Colorbuffer ca) {
for(int i=0; itrue
if you request alpha channel, otherwise false
;
* @return uninitialized ColorAttachment instance describing the new attached colorbuffer
*/
- public final ColorAttachment createColorAttachment(boolean alpha) {
+ public final ColorAttachment createColorAttachment(final boolean alpha) {
final int internalFormat;
if( rgba8Avail ) {
@@ -1282,7 +1282,7 @@ public class FBObject {
* @throws GLException in case the colorbuffer couldn't be allocated
* @see #createColorAttachment(boolean)
*/
- public final ColorAttachment attachColorbuffer(GL gl, int attachmentPoint, boolean alpha) throws GLException {
+ public final ColorAttachment attachColorbuffer(final GL gl, final int attachmentPoint, final boolean alpha) throws GLException {
return (ColorAttachment) attachColorbuffer(gl, attachmentPoint, createColorAttachment(alpha));
}
@@ -1298,7 +1298,7 @@ public class FBObject {
* @throws GLException in case the colorbuffer couldn't be allocated
* @throws IllegalArgumentException if internalFormat
doesn't reflect a colorbuffer
*/
- public final ColorAttachment attachColorbuffer(GL gl, int attachmentPoint, int internalFormat) throws GLException, IllegalArgumentException {
+ public final ColorAttachment attachColorbuffer(final GL gl, final int attachmentPoint, final int internalFormat) throws GLException, IllegalArgumentException {
final Attachment.Type atype = Attachment.Type.determine(internalFormat);
if( Attachment.Type.COLOR != atype ) {
throw new IllegalArgumentException("colorformat invalid: "+toHexString(internalFormat)+", "+this);
@@ -1326,12 +1326,12 @@ public class FBObject {
* @return newly attached {@link Colorbuffer} instance if bound and configured successfully, otherwise GLException is thrown
* @throws GLException in case the colorbuffer couldn't be allocated or MSAA has been chosen in case of a {@link TextureAttachment}
*/
- public final Colorbuffer attachColorbuffer(GL gl, int attachmentPoint, Colorbuffer colbuf) throws GLException {
+ public final Colorbuffer attachColorbuffer(final GL gl, final int attachmentPoint, final Colorbuffer colbuf) throws GLException {
bind(gl);
return attachColorbufferImpl(gl, attachmentPoint, colbuf);
}
- private final Colorbuffer attachColorbufferImpl(GL gl, int attachmentPoint, Colorbuffer colbuf) throws GLException {
+ private final Colorbuffer attachColorbufferImpl(final GL gl, final int attachmentPoint, final Colorbuffer colbuf) throws GLException {
validateAddColorAttachment(attachmentPoint, colbuf);
final boolean initializedColorbuf = colbuf.initialize(gl);
@@ -1407,7 +1407,7 @@ public class FBObject {
* @see #getDepthAttachment()
* @see #getStencilAttachment()
*/
- public final void attachRenderbuffer(GL gl, Attachment.Type atype, int reqBits) throws GLException, IllegalArgumentException {
+ public final void attachRenderbuffer(final GL gl, final Attachment.Type atype, int reqBits) throws GLException, IllegalArgumentException {
if( 0 > reqBits ) {
reqBits = 24;
}
@@ -1493,7 +1493,7 @@ public class FBObject {
* @see #getDepthAttachment()
* @see #getStencilAttachment()
*/
- public final void attachRenderbuffer(GL gl, int internalFormat) throws GLException, IllegalArgumentException {
+ public final void attachRenderbuffer(final GL gl, final int internalFormat) throws GLException, IllegalArgumentException {
final Attachment.Type atype = Attachment.Type.determine(internalFormat);
if( Attachment.Type.DEPTH != atype && Attachment.Type.STENCIL != atype && Attachment.Type.DEPTH_STENCIL != atype ) {
throw new IllegalArgumentException("renderformat invalid: "+toHexString(internalFormat)+", "+this);
@@ -1501,7 +1501,7 @@ public class FBObject {
attachRenderbufferImpl(gl, atype, internalFormat);
}
- protected final void attachRenderbufferImpl(GL gl, Attachment.Type atype, int internalFormat) throws GLException {
+ protected final void attachRenderbufferImpl(final GL gl, final Attachment.Type atype, final int internalFormat) throws GLException {
if( null != depth && ( Attachment.Type.DEPTH == atype || Attachment.Type.DEPTH_STENCIL == atype ) ) {
throw new GLException("FBO depth buffer already attached (rb "+depth+"), type is "+atype+", "+toHexString(internalFormat)+", "+this);
}
@@ -1513,7 +1513,7 @@ public class FBObject {
attachRenderbufferImpl2(gl, atype, internalFormat);
}
- private final void attachRenderbufferImpl2(GL gl, Attachment.Type atype, int internalFormat) throws GLException {
+ private final void attachRenderbufferImpl2(final GL gl, final Attachment.Type atype, final int internalFormat) throws GLException {
if( Attachment.Type.DEPTH == atype ) {
if(null == depth) {
depth = new RenderAttachment(Type.DEPTH, internalFormat, samples, width, height, 0);
@@ -1578,7 +1578,7 @@ public class FBObject {
* @return the detached Colorbuffer
* @throws IllegalArgumentException
*/
- public final Colorbuffer detachColorbuffer(GL gl, int attachmentPoint, boolean dispose) throws IllegalArgumentException {
+ public final Colorbuffer detachColorbuffer(final GL gl, final int attachmentPoint, final boolean dispose) throws IllegalArgumentException {
bind(gl);
final Colorbuffer res = detachColorbufferImpl(gl, attachmentPoint, dispose ? DetachAction.DISPOSE : DetachAction.NONE);
@@ -1591,7 +1591,7 @@ public class FBObject {
return res;
}
- private final Colorbuffer detachColorbufferImpl(GL gl, int attachmentPoint, DetachAction detachAction) {
+ private final Colorbuffer detachColorbufferImpl(final GL gl, final int attachmentPoint, final DetachAction detachAction) {
Colorbuffer colbuf = colorAttachmentPoints[attachmentPoint]; // shortcut, don't validate here
if(null == colbuf) {
@@ -1661,7 +1661,7 @@ public class FBObject {
return colbuf;
}
- private final void freeAllColorbufferImpl(GL gl) {
+ private final void freeAllColorbufferImpl(final GL gl) {
for(int i=0; i
Leaves the FBO unbound.
*/ - public final void unuse(GL gl) { + public final void unuse(final GL gl) { unbind(gl); gl.glBindTexture(GL.GL_TEXTURE_2D, 0); // don't use it } @@ -2309,7 +2309,7 @@ public class FBObject { * @param bits 16, 24 or 32 bits * @throws GLException if {@link #init(GL)} hasn't been called. */ - public final boolean supportsDepth(int bits) throws GLException { + public final boolean supportsDepth(final int bits) throws GLException { checkInitialized(); switch(bits) { case 16: return true; @@ -2324,7 +2324,7 @@ public class FBObject { * @param bits 1, 4, 8 or 16 bits * @throws GLException if {@link #init(GL)} hasn't been called. */ - public final boolean supportsStencil(int bits) throws GLException { + public final boolean supportsStencil(final int bits) throws GLException { checkInitialized(); switch(bits) { case 1: return stencil01Avail; @@ -2400,7 +2400,7 @@ public class FBObject { ", dirty "+samplingSinkDirty+"], state "+getStatusString()+", obj "+toHexString(objectHashCode())+"]"; } - private final void updateStatus(GL gl) { + private final void updateStatus(final GL gl) { if( 0 == fbName ) { vStatus = -1; } else { -- cgit v1.2.3