* 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
3.0
ShA..Rd 12 years ago
parent fbac631160
commit 1aa0f9d7bd
  1. 9
      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); caps.add(Caps.TextureArray);
} }
@ -1753,6 +1753,7 @@ public class LwjglRenderer implements Renderer {
if (context.pointSprite) { if (context.pointSprite) {
return; // Attempt to fix glTexParameter crash for some ATI GPUs return; // Attempt to fix glTexParameter crash for some ATI GPUs
} }
// repeat modes // repeat modes
switch (tex.getType()) { switch (tex.getType()) {
case ThreeDimensional: case ThreeDimensional:
@ -1886,9 +1887,15 @@ public class LwjglRenderer implements Renderer {
TextureUtil.uploadTexture(img, GL_TEXTURE_CUBE_MAP_POSITIVE_X + i, i, 0); TextureUtil.uploadTexture(img, GL_TEXTURE_CUBE_MAP_POSITIVE_X + i, i, 0);
} }
} else if (target == EXTTextureArray.GL_TEXTURE_2D_ARRAY_EXT) { } 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<ByteBuffer> data = img.getData(); List<ByteBuffer> data = img.getData();
// -1 index specifies prepare data for 2D Array // -1 index specifies prepare data for 2D Array
TextureUtil.uploadTexture(img, target, -1, 0); TextureUtil.uploadTexture(img, target, -1, 0);
for (int i = 0; i < data.size(); i++) { for (int i = 0; i < data.size(); i++) {
// upload each slice of 2D array in turn // upload each slice of 2D array in turn
// this time with the appropriate index // this time with the appropriate index

Loading…
Cancel
Save