From e242174a2280ae8594454ccfb3791d0d6bc61ef2 Mon Sep 17 00:00:00 2001 From: "jul..om" Date: Thu, 31 Jan 2013 20:48:39 +0000 Subject: [PATCH] Improves OpenGL-ES support (especially for Raspberry Pi), contribution of Erkki Nokso-Koivisto git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@10267 75d07b2b-3a1a-0410-a2c5-0572b91ccdca --- .../com/jme3/renderer/jogl/JoglRenderer.java | 27 +++++++++++-------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/engine/src/jogl/com/jme3/renderer/jogl/JoglRenderer.java b/engine/src/jogl/com/jme3/renderer/jogl/JoglRenderer.java index a7b8cd98a..b6fb1ac5b 100644 --- a/engine/src/jogl/com/jme3/renderer/jogl/JoglRenderer.java +++ b/engine/src/jogl/com/jme3/renderer/jogl/JoglRenderer.java @@ -2379,20 +2379,25 @@ public class JoglRenderer implements Renderer { public void updateVertexArray(Mesh mesh) { int id = mesh.getId(); GL gl = GLContext.getCurrentGL(); - if (id == -1) { - IntBuffer temp = intBuf1; - if (gl.isGL2GL3()) { - gl.getGL2GL3().glGenVertexArrays(1, temp); + //FIXME rather use GLCaps and do it once for all + boolean isVaoSupported = gl.isFunctionAvailable("glGenVertexArrays") && + gl.isFunctionAvailable("glBindVertexArray"); + if (isVaoSupported) { + if (id == -1) { + IntBuffer temp = intBuf1; + if (gl.isGL2GL3()) { + gl.getGL2GL3().glGenVertexArrays(1, temp); + } + id = temp.get(0); + mesh.setId(id); } - id = temp.get(0); - mesh.setId(id); - } - if (context.boundVertexArray != id) { - if (gl.isGL2GL3()) { - gl.getGL2GL3().glBindVertexArray(id); + if (context.boundVertexArray != id) { + if (gl.isGL2GL3()) { + gl.getGL2GL3().glBindVertexArray(id); + } + context.boundVertexArray = id; } - context.boundVertexArray = id; } VertexBuffer interleavedData = mesh.getBuffer(Type.InterleavedData);