From 496263aac829dd0837ba65997b41ef2851022b3c Mon Sep 17 00:00:00 2001 From: Joshua Slack Date: Fri, 29 Sep 2017 17:25:24 -0500 Subject: Added centerOn method to UIComponent to make it simpler to center a component on another component or the hud. Fixed issue in sliders when min value is not 0. Clean up warnings. --- .../src/main/java/com/ardor3d/renderer/jogl/JoglRenderer.java | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'ardor3d-jogl') diff --git a/ardor3d-jogl/src/main/java/com/ardor3d/renderer/jogl/JoglRenderer.java b/ardor3d-jogl/src/main/java/com/ardor3d/renderer/jogl/JoglRenderer.java index 1e15e65..cf0ffc5 100644 --- a/ardor3d-jogl/src/main/java/com/ardor3d/renderer/jogl/JoglRenderer.java +++ b/ardor3d-jogl/src/main/java/com/ardor3d/renderer/jogl/JoglRenderer.java @@ -3,7 +3,7 @@ * * This file is part of Ardor3D. * - * Ardor3D is free software: you can redistribute it and/or modify it + * Ardor3D is free software: you can redistribute it and/or modify it * under the terms of its license which may be found in the accompanying * LICENSE file or at . */ @@ -109,7 +109,7 @@ import com.jogamp.opengl.util.GLBuffers; /** * JoglRenderer provides an implementation of the Renderer interface using the JOGL API. - * + * * @see com.ardor3d.renderer.Renderer */ public class JoglRenderer extends AbstractRenderer { @@ -856,7 +856,6 @@ public class JoglRenderer extends AbstractRenderer { enabledTextures |= (2 << i); } - @SuppressWarnings("null") final FloatBufferData textureBufferData = textureCoords.get(i); final FloatBuffer textureBuffer = textureBufferData.getBuffer(); @@ -1160,7 +1159,6 @@ public class JoglRenderer extends AbstractRenderer { checkAndSetTextureArrayUnit(i, gl, rendRecord, caps); // grab a vboID and make sure it exists and is up to date. - @SuppressWarnings("null") final FloatBufferData data = textureCoords.get(i); final int vboID = setupVBO(data, context); @@ -1338,7 +1336,6 @@ public class JoglRenderer extends AbstractRenderer { } } - @SuppressWarnings("null") private void initializeInterleavedVBO(final RenderContext context, final FloatBufferData interleaved, final FloatBufferData vertexCoords, final FloatBufferData normalCoords, final FloatBufferData colorCoords, final List textureCoords, final int bufferSize) { @@ -1879,7 +1876,7 @@ public class JoglRenderer extends AbstractRenderer { /** * Start a new display list. All further renderer commands that can be stored in a display list are part of this new * list until {@link #endDisplayList()} is called. - * + * * @return id of new display list */ @Override -- cgit v1.2.3 From ca262978b95add2dae3434c5760ba6f2f1039325 Mon Sep 17 00:00:00 2001 From: Joshua Slack Date: Mon, 16 Oct 2017 10:48:44 -0500 Subject: Added some additional caps detection + divorced UIContainer standin texture size from camera. This should help in serveral situations such as window size being tiny during init, or different contexts having different window sizes. --- .../com/ardor3d/renderer/ContextCapabilities.java | 73 ++++++++++++++++------ .../renderer/jogl/JoglContextCapabilities.java | 11 +++- .../renderer/lwjgl/LwjglContextCapabilities.java | 12 +++- .../java/com/ardor3d/extension/ui/UIContainer.java | 35 ++++++----- 4 files changed, 93 insertions(+), 38 deletions(-) (limited to 'ardor3d-jogl') diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/ContextCapabilities.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/ContextCapabilities.java index 9599e0e..dd28ee6 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/renderer/ContextCapabilities.java +++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/ContextCapabilities.java @@ -3,7 +3,7 @@ * * This file is part of Ardor3D. * - * Ardor3D is free software: you can redistribute it and/or modify it + * Ardor3D is free software: you can redistribute it and/or modify it * under the terms of its license which may be found in the accompanying * LICENSE file or at . */ @@ -76,6 +76,15 @@ public class ContextCapabilities { /** The max side of a texture supported. */ protected int _maxTextureSize = -1; + /** The max width of a viewport supported. */ + protected int _maxViewportWidth = -1; + + /** The max height of a viewport supported. */ + protected int _maxViewportHeight = -1; + + /** The max height of a viewport supported. */ + protected int _maxRenderBufferSize = -1; + protected float _maxAnisotropic = -1.0f; /** True if multitexturing is supported. */ @@ -159,6 +168,9 @@ public class ContextCapabilities { _maxGLSLVertexAttribs = source._maxGLSLVertexAttribs; _maxTextureLodBias = source._maxTextureLodBias; _maxTextureSize = source._maxTextureSize; + _maxViewportWidth = source._maxViewportWidth; + _maxViewportHeight = source._maxViewportHeight; + _maxRenderBufferSize = source._maxRenderBufferSize; _maxUserClipPlanes = source._maxUserClipPlanes; _numAuxDrawBuffers = source._numAuxDrawBuffers; _numFixedTexUnits = source._numFixedTexUnits; @@ -391,7 +403,7 @@ public class ContextCapabilities { /** * getNumberOfAuxiliaryDrawBuffers returns the total number of available auxiliary draw buffers this * context supports. - * + * * @return the number of available auxiliary draw buffers supported by the context. */ public int getNumberOfAuxiliaryDrawBuffers() { @@ -400,7 +412,7 @@ public class ContextCapabilities { /** * getTotalNumberOfUnits returns the total number of texture units this context supports. - * + * * @return the total number of texture units supported by the context. */ public int getTotalNumberOfUnits() { @@ -410,7 +422,7 @@ public class ContextCapabilities { /** * getNumberOfFixedUnits returns the number of texture units this context supports, for use in the * fixed pipeline. - * + * * @return the number units. */ public int getNumberOfFixedTextureUnits() { @@ -420,7 +432,7 @@ public class ContextCapabilities { /** * getNumberOfVertexUnits returns the number of texture units available to a vertex shader that this * context supports. - * + * * @return the number of units. */ public int getNumberOfVertexUnits() { @@ -430,7 +442,7 @@ public class ContextCapabilities { /** * getNumberOfFragmentUnits returns the number of texture units available to a fragment shader that * this context supports. - * + * * @return the number of units. */ public int getNumberOfFragmentTextureUnits() { @@ -440,7 +452,7 @@ public class ContextCapabilities { /** * getNumberOfFragmentTexCoordUnits returns the number of texture coordinate sets available that this * context supports. - * + * * @return the number of units. */ public int getNumberOfFragmentTexCoordUnits() { @@ -454,9 +466,30 @@ public class ContextCapabilities { return _maxTextureSize; } + /** + * @return the max width of viewport that this context supports. + */ + public int getMaxViewportWidth() { + return _maxViewportWidth; + } + + /** + * @return the max height of viewport that this context supports. + */ + public int getMaxViewportHeight() { + return _maxViewportHeight; + } + + /** + * @return the max size (in terms of # pixels) of renderbuffer that this context supports. + */ + public int getMaxRenderBufferSize() { + return _maxRenderBufferSize; + } + /** * getNumberOfTotalUnits returns the number of texture units this context supports. - * + * * @return the number of units. */ public int getNumberOfTotalTextureUnits() { @@ -465,7 +498,7 @@ public class ContextCapabilities { /** * getMaxFBOColorAttachments returns the MAX_COLOR_ATTACHMENTS for FBOs that this context supports. - * + * * @return the number of buffers. */ public int getMaxFBOColorAttachments() { @@ -474,7 +507,7 @@ public class ContextCapabilities { /** * Returns the maximum anisotropic filter. - * + * * @return The maximum anisotropic filter. */ public float getMaxAnisotropic() { @@ -525,7 +558,7 @@ public class ContextCapabilities { /** * Returns if S3TC compression is available for textures. - * + * * @return true if S3TC is available. */ public boolean isS3TCSupported() { @@ -534,7 +567,7 @@ public class ContextCapabilities { /** * Returns if LATC compression is available for textures. - * + * * @return true if LATC is available. */ public boolean isLATCSupported() { @@ -543,7 +576,7 @@ public class ContextCapabilities { /** * Returns if generic (non-specific) compression is available for textures. - * + * * @return true if available. */ public boolean isGenericTCSupported() { @@ -552,7 +585,7 @@ public class ContextCapabilities { /** * Returns if Texture3D is available for textures. - * + * * @return true if Texture3D is available. */ public boolean isTexture3DSupported() { @@ -561,7 +594,7 @@ public class ContextCapabilities { /** * Returns if TextureCubeMap is available for textures. - * + * * @return true if TextureCubeMap is available. */ public boolean isTextureCubeMapSupported() { @@ -570,7 +603,7 @@ public class ContextCapabilities { /** * Returns if AutomaticMipmap generation is available for textures. - * + * * @return true if AutomaticMipmap generation is available. */ public boolean isAutomaticMipmapsSupported() { @@ -652,7 +685,7 @@ public class ContextCapabilities { /** * Returns the vendor of the graphics adapter - * + * * @return The vendor of the graphics adapter */ public String getDisplayVendor() { @@ -661,7 +694,7 @@ public class ContextCapabilities { /** * Returns renderer details of the adapter - * + * * @return The adapter details */ public String getDisplayRenderer() { @@ -670,7 +703,7 @@ public class ContextCapabilities { /** * Returns the version supported - * + * * @return The version supported */ public String getDisplayVersion() { @@ -679,7 +712,7 @@ public class ContextCapabilities { /** * Returns the supported shading language version. Needs OpenGL 2.0 support to query. - * + * * @return The shading language version supported */ public String getShadingLanguageVersion() { diff --git a/ardor3d-jogl/src/main/java/com/ardor3d/renderer/jogl/JoglContextCapabilities.java b/ardor3d-jogl/src/main/java/com/ardor3d/renderer/jogl/JoglContextCapabilities.java index 5ee1cb8..1151533 100644 --- a/ardor3d-jogl/src/main/java/com/ardor3d/renderer/jogl/JoglContextCapabilities.java +++ b/ardor3d-jogl/src/main/java/com/ardor3d/renderer/jogl/JoglContextCapabilities.java @@ -3,7 +3,7 @@ * * This file is part of Ardor3D. * - * Ardor3D is free software: you can redistribute it and/or modify it + * Ardor3D is free software: you can redistribute it and/or modify it * under the terms of its license which may be found in the accompanying * LICENSE file or at . */ @@ -126,6 +126,15 @@ public class JoglContextCapabilities extends ContextCapabilities { gl.glGetIntegerv(GL.GL_MAX_TEXTURE_SIZE, buf); _maxTextureSize = buf.get(0); + // max texture size. + gl.glGetIntegerv(GL.GL_MAX_RENDERBUFFER_SIZE, buf); + _maxRenderBufferSize = buf.get(0); + + // max viewport size. + gl.glGetIntegerv(GL.GL_MAX_VIEWPORT_DIMS, buf); + _maxViewportWidth = buf.get(0); + _maxViewportHeight = buf.get(1); + // Check for support of multitextures. _supportsMultiTexture = gl.isExtensionAvailable("GL_ARB_multitexture"); diff --git a/ardor3d-lwjgl/src/main/java/com/ardor3d/renderer/lwjgl/LwjglContextCapabilities.java b/ardor3d-lwjgl/src/main/java/com/ardor3d/renderer/lwjgl/LwjglContextCapabilities.java index fcc3758..9b2c762 100644 --- a/ardor3d-lwjgl/src/main/java/com/ardor3d/renderer/lwjgl/LwjglContextCapabilities.java +++ b/ardor3d-lwjgl/src/main/java/com/ardor3d/renderer/lwjgl/LwjglContextCapabilities.java @@ -3,7 +3,7 @@ * * This file is part of Ardor3D. * - * Ardor3D is free software: you can redistribute it and/or modify it + * Ardor3D is free software: you can redistribute it and/or modify it * under the terms of its license which may be found in the accompanying * LICENSE file or at . */ @@ -22,6 +22,7 @@ import org.lwjgl.opengl.EXTTextureFilterAnisotropic; import org.lwjgl.opengl.EXTTextureLODBias; import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL20; +import org.lwjgl.opengl.GL30; import com.ardor3d.renderer.ContextCapabilities; import com.ardor3d.util.geom.BufferUtils; @@ -115,6 +116,15 @@ public class LwjglContextCapabilities extends ContextCapabilities { GL11.glGetInteger(GL11.GL_MAX_TEXTURE_SIZE, buf); _maxTextureSize = buf.get(0); + // max texture size. + GL11.glGetInteger(GL30.GL_MAX_RENDERBUFFER_SIZE, buf); + _maxRenderBufferSize = buf.get(0); + + // max viewport size. + GL11.glGetInteger(GL11.GL_MAX_VIEWPORT_DIMS, buf); + _maxViewportWidth = buf.get(0); + _maxViewportHeight = buf.get(1); + // Check for support of multitextures. _supportsMultiTexture = caps.GL_ARB_multitexture; diff --git a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UIContainer.java b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UIContainer.java index 5b597f0..1e2091b 100644 --- a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UIContainer.java +++ b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UIContainer.java @@ -3,7 +3,7 @@ * * This file is part of Ardor3D. * - * Ardor3D is free software: you can redistribute it and/or modify it + * Ardor3D is free software: you can redistribute it and/or modify it * under the terms of its license which may be found in the accompanying * LICENSE file or at . */ @@ -17,11 +17,11 @@ import java.util.logging.Logger; import com.ardor3d.extension.ui.layout.RowLayout; import com.ardor3d.extension.ui.layout.UILayout; import com.ardor3d.extension.ui.util.UIQuad; -import com.ardor3d.image.Texture2D; -import com.ardor3d.image.TextureStoreFormat; import com.ardor3d.image.Texture.MagnificationFilter; import com.ardor3d.image.Texture.MinificationFilter; import com.ardor3d.image.Texture.WrapMode; +import com.ardor3d.image.Texture2D; +import com.ardor3d.image.TextureStoreFormat; import com.ardor3d.math.ColorRGBA; import com.ardor3d.math.Matrix3; import com.ardor3d.math.Rectangle2; @@ -33,10 +33,10 @@ import com.ardor3d.renderer.TextureRenderer; import com.ardor3d.renderer.TextureRendererFactory; import com.ardor3d.renderer.queue.RenderBucketType; import com.ardor3d.renderer.state.BlendState; -import com.ardor3d.renderer.state.TextureState; import com.ardor3d.renderer.state.BlendState.DestinationFunction; import com.ardor3d.renderer.state.BlendState.SourceFunction; import com.ardor3d.renderer.state.BlendState.TestFunction; +import com.ardor3d.renderer.state.TextureState; import com.ardor3d.scenegraph.Spatial; import com.ardor3d.scenegraph.hint.CullHint; import com.ardor3d.scenegraph.hint.LightCombineMode; @@ -49,6 +49,7 @@ import com.ardor3d.scenegraph.hint.TextureCombineMode; */ public abstract class UIContainer extends UIComponent { private static final Logger _logger = Logger.getLogger(UIContainer.class.getName()); + public static int STANDIN_TEXTURE_SIZE = 4096; /** Layout responsible for managing the size and position of this container's contents. */ private UILayout _layout = new RowLayout(true); @@ -87,7 +88,7 @@ public abstract class UIContainer extends UIComponent { /** * Checks to see if a given UIComponent is in this container. - * + * * @param component * the component to look for * @return true if the given component is in this container. @@ -98,7 +99,7 @@ public abstract class UIContainer extends UIComponent { /** * Checks to see if a given UIComponent is in this container or (if instructed) its subcontainers. - * + * * @param component * the component to look for * @param recurse @@ -121,7 +122,7 @@ public abstract class UIContainer extends UIComponent { /** * Add a component to this container. - * + * * @param component * the component to add */ @@ -137,7 +138,7 @@ public abstract class UIContainer extends UIComponent { /** * Remove a component from this container. - * + * * @param component * the component to remove */ @@ -152,7 +153,7 @@ public abstract class UIContainer extends UIComponent { /** * Removes all UI components from this container. If other types of Spatials are attached to this container, they * are ignored. - * + * * @param comp * the component to remove */ @@ -438,16 +439,18 @@ public abstract class UIContainer extends UIComponent { /** * Build our standin quad and (as necessary) a texture renderer. - * + * * @param renderer * the renderer to use if we need to generate a texture renderer */ private void buildStandin(final Renderer renderer) { // Check for and create a texture renderer if none exists yet. if (UIContainer._textureRenderer == null) { - final Camera cam = Camera.getCurrentCamera(); - UIContainer._textureRenderer = TextureRendererFactory.INSTANCE.createTextureRenderer(cam.getWidth(), cam - .getHeight(), renderer, ContextManager.getCurrentContext().getCapabilities()); + final int maxRBS = ContextManager.getCurrentContext().getCapabilities().getMaxRenderBufferSize(); + final int size = maxRBS > 0 ? Math.min(UIContainer.STANDIN_TEXTURE_SIZE, maxRBS) + : UIContainer.STANDIN_TEXTURE_SIZE; + UIContainer._textureRenderer = TextureRendererFactory.INSTANCE.createTextureRenderer(size, size, 8, 0, + renderer, ContextManager.getCurrentContext().getCapabilities()); if (UIContainer._textureRenderer != null) { UIContainer._textureRenderer.setBackgroundColor(new ColorRGBA(0f, 1f, 0f, 0f)); UIContainer._textureRenderer.setMultipleTargets(true); @@ -548,7 +551,7 @@ public abstract class UIContainer extends UIComponent { } /** - * + * * @param doClip * true (default) if we want this container to clip the drawing of its contents to the dimensions of its * content area. @@ -575,7 +578,7 @@ public abstract class UIContainer extends UIComponent { } /** - * + * * @return true if we should use a cached texture copy to draw this container. * @see #setUseStandin(boolean) */ @@ -592,7 +595,7 @@ public abstract class UIContainer extends UIComponent { /** * Set the minification filter for the standin. - * + * * @param filter */ public void setMinificationFilter(final MinificationFilter filter) { -- cgit v1.2.3 From 667f946d11b29f9d6618b46d7b821099f6a83b77 Mon Sep 17 00:00:00 2001 From: Joshua Slack Date: Wed, 18 Oct 2017 22:58:42 -0500 Subject: Fixed bug with caps in Jogl recently introduced. --- .../java/com/ardor3d/renderer/jogl/JoglContextCapabilities.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'ardor3d-jogl') diff --git a/ardor3d-jogl/src/main/java/com/ardor3d/renderer/jogl/JoglContextCapabilities.java b/ardor3d-jogl/src/main/java/com/ardor3d/renderer/jogl/JoglContextCapabilities.java index 1151533..78d6023 100644 --- a/ardor3d-jogl/src/main/java/com/ardor3d/renderer/jogl/JoglContextCapabilities.java +++ b/ardor3d-jogl/src/main/java/com/ardor3d/renderer/jogl/JoglContextCapabilities.java @@ -21,6 +21,7 @@ import javax.media.opengl.GL2ES3; import javax.media.opengl.GLAutoDrawable; import com.ardor3d.renderer.ContextCapabilities; +import com.ardor3d.util.geom.BufferUtils; import com.ardor3d.util.geom.jogl.DirectNioBuffersSet; public class JoglContextCapabilities extends ContextCapabilities { @@ -131,9 +132,10 @@ public class JoglContextCapabilities extends ContextCapabilities { _maxRenderBufferSize = buf.get(0); // max viewport size. - gl.glGetIntegerv(GL.GL_MAX_VIEWPORT_DIMS, buf); - _maxViewportWidth = buf.get(0); - _maxViewportHeight = buf.get(1); + final IntBuffer dimsBuf = BufferUtils.createIntBuffer(2); + gl.glGetIntegerv(GL.GL_MAX_VIEWPORT_DIMS, dimsBuf); + _maxViewportWidth = dimsBuf.get(0); + _maxViewportHeight = dimsBuf.get(1); // Check for support of multitextures. _supportsMultiTexture = gl.isExtensionAvailable("GL_ARB_multitexture"); -- cgit v1.2.3 From 2fcedf5a18d680093a396f89fb55d79fbd1fb4cb Mon Sep 17 00:00:00 2001 From: Joshua Slack Date: Thu, 4 Jan 2018 13:19:57 -0600 Subject: Small tweak to eclipse project settings --- ardor3d-animation/.settings/org.eclipse.jdt.ui.prefs | 2 +- ardor3d-awt/.settings/org.eclipse.jdt.ui.prefs | 2 +- ardor3d-core/.settings/org.eclipse.jdt.ui.prefs | 2 +- ardor3d-effects/.settings/org.eclipse.jdt.ui.prefs | 2 +- ardor3d-examples/.settings/org.eclipse.jdt.ui.prefs | 2 +- ardor3d-extras/.settings/org.eclipse.jdt.ui.prefs | 2 +- ardor3d-jogl/.settings/org.eclipse.jdt.ui.prefs | 2 +- ardor3d-lwjgl/.settings/org.eclipse.jdt.ui.prefs | 2 +- ardor3d-swt/.settings/org.eclipse.jdt.ui.prefs | 2 +- ardor3d-terrain/.settings/org.eclipse.jdt.ui.prefs | 2 +- ardor3d-ui/.settings/org.eclipse.jdt.ui.prefs | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) (limited to 'ardor3d-jogl') diff --git a/ardor3d-animation/.settings/org.eclipse.jdt.ui.prefs b/ardor3d-animation/.settings/org.eclipse.jdt.ui.prefs index 583471d..b79d20f 100644 --- a/ardor3d-animation/.settings/org.eclipse.jdt.ui.prefs +++ b/ardor3d-animation/.settings/org.eclipse.jdt.ui.prefs @@ -2,7 +2,7 @@ cleanup_settings_version=2 eclipse.preferences.version=1 editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true org.eclipse.jdt.ui.javadoc=false -org.eclipse.jdt.ui.text.custom_code_templates=