From 1aa0f9d7bda3ab5d871c37aa36699e064ac92704 Mon Sep 17 00:00:00 2001 From: "ShA..Rd" Date: Fri, 19 Apr 2013 17:00:25 +0000 Subject: [PATCH] * LwjglRenderer adds capability for texture array support if OpenGL 3 is available * Renderer will check texture array support prior to uploading texture git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@10563 75d07b2b-3a1a-0410-a2c5-0572b91ccdca --- .../src/lwjgl/com/jme3/renderer/lwjgl/LwjglRenderer.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/engine/src/lwjgl/com/jme3/renderer/lwjgl/LwjglRenderer.java b/engine/src/lwjgl/com/jme3/renderer/lwjgl/LwjglRenderer.java index 59933ecc1..044d2e1a4 100644 --- a/engine/src/lwjgl/com/jme3/renderer/lwjgl/LwjglRenderer.java +++ b/engine/src/lwjgl/com/jme3/renderer/lwjgl/LwjglRenderer.java @@ -319,7 +319,7 @@ public class LwjglRenderer implements Renderer { } } - if (ctxCaps.GL_EXT_texture_array) { + if (ctxCaps.GL_EXT_texture_array || ctxCaps.OpenGL30) { caps.add(Caps.TextureArray); } @@ -1753,6 +1753,7 @@ public class LwjglRenderer implements Renderer { if (context.pointSprite) { return; // Attempt to fix glTexParameter crash for some ATI GPUs } + // repeat modes switch (tex.getType()) { case ThreeDimensional: @@ -1886,9 +1887,15 @@ public class LwjglRenderer implements Renderer { TextureUtil.uploadTexture(img, GL_TEXTURE_CUBE_MAP_POSITIVE_X + i, i, 0); } } else if (target == EXTTextureArray.GL_TEXTURE_2D_ARRAY_EXT) { + if (!caps.contains(Caps.TextureArray)) { + throw new RendererException("Texture arrays not supported by graphics hardware"); + } + List data = img.getData(); + // -1 index specifies prepare data for 2D Array TextureUtil.uploadTexture(img, target, -1, 0); + for (int i = 0; i < data.size(); i++) { // upload each slice of 2D array in turn // this time with the appropriate index