A complete 3D game development suite written purely in Java.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
jmonkeyengine/jme3-android/src/main/java/com/jme3/renderer/android/AndroidGL.java

616 lines
21 KiB

/*
* Copyright (c) 2009-2015 jMonkeyEngine
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* * Neither the name of 'jMonkeyEngine' nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.jme3.renderer.android;
import android.opengl.*;
import com.jme3.renderer.RendererException;
import com.jme3.renderer.opengl.*;
Android openGL ES 3 support (#1147) * Update GLImageFormats.java * Added basic support for openGL ES 3.0 and GLSL300 for android Added instancing support for android which is core feature in GLES3.0 Added fix for shadows in android * Fixed required types of GLES30.glDrawElementsInstanced * Properly check GLES3 version and setting precision for shaders for all GLSL ES versions * Added support for Opengl ES 3.1 and 3.2 and their shader versions Added proper checkings for new OpenGL ES versions Fixed some issues with shadow rendering in GLES 3.0 or better (strict type checking, OpenGL ES specific extensions and percision definition) Added GLSL320 and GLSL300 to Unshaded and Lighting materials * Added depth texture 24bit for OpenGL ES * Added geometry shaders and tessellation to GLES 3.1 as extension and GLES 3.2 as core Modified test materials to use GLSL310 * Added FB blit for android GLES30 * Added GlSL300 or better to all effects not able to run in GLSL100 Mods on Shadows.glsllib to try to fix android shadow rendering Fixed ssaoBlur.frag that was using a reserved word Fixed precision type missmatch from vertex to fragment shader * Partial multisample support Framebuffer MRT support * Temporarily removed texture multisampling (not being able to compile using GLES31) * Updated android.jar to api28 Enabled multisampling * Better checking for GLES3 * Removed insert precision for all shaders. This avoided some random precision missmatch error but created rendering issues * Removed border check for GLES, caused filtered shadows not to render on GLES2.0 devices Added texture compare mode for GLES3.0 and better to be able to use sampler2DShadow Modified base materials (Lighting and Unshaded) to use only GLSL100 for post shadow pass * Corrected texture comparison function that were incorrectly changed * Added precision to samplers for GLESSL300 also * Created a subclass of Glsl150ShaderGenerator (Glsl300ShaderGenerator) to support ShaderNodes in GLES SL30 and included it's usage in DesktopAssetManager. Nowadays just copied and overwrote the version string. Needs a full review Added image format RGB16F to be used as texture format only in GLES30 (cannot be used as FB format) Added GLSL300 and/or GLSL310 to different materials * Cleaned GLSL300 generator Fixed shadows glsl lib removing use of GL_EXT_gpu_shaders5 * Fixed usag of textureCubeLod in fragment shader of envMapping which is unsupported in GLES2.0 Modified PBRLighting frag to properly compile on GLES3 * Added GLSL300 and 310 to PostShadowFilter material definition * Make post shadow filter use GLSL100 for GLSL300 Set highp as default precision to fix glitched shadows caused because not enough precision * Changed water_normalmap.dds to uncompressed RGB8 because DXT1 is mostly unsupported in GLES * Fixed GLES30 compilation issues in Water shaders and added GLSL300 to LightScattering material. ** Not fully tested * Added RGB8 dds formatted FullskiesSunset to be used in any platform. Previous file moved to _dtx1.dds * Set GL_TEXTURE_MAX_LEVEL in GLES30 contexts fixing issue with not fully mipmapped images and PBR rendering * Fixed compilation of jme3-android-examples and upgraded sdk version to use * Fixed Geometry Shader and Tessellation Shaders in testdata package to properly compile on GLES320 * Added non-compressed textures to be able to run all examples on android Enabled texture arrays and 3d textures on opengl es 3.0. Peding to implement wrappers to android gl functions (currently getting NullPointerException) * More GLES30 functions included to properly support texture arrays, 3d textures and multisampling matching jme core code * Fixed 3D texture tests for GLES30 Fixed texture 3D and texture array example shader compilation on GLES30 Fixed some random missing precision compilation errors on GLES30 * Fixed TestTextureArray for GLES30 * Some multisample additions and removal of GLES3 multisampling enable caps Added RGBA16F as valid format for GLES32 and using it by default in env camera instead of RGB16F. kept fall back to RGB8 * added float and half float formats for gles30 added rgb10a2 format for gles30 fixed usage of glTexImage2D removed EnvironmentCamera fallback image format as it's useless now * Added more image formats for GLES30 Fixed rgb8 if having Caps.Rgba8 * Enabled RadialBlur for gles30 * Fixed luminance texture formats for gles * Added more depth image formats for gles3 * Enabled multisampling in gles3 * Added GLES30 functions to GLDebugES Reverted TestTexture3D and TestTextureArray to use RGB8 format Updated EnvMapping100.frag to use EXT_shader_texture_lod in gles sl 100 if available * Removed all aditional not used compressed dds files Removed also Pond and rock png files previously used in TestTextureArray * Removed compressed water_normalmap_dxt1.dds * Changed GLES_30 and AndroidGL implementing GL2 to avoid duplicated code checking GL2 vs GLES30 * Added aditional checking to avoid gles30 calls from gles20 only devices
5 years ago
import com.jme3.util.BufferUtils;
import java.nio.Buffer;
import java.nio.ByteBuffer;
import java.nio.FloatBuffer;
import java.nio.IntBuffer;
import java.nio.ShortBuffer;
Android openGL ES 3 support (#1147) * Update GLImageFormats.java * Added basic support for openGL ES 3.0 and GLSL300 for android Added instancing support for android which is core feature in GLES3.0 Added fix for shadows in android * Fixed required types of GLES30.glDrawElementsInstanced * Properly check GLES3 version and setting precision for shaders for all GLSL ES versions * Added support for Opengl ES 3.1 and 3.2 and their shader versions Added proper checkings for new OpenGL ES versions Fixed some issues with shadow rendering in GLES 3.0 or better (strict type checking, OpenGL ES specific extensions and percision definition) Added GLSL320 and GLSL300 to Unshaded and Lighting materials * Added depth texture 24bit for OpenGL ES * Added geometry shaders and tessellation to GLES 3.1 as extension and GLES 3.2 as core Modified test materials to use GLSL310 * Added FB blit for android GLES30 * Added GlSL300 or better to all effects not able to run in GLSL100 Mods on Shadows.glsllib to try to fix android shadow rendering Fixed ssaoBlur.frag that was using a reserved word Fixed precision type missmatch from vertex to fragment shader * Partial multisample support Framebuffer MRT support * Temporarily removed texture multisampling (not being able to compile using GLES31) * Updated android.jar to api28 Enabled multisampling * Better checking for GLES3 * Removed insert precision for all shaders. This avoided some random precision missmatch error but created rendering issues * Removed border check for GLES, caused filtered shadows not to render on GLES2.0 devices Added texture compare mode for GLES3.0 and better to be able to use sampler2DShadow Modified base materials (Lighting and Unshaded) to use only GLSL100 for post shadow pass * Corrected texture comparison function that were incorrectly changed * Added precision to samplers for GLESSL300 also * Created a subclass of Glsl150ShaderGenerator (Glsl300ShaderGenerator) to support ShaderNodes in GLES SL30 and included it's usage in DesktopAssetManager. Nowadays just copied and overwrote the version string. Needs a full review Added image format RGB16F to be used as texture format only in GLES30 (cannot be used as FB format) Added GLSL300 and/or GLSL310 to different materials * Cleaned GLSL300 generator Fixed shadows glsl lib removing use of GL_EXT_gpu_shaders5 * Fixed usag of textureCubeLod in fragment shader of envMapping which is unsupported in GLES2.0 Modified PBRLighting frag to properly compile on GLES3 * Added GLSL300 and 310 to PostShadowFilter material definition * Make post shadow filter use GLSL100 for GLSL300 Set highp as default precision to fix glitched shadows caused because not enough precision * Changed water_normalmap.dds to uncompressed RGB8 because DXT1 is mostly unsupported in GLES * Fixed GLES30 compilation issues in Water shaders and added GLSL300 to LightScattering material. ** Not fully tested * Added RGB8 dds formatted FullskiesSunset to be used in any platform. Previous file moved to _dtx1.dds * Set GL_TEXTURE_MAX_LEVEL in GLES30 contexts fixing issue with not fully mipmapped images and PBR rendering * Fixed compilation of jme3-android-examples and upgraded sdk version to use * Fixed Geometry Shader and Tessellation Shaders in testdata package to properly compile on GLES320 * Added non-compressed textures to be able to run all examples on android Enabled texture arrays and 3d textures on opengl es 3.0. Peding to implement wrappers to android gl functions (currently getting NullPointerException) * More GLES30 functions included to properly support texture arrays, 3d textures and multisampling matching jme core code * Fixed 3D texture tests for GLES30 Fixed texture 3D and texture array example shader compilation on GLES30 Fixed some random missing precision compilation errors on GLES30 * Fixed TestTextureArray for GLES30 * Some multisample additions and removal of GLES3 multisampling enable caps Added RGBA16F as valid format for GLES32 and using it by default in env camera instead of RGB16F. kept fall back to RGB8 * added float and half float formats for gles30 added rgb10a2 format for gles30 fixed usage of glTexImage2D removed EnvironmentCamera fallback image format as it's useless now * Added more image formats for GLES30 Fixed rgb8 if having Caps.Rgba8 * Enabled RadialBlur for gles30 * Fixed luminance texture formats for gles * Added more depth image formats for gles3 * Enabled multisampling in gles3 * Added GLES30 functions to GLDebugES Reverted TestTexture3D and TestTextureArray to use RGB8 format Updated EnvMapping100.frag to use EXT_shader_texture_lod in gles sl 100 if available * Removed all aditional not used compressed dds files Removed also Pond and rock png files previously used in TestTextureArray * Removed compressed water_normalmap_dxt1.dds * Changed GLES_30 and AndroidGL implementing GL2 to avoid duplicated code checking GL2 vs GLES30 * Added aditional checking to avoid gles30 calls from gles20 only devices
5 years ago
public class AndroidGL implements GL, GL2, GLES_30, GLExt, GLFbo {
IntBuffer tmpBuff = BufferUtils.createIntBuffer(1);
public void resetStats() {
}
private static int getLimitBytes(ByteBuffer buffer) {
checkLimit(buffer);
return buffer.limit();
}
private static int getLimitBytes(ShortBuffer buffer) {
checkLimit(buffer);
return buffer.limit() * 2;
}
private static int getLimitBytes(IntBuffer buffer) {
checkLimit(buffer);
return buffer.limit() * 4;
}
private static int getLimitBytes(FloatBuffer buffer) {
checkLimit(buffer);
return buffer.limit() * 4;
}
private static int getLimitCount(Buffer buffer, int elementSize) {
checkLimit(buffer);
return buffer.limit() / elementSize;
}
private static void checkLimit(Buffer buffer) {
if (buffer == null) {
return;
}
if (buffer.limit() == 0) {
throw new RendererException("Attempting to upload empty buffer (limit = 0), that's an error");
}
if (buffer.remaining() == 0) {
throw new RendererException("Attempting to upload empty buffer (remaining = 0), that's an error");
}
}
public void glActiveTexture(int texture) {
GLES20.glActiveTexture(texture);
}
public void glAttachShader(int program, int shader) {
GLES20.glAttachShader(program, shader);
}
@Override
public void glBeginQuery(int target, int query) {
GLES30.glBeginQuery(target, query);
}
public void glBindBuffer(int target, int buffer) {
GLES20.glBindBuffer(target, buffer);
}
public void glBindTexture(int target, int texture) {
GLES20.glBindTexture(target, texture);
}
public void glBlendFunc(int sfactor, int dfactor) {
GLES20.glBlendFunc(sfactor, dfactor);
}
public void glBlendFuncSeparate(int sfactorRGB, int dfactorRGB, int sfactorAlpha, int dfactorAlpha) {
GLES20.glBlendFuncSeparate(sfactorRGB, dfactorRGB, sfactorAlpha, dfactorAlpha);
}
public void glBufferData(int target, FloatBuffer data, int usage) {
GLES20.glBufferData(target, getLimitBytes(data), data, usage);
}
public void glBufferData(int target, ShortBuffer data, int usage) {
GLES20.glBufferData(target, getLimitBytes(data), data, usage);
}
public void glBufferData(int target, ByteBuffer data, int usage) {
GLES20.glBufferData(target, getLimitBytes(data), data, usage);
}
public void glBufferData(int target, long data_size, int usage) {
GLES20.glBufferData(target, (int) data_size, null, usage);
}
public void glBufferSubData(int target, long offset, FloatBuffer data) {
GLES20.glBufferSubData(target, (int) offset, getLimitBytes(data), data);
}
public void glBufferSubData(int target, long offset, ShortBuffer data) {
GLES20.glBufferSubData(target, (int) offset, getLimitBytes(data), data);
}
public void glBufferSubData(int target, long offset, ByteBuffer data) {
GLES20.glBufferSubData(target, (int) offset, getLimitBytes(data), data);
}
public void glGetBufferSubData(int target, long offset, ByteBuffer data) {
throw new UnsupportedOperationException("OpenGL ES 2 does not support glGetBufferSubData");
}
public void glClear(int mask) {
GLES20.glClear(mask);
}
public void glClearColor(float red, float green, float blue, float alpha) {
GLES20.glClearColor(red, green, blue, alpha);
}
public void glColorMask(boolean red, boolean green, boolean blue, boolean alpha) {
GLES20.glColorMask(red, green, blue, alpha);
}
public void glCompileShader(int shader) {
GLES20.glCompileShader(shader);
}
public void glCompressedTexImage2D(int target, int level, int internalformat, int width, int height, int border, ByteBuffer data) {
GLES20.glCompressedTexImage2D(target, level, internalformat, width, height, 0, getLimitBytes(data), data);
}
public void glCompressedTexSubImage2D(int target, int level, int xoffset, int yoffset, int width, int height, int format, ByteBuffer data) {
GLES20.glCompressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, getLimitBytes(data), data);
}
public int glCreateProgram() {
return GLES20.glCreateProgram();
}
public int glCreateShader(int shaderType) {
return GLES20.glCreateShader(shaderType);
}
public void glCullFace(int mode) {
GLES20.glCullFace(mode);
}
public void glDeleteBuffers(IntBuffer buffers) {
checkLimit(buffers);
GLES20.glDeleteBuffers(buffers.limit(), buffers);
}
public void glDeleteProgram(int program) {
GLES20.glDeleteProgram(program);
}
public void glDeleteShader(int shader) {
GLES20.glDeleteShader(shader);
}
public void glDeleteTextures(IntBuffer textures) {
checkLimit(textures);
GLES20.glDeleteTextures(textures.limit(), textures);
}
public void glDepthFunc(int func) {
GLES20.glDepthFunc(func);
}
public void glDepthMask(boolean flag) {
GLES20.glDepthMask(flag);
}
public void glDepthRange(double nearVal, double farVal) {
GLES20.glDepthRangef((float)nearVal, (float)farVal);
}
public void glDetachShader(int program, int shader) {
GLES20.glDetachShader(program, shader);
}
public void glDisable(int cap) {
GLES20.glDisable(cap);
}
public void glDisableVertexAttribArray(int index) {
GLES20.glDisableVertexAttribArray(index);
}
public void glDrawArrays(int mode, int first, int count) {
GLES20.glDrawArrays(mode, first, count);
}
public void glDrawRangeElements(int mode, int start, int end, int count, int type, long indices) {
GLES20.glDrawElements(mode, count, type, (int)indices);
}
public void glEnable(int cap) {
GLES20.glEnable(cap);
}
public void glEnableVertexAttribArray(int index) {
GLES20.glEnableVertexAttribArray(index);
}
@Override
public void glEndQuery(int target) {
GLES30.glEndQuery(target);
}
public void glGenBuffers(IntBuffer buffers) {
checkLimit(buffers);
GLES20.glGenBuffers(buffers.limit(), buffers);
}
public void glGenTextures(IntBuffer textures) {
checkLimit(textures);
GLES20.glGenTextures(textures.limit(), textures);
}
@Override
public void glGenQueries(int num, IntBuffer buff) {
GLES30.glGenQueries(num, buff);
}
public int glGetAttribLocation(int program, String name) {
return GLES20.glGetAttribLocation(program, name);
}
public void glGetBoolean(int pname, ByteBuffer params) {
// GLES20.glGetBoolean(pname, params);
throw new UnsupportedOperationException("Today is not a good day for this");
}
public int glGetError() {
return GLES20.glGetError();
}
public void glGetInteger(int pname, IntBuffer params) {
checkLimit(params);
GLES20.glGetIntegerv(pname, params);
}
public void glGetProgram(int program, int pname, IntBuffer params) {
checkLimit(params);
GLES20.glGetProgramiv(program, pname, params);
}
public String glGetProgramInfoLog(int program, int maxLength) {
return GLES20.glGetProgramInfoLog(program);
}
@Override
public long glGetQueryObjectui64(int query, int pname) {
IntBuffer buff = IntBuffer.allocate(1);
//FIXME This is wrong IMO should be glGetQueryObjectui64v with a LongBuffer but it seems the API doesn't provide it.
GLES30.glGetQueryObjectuiv(query, pname, buff);
return buff.get(0);
}
@Override
public int glGetQueryObjectiv(int query, int pname) {
IntBuffer buff = IntBuffer.allocate(1);
GLES30.glGetQueryiv(query, pname, buff);
return buff.get(0);
}
public void glGetShader(int shader, int pname, IntBuffer params) {
checkLimit(params);
GLES20.glGetShaderiv(shader, pname, params);
}
public String glGetShaderInfoLog(int shader, int maxLength) {
return GLES20.glGetShaderInfoLog(shader);
}
public String glGetString(int name) {
return GLES20.glGetString(name);
}
public int glGetUniformLocation(int program, String name) {
return GLES20.glGetUniformLocation(program, name);
}
public boolean glIsEnabled(int cap) {
return GLES20.glIsEnabled(cap);
}
public void glLineWidth(float width) {
GLES20.glLineWidth(width);
}
public void glLinkProgram(int program) {
GLES20.glLinkProgram(program);
}
public void glPixelStorei(int pname, int param) {
GLES20.glPixelStorei(pname, param);
}
public void glPolygonOffset(float factor, float units) {
GLES20.glPolygonOffset(factor, units);
}
public void glReadPixels(int x, int y, int width, int height, int format, int type, ByteBuffer data) {
GLES20.glReadPixels(x, y, width, height, format, type, data);
}
public void glScissor(int x, int y, int width, int height) {
GLES20.glScissor(x, y, width, height);
}
public void glShaderSource(int shader, String[] string, IntBuffer length) {
if (string.length != 1) {
throw new UnsupportedOperationException("Today is not a good day");
}
GLES20.glShaderSource(shader, string[0]);
}
public void glStencilFuncSeparate(int face, int func, int ref, int mask) {
GLES20.glStencilFuncSeparate(face, func, ref, mask);
}
public void glStencilOpSeparate(int face, int sfail, int dpfail, int dppass) {
GLES20.glStencilOpSeparate(face, sfail, dpfail, dppass);
}
public void glTexImage2D(int target, int level, int internalFormat, int width, int height, int border, int format, int type, ByteBuffer data) {
Android openGL ES 3 support (#1147) * Update GLImageFormats.java * Added basic support for openGL ES 3.0 and GLSL300 for android Added instancing support for android which is core feature in GLES3.0 Added fix for shadows in android * Fixed required types of GLES30.glDrawElementsInstanced * Properly check GLES3 version and setting precision for shaders for all GLSL ES versions * Added support for Opengl ES 3.1 and 3.2 and their shader versions Added proper checkings for new OpenGL ES versions Fixed some issues with shadow rendering in GLES 3.0 or better (strict type checking, OpenGL ES specific extensions and percision definition) Added GLSL320 and GLSL300 to Unshaded and Lighting materials * Added depth texture 24bit for OpenGL ES * Added geometry shaders and tessellation to GLES 3.1 as extension and GLES 3.2 as core Modified test materials to use GLSL310 * Added FB blit for android GLES30 * Added GlSL300 or better to all effects not able to run in GLSL100 Mods on Shadows.glsllib to try to fix android shadow rendering Fixed ssaoBlur.frag that was using a reserved word Fixed precision type missmatch from vertex to fragment shader * Partial multisample support Framebuffer MRT support * Temporarily removed texture multisampling (not being able to compile using GLES31) * Updated android.jar to api28 Enabled multisampling * Better checking for GLES3 * Removed insert precision for all shaders. This avoided some random precision missmatch error but created rendering issues * Removed border check for GLES, caused filtered shadows not to render on GLES2.0 devices Added texture compare mode for GLES3.0 and better to be able to use sampler2DShadow Modified base materials (Lighting and Unshaded) to use only GLSL100 for post shadow pass * Corrected texture comparison function that were incorrectly changed * Added precision to samplers for GLESSL300 also * Created a subclass of Glsl150ShaderGenerator (Glsl300ShaderGenerator) to support ShaderNodes in GLES SL30 and included it's usage in DesktopAssetManager. Nowadays just copied and overwrote the version string. Needs a full review Added image format RGB16F to be used as texture format only in GLES30 (cannot be used as FB format) Added GLSL300 and/or GLSL310 to different materials * Cleaned GLSL300 generator Fixed shadows glsl lib removing use of GL_EXT_gpu_shaders5 * Fixed usag of textureCubeLod in fragment shader of envMapping which is unsupported in GLES2.0 Modified PBRLighting frag to properly compile on GLES3 * Added GLSL300 and 310 to PostShadowFilter material definition * Make post shadow filter use GLSL100 for GLSL300 Set highp as default precision to fix glitched shadows caused because not enough precision * Changed water_normalmap.dds to uncompressed RGB8 because DXT1 is mostly unsupported in GLES * Fixed GLES30 compilation issues in Water shaders and added GLSL300 to LightScattering material. ** Not fully tested * Added RGB8 dds formatted FullskiesSunset to be used in any platform. Previous file moved to _dtx1.dds * Set GL_TEXTURE_MAX_LEVEL in GLES30 contexts fixing issue with not fully mipmapped images and PBR rendering * Fixed compilation of jme3-android-examples and upgraded sdk version to use * Fixed Geometry Shader and Tessellation Shaders in testdata package to properly compile on GLES320 * Added non-compressed textures to be able to run all examples on android Enabled texture arrays and 3d textures on opengl es 3.0. Peding to implement wrappers to android gl functions (currently getting NullPointerException) * More GLES30 functions included to properly support texture arrays, 3d textures and multisampling matching jme core code * Fixed 3D texture tests for GLES30 Fixed texture 3D and texture array example shader compilation on GLES30 Fixed some random missing precision compilation errors on GLES30 * Fixed TestTextureArray for GLES30 * Some multisample additions and removal of GLES3 multisampling enable caps Added RGBA16F as valid format for GLES32 and using it by default in env camera instead of RGB16F. kept fall back to RGB8 * added float and half float formats for gles30 added rgb10a2 format for gles30 fixed usage of glTexImage2D removed EnvironmentCamera fallback image format as it's useless now * Added more image formats for GLES30 Fixed rgb8 if having Caps.Rgba8 * Enabled RadialBlur for gles30 * Fixed luminance texture formats for gles * Added more depth image formats for gles3 * Enabled multisampling in gles3 * Added GLES30 functions to GLDebugES Reverted TestTexture3D and TestTextureArray to use RGB8 format Updated EnvMapping100.frag to use EXT_shader_texture_lod in gles sl 100 if available * Removed all aditional not used compressed dds files Removed also Pond and rock png files previously used in TestTextureArray * Removed compressed water_normalmap_dxt1.dds * Changed GLES_30 and AndroidGL implementing GL2 to avoid duplicated code checking GL2 vs GLES30 * Added aditional checking to avoid gles30 calls from gles20 only devices
5 years ago
GLES20.glTexImage2D(target, level, internalFormat, width, height, 0, format, type, data);
}
public void glTexParameterf(int target, int pname, float param) {
GLES20.glTexParameterf(target, pname, param);
}
public void glTexParameteri(int target, int pname, int param) {
GLES20.glTexParameteri(target, pname, param);
}
public void glTexSubImage2D(int target, int level, int xoffset, int yoffset, int width, int height, int format, int type, ByteBuffer data) {
GLES20.glTexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, data);
}
public void glUniform1(int location, FloatBuffer value) {
GLES20.glUniform1fv(location, getLimitCount(value, 1), value);
}
public void glUniform1(int location, IntBuffer value) {
GLES20.glUniform1iv(location, getLimitCount(value, 1), value);
}
public void glUniform1f(int location, float v0) {
GLES20.glUniform1f(location, v0);
}
public void glUniform1i(int location, int v0) {
GLES20.glUniform1i(location, v0);
}
public void glUniform2(int location, IntBuffer value) {
GLES20.glUniform2iv(location, getLimitCount(value, 2), value);
}
public void glUniform2(int location, FloatBuffer value) {
GLES20.glUniform2fv(location, getLimitCount(value, 2), value);
}
public void glUniform2f(int location, float v0, float v1) {
GLES20.glUniform2f(location, v0, v1);
}
public void glUniform3(int location, IntBuffer value) {
GLES20.glUniform3iv(location, getLimitCount(value, 3), value);
}
public void glUniform3(int location, FloatBuffer value) {
GLES20.glUniform3fv(location, getLimitCount(value, 3), value);
}
public void glUniform3f(int location, float v0, float v1, float v2) {
GLES20.glUniform3f(location, v0, v1, v2);
}
public void glUniform4(int location, FloatBuffer value) {
GLES20.glUniform4fv(location, getLimitCount(value, 4), value);
}
public void glUniform4(int location, IntBuffer value) {
GLES20.glUniform4iv(location, getLimitCount(value, 4), value);
}
public void glUniform4f(int location, float v0, float v1, float v2, float v3) {
GLES20.glUniform4f(location, v0, v1, v2, v3);
}
public void glUniformMatrix3(int location, boolean transpose, FloatBuffer value) {
GLES20.glUniformMatrix3fv(location, getLimitCount(value, 3 * 3), transpose, value);
}
public void glUniformMatrix4(int location, boolean transpose, FloatBuffer value) {
GLES20.glUniformMatrix4fv(location, getLimitCount(value, 4 * 4), transpose, value);
}
public void glUseProgram(int program) {
GLES20.glUseProgram(program);
}
public void glVertexAttribPointer(int index, int size, int type, boolean normalized, int stride, long pointer) {
GLES20.glVertexAttribPointer(index, size, type, normalized, stride, (int)pointer);
}
public void glViewport(int x, int y, int width, int height) {
GLES20.glViewport(x, y, width, height);
}
public void glBlitFramebufferEXT(int srcX0, int srcY0, int srcX1, int srcY1, int dstX0, int dstY0, int dstX1, int dstY1, int mask, int filter) {
Android openGL ES 3 support (#1147) * Update GLImageFormats.java * Added basic support for openGL ES 3.0 and GLSL300 for android Added instancing support for android which is core feature in GLES3.0 Added fix for shadows in android * Fixed required types of GLES30.glDrawElementsInstanced * Properly check GLES3 version and setting precision for shaders for all GLSL ES versions * Added support for Opengl ES 3.1 and 3.2 and their shader versions Added proper checkings for new OpenGL ES versions Fixed some issues with shadow rendering in GLES 3.0 or better (strict type checking, OpenGL ES specific extensions and percision definition) Added GLSL320 and GLSL300 to Unshaded and Lighting materials * Added depth texture 24bit for OpenGL ES * Added geometry shaders and tessellation to GLES 3.1 as extension and GLES 3.2 as core Modified test materials to use GLSL310 * Added FB blit for android GLES30 * Added GlSL300 or better to all effects not able to run in GLSL100 Mods on Shadows.glsllib to try to fix android shadow rendering Fixed ssaoBlur.frag that was using a reserved word Fixed precision type missmatch from vertex to fragment shader * Partial multisample support Framebuffer MRT support * Temporarily removed texture multisampling (not being able to compile using GLES31) * Updated android.jar to api28 Enabled multisampling * Better checking for GLES3 * Removed insert precision for all shaders. This avoided some random precision missmatch error but created rendering issues * Removed border check for GLES, caused filtered shadows not to render on GLES2.0 devices Added texture compare mode for GLES3.0 and better to be able to use sampler2DShadow Modified base materials (Lighting and Unshaded) to use only GLSL100 for post shadow pass * Corrected texture comparison function that were incorrectly changed * Added precision to samplers for GLESSL300 also * Created a subclass of Glsl150ShaderGenerator (Glsl300ShaderGenerator) to support ShaderNodes in GLES SL30 and included it's usage in DesktopAssetManager. Nowadays just copied and overwrote the version string. Needs a full review Added image format RGB16F to be used as texture format only in GLES30 (cannot be used as FB format) Added GLSL300 and/or GLSL310 to different materials * Cleaned GLSL300 generator Fixed shadows glsl lib removing use of GL_EXT_gpu_shaders5 * Fixed usag of textureCubeLod in fragment shader of envMapping which is unsupported in GLES2.0 Modified PBRLighting frag to properly compile on GLES3 * Added GLSL300 and 310 to PostShadowFilter material definition * Make post shadow filter use GLSL100 for GLSL300 Set highp as default precision to fix glitched shadows caused because not enough precision * Changed water_normalmap.dds to uncompressed RGB8 because DXT1 is mostly unsupported in GLES * Fixed GLES30 compilation issues in Water shaders and added GLSL300 to LightScattering material. ** Not fully tested * Added RGB8 dds formatted FullskiesSunset to be used in any platform. Previous file moved to _dtx1.dds * Set GL_TEXTURE_MAX_LEVEL in GLES30 contexts fixing issue with not fully mipmapped images and PBR rendering * Fixed compilation of jme3-android-examples and upgraded sdk version to use * Fixed Geometry Shader and Tessellation Shaders in testdata package to properly compile on GLES320 * Added non-compressed textures to be able to run all examples on android Enabled texture arrays and 3d textures on opengl es 3.0. Peding to implement wrappers to android gl functions (currently getting NullPointerException) * More GLES30 functions included to properly support texture arrays, 3d textures and multisampling matching jme core code * Fixed 3D texture tests for GLES30 Fixed texture 3D and texture array example shader compilation on GLES30 Fixed some random missing precision compilation errors on GLES30 * Fixed TestTextureArray for GLES30 * Some multisample additions and removal of GLES3 multisampling enable caps Added RGBA16F as valid format for GLES32 and using it by default in env camera instead of RGB16F. kept fall back to RGB8 * added float and half float formats for gles30 added rgb10a2 format for gles30 fixed usage of glTexImage2D removed EnvironmentCamera fallback image format as it's useless now * Added more image formats for GLES30 Fixed rgb8 if having Caps.Rgba8 * Enabled RadialBlur for gles30 * Fixed luminance texture formats for gles * Added more depth image formats for gles3 * Enabled multisampling in gles3 * Added GLES30 functions to GLDebugES Reverted TestTexture3D and TestTextureArray to use RGB8 format Updated EnvMapping100.frag to use EXT_shader_texture_lod in gles sl 100 if available * Removed all aditional not used compressed dds files Removed also Pond and rock png files previously used in TestTextureArray * Removed compressed water_normalmap_dxt1.dds * Changed GLES_30 and AndroidGL implementing GL2 to avoid duplicated code checking GL2 vs GLES30 * Added aditional checking to avoid gles30 calls from gles20 only devices
5 years ago
GLES30.glBlitFramebuffer(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter);
}
public void glBufferData(int target, IntBuffer data, int usage) {
GLES20.glBufferData(target, getLimitBytes(data), data, usage);
}
public void glBufferSubData(int target, long offset, IntBuffer data) {
GLES20.glBufferSubData(target, (int)offset, getLimitBytes(data), data);
}
public void glDrawArraysInstancedARB(int mode, int first, int count, int primcount) {
Android openGL ES 3 support (#1147) * Update GLImageFormats.java * Added basic support for openGL ES 3.0 and GLSL300 for android Added instancing support for android which is core feature in GLES3.0 Added fix for shadows in android * Fixed required types of GLES30.glDrawElementsInstanced * Properly check GLES3 version and setting precision for shaders for all GLSL ES versions * Added support for Opengl ES 3.1 and 3.2 and their shader versions Added proper checkings for new OpenGL ES versions Fixed some issues with shadow rendering in GLES 3.0 or better (strict type checking, OpenGL ES specific extensions and percision definition) Added GLSL320 and GLSL300 to Unshaded and Lighting materials * Added depth texture 24bit for OpenGL ES * Added geometry shaders and tessellation to GLES 3.1 as extension and GLES 3.2 as core Modified test materials to use GLSL310 * Added FB blit for android GLES30 * Added GlSL300 or better to all effects not able to run in GLSL100 Mods on Shadows.glsllib to try to fix android shadow rendering Fixed ssaoBlur.frag that was using a reserved word Fixed precision type missmatch from vertex to fragment shader * Partial multisample support Framebuffer MRT support * Temporarily removed texture multisampling (not being able to compile using GLES31) * Updated android.jar to api28 Enabled multisampling * Better checking for GLES3 * Removed insert precision for all shaders. This avoided some random precision missmatch error but created rendering issues * Removed border check for GLES, caused filtered shadows not to render on GLES2.0 devices Added texture compare mode for GLES3.0 and better to be able to use sampler2DShadow Modified base materials (Lighting and Unshaded) to use only GLSL100 for post shadow pass * Corrected texture comparison function that were incorrectly changed * Added precision to samplers for GLESSL300 also * Created a subclass of Glsl150ShaderGenerator (Glsl300ShaderGenerator) to support ShaderNodes in GLES SL30 and included it's usage in DesktopAssetManager. Nowadays just copied and overwrote the version string. Needs a full review Added image format RGB16F to be used as texture format only in GLES30 (cannot be used as FB format) Added GLSL300 and/or GLSL310 to different materials * Cleaned GLSL300 generator Fixed shadows glsl lib removing use of GL_EXT_gpu_shaders5 * Fixed usag of textureCubeLod in fragment shader of envMapping which is unsupported in GLES2.0 Modified PBRLighting frag to properly compile on GLES3 * Added GLSL300 and 310 to PostShadowFilter material definition * Make post shadow filter use GLSL100 for GLSL300 Set highp as default precision to fix glitched shadows caused because not enough precision * Changed water_normalmap.dds to uncompressed RGB8 because DXT1 is mostly unsupported in GLES * Fixed GLES30 compilation issues in Water shaders and added GLSL300 to LightScattering material. ** Not fully tested * Added RGB8 dds formatted FullskiesSunset to be used in any platform. Previous file moved to _dtx1.dds * Set GL_TEXTURE_MAX_LEVEL in GLES30 contexts fixing issue with not fully mipmapped images and PBR rendering * Fixed compilation of jme3-android-examples and upgraded sdk version to use * Fixed Geometry Shader and Tessellation Shaders in testdata package to properly compile on GLES320 * Added non-compressed textures to be able to run all examples on android Enabled texture arrays and 3d textures on opengl es 3.0. Peding to implement wrappers to android gl functions (currently getting NullPointerException) * More GLES30 functions included to properly support texture arrays, 3d textures and multisampling matching jme core code * Fixed 3D texture tests for GLES30 Fixed texture 3D and texture array example shader compilation on GLES30 Fixed some random missing precision compilation errors on GLES30 * Fixed TestTextureArray for GLES30 * Some multisample additions and removal of GLES3 multisampling enable caps Added RGBA16F as valid format for GLES32 and using it by default in env camera instead of RGB16F. kept fall back to RGB8 * added float and half float formats for gles30 added rgb10a2 format for gles30 fixed usage of glTexImage2D removed EnvironmentCamera fallback image format as it's useless now * Added more image formats for GLES30 Fixed rgb8 if having Caps.Rgba8 * Enabled RadialBlur for gles30 * Fixed luminance texture formats for gles * Added more depth image formats for gles3 * Enabled multisampling in gles3 * Added GLES30 functions to GLDebugES Reverted TestTexture3D and TestTextureArray to use RGB8 format Updated EnvMapping100.frag to use EXT_shader_texture_lod in gles sl 100 if available * Removed all aditional not used compressed dds files Removed also Pond and rock png files previously used in TestTextureArray * Removed compressed water_normalmap_dxt1.dds * Changed GLES_30 and AndroidGL implementing GL2 to avoid duplicated code checking GL2 vs GLES30 * Added aditional checking to avoid gles30 calls from gles20 only devices
5 years ago
GLES30.glDrawArraysInstanced(mode, first, count, primcount);
}
public void glDrawBuffers(IntBuffer bufs) {
Android openGL ES 3 support (#1147) * Update GLImageFormats.java * Added basic support for openGL ES 3.0 and GLSL300 for android Added instancing support for android which is core feature in GLES3.0 Added fix for shadows in android * Fixed required types of GLES30.glDrawElementsInstanced * Properly check GLES3 version and setting precision for shaders for all GLSL ES versions * Added support for Opengl ES 3.1 and 3.2 and their shader versions Added proper checkings for new OpenGL ES versions Fixed some issues with shadow rendering in GLES 3.0 or better (strict type checking, OpenGL ES specific extensions and percision definition) Added GLSL320 and GLSL300 to Unshaded and Lighting materials * Added depth texture 24bit for OpenGL ES * Added geometry shaders and tessellation to GLES 3.1 as extension and GLES 3.2 as core Modified test materials to use GLSL310 * Added FB blit for android GLES30 * Added GlSL300 or better to all effects not able to run in GLSL100 Mods on Shadows.glsllib to try to fix android shadow rendering Fixed ssaoBlur.frag that was using a reserved word Fixed precision type missmatch from vertex to fragment shader * Partial multisample support Framebuffer MRT support * Temporarily removed texture multisampling (not being able to compile using GLES31) * Updated android.jar to api28 Enabled multisampling * Better checking for GLES3 * Removed insert precision for all shaders. This avoided some random precision missmatch error but created rendering issues * Removed border check for GLES, caused filtered shadows not to render on GLES2.0 devices Added texture compare mode for GLES3.0 and better to be able to use sampler2DShadow Modified base materials (Lighting and Unshaded) to use only GLSL100 for post shadow pass * Corrected texture comparison function that were incorrectly changed * Added precision to samplers for GLESSL300 also * Created a subclass of Glsl150ShaderGenerator (Glsl300ShaderGenerator) to support ShaderNodes in GLES SL30 and included it's usage in DesktopAssetManager. Nowadays just copied and overwrote the version string. Needs a full review Added image format RGB16F to be used as texture format only in GLES30 (cannot be used as FB format) Added GLSL300 and/or GLSL310 to different materials * Cleaned GLSL300 generator Fixed shadows glsl lib removing use of GL_EXT_gpu_shaders5 * Fixed usag of textureCubeLod in fragment shader of envMapping which is unsupported in GLES2.0 Modified PBRLighting frag to properly compile on GLES3 * Added GLSL300 and 310 to PostShadowFilter material definition * Make post shadow filter use GLSL100 for GLSL300 Set highp as default precision to fix glitched shadows caused because not enough precision * Changed water_normalmap.dds to uncompressed RGB8 because DXT1 is mostly unsupported in GLES * Fixed GLES30 compilation issues in Water shaders and added GLSL300 to LightScattering material. ** Not fully tested * Added RGB8 dds formatted FullskiesSunset to be used in any platform. Previous file moved to _dtx1.dds * Set GL_TEXTURE_MAX_LEVEL in GLES30 contexts fixing issue with not fully mipmapped images and PBR rendering * Fixed compilation of jme3-android-examples and upgraded sdk version to use * Fixed Geometry Shader and Tessellation Shaders in testdata package to properly compile on GLES320 * Added non-compressed textures to be able to run all examples on android Enabled texture arrays and 3d textures on opengl es 3.0. Peding to implement wrappers to android gl functions (currently getting NullPointerException) * More GLES30 functions included to properly support texture arrays, 3d textures and multisampling matching jme core code * Fixed 3D texture tests for GLES30 Fixed texture 3D and texture array example shader compilation on GLES30 Fixed some random missing precision compilation errors on GLES30 * Fixed TestTextureArray for GLES30 * Some multisample additions and removal of GLES3 multisampling enable caps Added RGBA16F as valid format for GLES32 and using it by default in env camera instead of RGB16F. kept fall back to RGB8 * added float and half float formats for gles30 added rgb10a2 format for gles30 fixed usage of glTexImage2D removed EnvironmentCamera fallback image format as it's useless now * Added more image formats for GLES30 Fixed rgb8 if having Caps.Rgba8 * Enabled RadialBlur for gles30 * Fixed luminance texture formats for gles * Added more depth image formats for gles3 * Enabled multisampling in gles3 * Added GLES30 functions to GLDebugES Reverted TestTexture3D and TestTextureArray to use RGB8 format Updated EnvMapping100.frag to use EXT_shader_texture_lod in gles sl 100 if available * Removed all aditional not used compressed dds files Removed also Pond and rock png files previously used in TestTextureArray * Removed compressed water_normalmap_dxt1.dds * Changed GLES_30 and AndroidGL implementing GL2 to avoid duplicated code checking GL2 vs GLES30 * Added aditional checking to avoid gles30 calls from gles20 only devices
5 years ago
GLES30.glDrawBuffers(bufs.limit(), bufs);
}
public void glDrawElementsInstancedARB(int mode, int indices_count, int type, long indices_buffer_offset, int primcount) {
Android openGL ES 3 support (#1147) * Update GLImageFormats.java * Added basic support for openGL ES 3.0 and GLSL300 for android Added instancing support for android which is core feature in GLES3.0 Added fix for shadows in android * Fixed required types of GLES30.glDrawElementsInstanced * Properly check GLES3 version and setting precision for shaders for all GLSL ES versions * Added support for Opengl ES 3.1 and 3.2 and their shader versions Added proper checkings for new OpenGL ES versions Fixed some issues with shadow rendering in GLES 3.0 or better (strict type checking, OpenGL ES specific extensions and percision definition) Added GLSL320 and GLSL300 to Unshaded and Lighting materials * Added depth texture 24bit for OpenGL ES * Added geometry shaders and tessellation to GLES 3.1 as extension and GLES 3.2 as core Modified test materials to use GLSL310 * Added FB blit for android GLES30 * Added GlSL300 or better to all effects not able to run in GLSL100 Mods on Shadows.glsllib to try to fix android shadow rendering Fixed ssaoBlur.frag that was using a reserved word Fixed precision type missmatch from vertex to fragment shader * Partial multisample support Framebuffer MRT support * Temporarily removed texture multisampling (not being able to compile using GLES31) * Updated android.jar to api28 Enabled multisampling * Better checking for GLES3 * Removed insert precision for all shaders. This avoided some random precision missmatch error but created rendering issues * Removed border check for GLES, caused filtered shadows not to render on GLES2.0 devices Added texture compare mode for GLES3.0 and better to be able to use sampler2DShadow Modified base materials (Lighting and Unshaded) to use only GLSL100 for post shadow pass * Corrected texture comparison function that were incorrectly changed * Added precision to samplers for GLESSL300 also * Created a subclass of Glsl150ShaderGenerator (Glsl300ShaderGenerator) to support ShaderNodes in GLES SL30 and included it's usage in DesktopAssetManager. Nowadays just copied and overwrote the version string. Needs a full review Added image format RGB16F to be used as texture format only in GLES30 (cannot be used as FB format) Added GLSL300 and/or GLSL310 to different materials * Cleaned GLSL300 generator Fixed shadows glsl lib removing use of GL_EXT_gpu_shaders5 * Fixed usag of textureCubeLod in fragment shader of envMapping which is unsupported in GLES2.0 Modified PBRLighting frag to properly compile on GLES3 * Added GLSL300 and 310 to PostShadowFilter material definition * Make post shadow filter use GLSL100 for GLSL300 Set highp as default precision to fix glitched shadows caused because not enough precision * Changed water_normalmap.dds to uncompressed RGB8 because DXT1 is mostly unsupported in GLES * Fixed GLES30 compilation issues in Water shaders and added GLSL300 to LightScattering material. ** Not fully tested * Added RGB8 dds formatted FullskiesSunset to be used in any platform. Previous file moved to _dtx1.dds * Set GL_TEXTURE_MAX_LEVEL in GLES30 contexts fixing issue with not fully mipmapped images and PBR rendering * Fixed compilation of jme3-android-examples and upgraded sdk version to use * Fixed Geometry Shader and Tessellation Shaders in testdata package to properly compile on GLES320 * Added non-compressed textures to be able to run all examples on android Enabled texture arrays and 3d textures on opengl es 3.0. Peding to implement wrappers to android gl functions (currently getting NullPointerException) * More GLES30 functions included to properly support texture arrays, 3d textures and multisampling matching jme core code * Fixed 3D texture tests for GLES30 Fixed texture 3D and texture array example shader compilation on GLES30 Fixed some random missing precision compilation errors on GLES30 * Fixed TestTextureArray for GLES30 * Some multisample additions and removal of GLES3 multisampling enable caps Added RGBA16F as valid format for GLES32 and using it by default in env camera instead of RGB16F. kept fall back to RGB8 * added float and half float formats for gles30 added rgb10a2 format for gles30 fixed usage of glTexImage2D removed EnvironmentCamera fallback image format as it's useless now * Added more image formats for GLES30 Fixed rgb8 if having Caps.Rgba8 * Enabled RadialBlur for gles30 * Fixed luminance texture formats for gles * Added more depth image formats for gles3 * Enabled multisampling in gles3 * Added GLES30 functions to GLDebugES Reverted TestTexture3D and TestTextureArray to use RGB8 format Updated EnvMapping100.frag to use EXT_shader_texture_lod in gles sl 100 if available * Removed all aditional not used compressed dds files Removed also Pond and rock png files previously used in TestTextureArray * Removed compressed water_normalmap_dxt1.dds * Changed GLES_30 and AndroidGL implementing GL2 to avoid duplicated code checking GL2 vs GLES30 * Added aditional checking to avoid gles30 calls from gles20 only devices
5 years ago
GLES30.glDrawElementsInstanced(mode, indices_count, type, (int)indices_buffer_offset, primcount);
}
public void glGetMultisample(int pname, int index, FloatBuffer val) {
Android openGL ES 3 support (#1147) * Update GLImageFormats.java * Added basic support for openGL ES 3.0 and GLSL300 for android Added instancing support for android which is core feature in GLES3.0 Added fix for shadows in android * Fixed required types of GLES30.glDrawElementsInstanced * Properly check GLES3 version and setting precision for shaders for all GLSL ES versions * Added support for Opengl ES 3.1 and 3.2 and their shader versions Added proper checkings for new OpenGL ES versions Fixed some issues with shadow rendering in GLES 3.0 or better (strict type checking, OpenGL ES specific extensions and percision definition) Added GLSL320 and GLSL300 to Unshaded and Lighting materials * Added depth texture 24bit for OpenGL ES * Added geometry shaders and tessellation to GLES 3.1 as extension and GLES 3.2 as core Modified test materials to use GLSL310 * Added FB blit for android GLES30 * Added GlSL300 or better to all effects not able to run in GLSL100 Mods on Shadows.glsllib to try to fix android shadow rendering Fixed ssaoBlur.frag that was using a reserved word Fixed precision type missmatch from vertex to fragment shader * Partial multisample support Framebuffer MRT support * Temporarily removed texture multisampling (not being able to compile using GLES31) * Updated android.jar to api28 Enabled multisampling * Better checking for GLES3 * Removed insert precision for all shaders. This avoided some random precision missmatch error but created rendering issues * Removed border check for GLES, caused filtered shadows not to render on GLES2.0 devices Added texture compare mode for GLES3.0 and better to be able to use sampler2DShadow Modified base materials (Lighting and Unshaded) to use only GLSL100 for post shadow pass * Corrected texture comparison function that were incorrectly changed * Added precision to samplers for GLESSL300 also * Created a subclass of Glsl150ShaderGenerator (Glsl300ShaderGenerator) to support ShaderNodes in GLES SL30 and included it's usage in DesktopAssetManager. Nowadays just copied and overwrote the version string. Needs a full review Added image format RGB16F to be used as texture format only in GLES30 (cannot be used as FB format) Added GLSL300 and/or GLSL310 to different materials * Cleaned GLSL300 generator Fixed shadows glsl lib removing use of GL_EXT_gpu_shaders5 * Fixed usag of textureCubeLod in fragment shader of envMapping which is unsupported in GLES2.0 Modified PBRLighting frag to properly compile on GLES3 * Added GLSL300 and 310 to PostShadowFilter material definition * Make post shadow filter use GLSL100 for GLSL300 Set highp as default precision to fix glitched shadows caused because not enough precision * Changed water_normalmap.dds to uncompressed RGB8 because DXT1 is mostly unsupported in GLES * Fixed GLES30 compilation issues in Water shaders and added GLSL300 to LightScattering material. ** Not fully tested * Added RGB8 dds formatted FullskiesSunset to be used in any platform. Previous file moved to _dtx1.dds * Set GL_TEXTURE_MAX_LEVEL in GLES30 contexts fixing issue with not fully mipmapped images and PBR rendering * Fixed compilation of jme3-android-examples and upgraded sdk version to use * Fixed Geometry Shader and Tessellation Shaders in testdata package to properly compile on GLES320 * Added non-compressed textures to be able to run all examples on android Enabled texture arrays and 3d textures on opengl es 3.0. Peding to implement wrappers to android gl functions (currently getting NullPointerException) * More GLES30 functions included to properly support texture arrays, 3d textures and multisampling matching jme core code * Fixed 3D texture tests for GLES30 Fixed texture 3D and texture array example shader compilation on GLES30 Fixed some random missing precision compilation errors on GLES30 * Fixed TestTextureArray for GLES30 * Some multisample additions and removal of GLES3 multisampling enable caps Added RGBA16F as valid format for GLES32 and using it by default in env camera instead of RGB16F. kept fall back to RGB8 * added float and half float formats for gles30 added rgb10a2 format for gles30 fixed usage of glTexImage2D removed EnvironmentCamera fallback image format as it's useless now * Added more image formats for GLES30 Fixed rgb8 if having Caps.Rgba8 * Enabled RadialBlur for gles30 * Fixed luminance texture formats for gles * Added more depth image formats for gles3 * Enabled multisampling in gles3 * Added GLES30 functions to GLDebugES Reverted TestTexture3D and TestTextureArray to use RGB8 format Updated EnvMapping100.frag to use EXT_shader_texture_lod in gles sl 100 if available * Removed all aditional not used compressed dds files Removed also Pond and rock png files previously used in TestTextureArray * Removed compressed water_normalmap_dxt1.dds * Changed GLES_30 and AndroidGL implementing GL2 to avoid duplicated code checking GL2 vs GLES30 * Added aditional checking to avoid gles30 calls from gles20 only devices
5 years ago
GLES31.glGetMultisamplefv(pname, index, val);
}
public void glRenderbufferStorageMultisampleEXT(int target, int samples, int internalformat, int width, int height) {
Android openGL ES 3 support (#1147) * Update GLImageFormats.java * Added basic support for openGL ES 3.0 and GLSL300 for android Added instancing support for android which is core feature in GLES3.0 Added fix for shadows in android * Fixed required types of GLES30.glDrawElementsInstanced * Properly check GLES3 version and setting precision for shaders for all GLSL ES versions * Added support for Opengl ES 3.1 and 3.2 and their shader versions Added proper checkings for new OpenGL ES versions Fixed some issues with shadow rendering in GLES 3.0 or better (strict type checking, OpenGL ES specific extensions and percision definition) Added GLSL320 and GLSL300 to Unshaded and Lighting materials * Added depth texture 24bit for OpenGL ES * Added geometry shaders and tessellation to GLES 3.1 as extension and GLES 3.2 as core Modified test materials to use GLSL310 * Added FB blit for android GLES30 * Added GlSL300 or better to all effects not able to run in GLSL100 Mods on Shadows.glsllib to try to fix android shadow rendering Fixed ssaoBlur.frag that was using a reserved word Fixed precision type missmatch from vertex to fragment shader * Partial multisample support Framebuffer MRT support * Temporarily removed texture multisampling (not being able to compile using GLES31) * Updated android.jar to api28 Enabled multisampling * Better checking for GLES3 * Removed insert precision for all shaders. This avoided some random precision missmatch error but created rendering issues * Removed border check for GLES, caused filtered shadows not to render on GLES2.0 devices Added texture compare mode for GLES3.0 and better to be able to use sampler2DShadow Modified base materials (Lighting and Unshaded) to use only GLSL100 for post shadow pass * Corrected texture comparison function that were incorrectly changed * Added precision to samplers for GLESSL300 also * Created a subclass of Glsl150ShaderGenerator (Glsl300ShaderGenerator) to support ShaderNodes in GLES SL30 and included it's usage in DesktopAssetManager. Nowadays just copied and overwrote the version string. Needs a full review Added image format RGB16F to be used as texture format only in GLES30 (cannot be used as FB format) Added GLSL300 and/or GLSL310 to different materials * Cleaned GLSL300 generator Fixed shadows glsl lib removing use of GL_EXT_gpu_shaders5 * Fixed usag of textureCubeLod in fragment shader of envMapping which is unsupported in GLES2.0 Modified PBRLighting frag to properly compile on GLES3 * Added GLSL300 and 310 to PostShadowFilter material definition * Make post shadow filter use GLSL100 for GLSL300 Set highp as default precision to fix glitched shadows caused because not enough precision * Changed water_normalmap.dds to uncompressed RGB8 because DXT1 is mostly unsupported in GLES * Fixed GLES30 compilation issues in Water shaders and added GLSL300 to LightScattering material. ** Not fully tested * Added RGB8 dds formatted FullskiesSunset to be used in any platform. Previous file moved to _dtx1.dds * Set GL_TEXTURE_MAX_LEVEL in GLES30 contexts fixing issue with not fully mipmapped images and PBR rendering * Fixed compilation of jme3-android-examples and upgraded sdk version to use * Fixed Geometry Shader and Tessellation Shaders in testdata package to properly compile on GLES320 * Added non-compressed textures to be able to run all examples on android Enabled texture arrays and 3d textures on opengl es 3.0. Peding to implement wrappers to android gl functions (currently getting NullPointerException) * More GLES30 functions included to properly support texture arrays, 3d textures and multisampling matching jme core code * Fixed 3D texture tests for GLES30 Fixed texture 3D and texture array example shader compilation on GLES30 Fixed some random missing precision compilation errors on GLES30 * Fixed TestTextureArray for GLES30 * Some multisample additions and removal of GLES3 multisampling enable caps Added RGBA16F as valid format for GLES32 and using it by default in env camera instead of RGB16F. kept fall back to RGB8 * added float and half float formats for gles30 added rgb10a2 format for gles30 fixed usage of glTexImage2D removed EnvironmentCamera fallback image format as it's useless now * Added more image formats for GLES30 Fixed rgb8 if having Caps.Rgba8 * Enabled RadialBlur for gles30 * Fixed luminance texture formats for gles * Added more depth image formats for gles3 * Enabled multisampling in gles3 * Added GLES30 functions to GLDebugES Reverted TestTexture3D and TestTextureArray to use RGB8 format Updated EnvMapping100.frag to use EXT_shader_texture_lod in gles sl 100 if available * Removed all aditional not used compressed dds files Removed also Pond and rock png files previously used in TestTextureArray * Removed compressed water_normalmap_dxt1.dds * Changed GLES_30 and AndroidGL implementing GL2 to avoid duplicated code checking GL2 vs GLES30 * Added aditional checking to avoid gles30 calls from gles20 only devices
5 years ago
GLES30.glRenderbufferStorageMultisample(target, samples, internalformat, width, height);
}
public void glTexImage2DMultisample(int target, int samples, int internalformat, int width, int height, boolean fixedsamplelocations) {
Android openGL ES 3 support (#1147) * Update GLImageFormats.java * Added basic support for openGL ES 3.0 and GLSL300 for android Added instancing support for android which is core feature in GLES3.0 Added fix for shadows in android * Fixed required types of GLES30.glDrawElementsInstanced * Properly check GLES3 version and setting precision for shaders for all GLSL ES versions * Added support for Opengl ES 3.1 and 3.2 and their shader versions Added proper checkings for new OpenGL ES versions Fixed some issues with shadow rendering in GLES 3.0 or better (strict type checking, OpenGL ES specific extensions and percision definition) Added GLSL320 and GLSL300 to Unshaded and Lighting materials * Added depth texture 24bit for OpenGL ES * Added geometry shaders and tessellation to GLES 3.1 as extension and GLES 3.2 as core Modified test materials to use GLSL310 * Added FB blit for android GLES30 * Added GlSL300 or better to all effects not able to run in GLSL100 Mods on Shadows.glsllib to try to fix android shadow rendering Fixed ssaoBlur.frag that was using a reserved word Fixed precision type missmatch from vertex to fragment shader * Partial multisample support Framebuffer MRT support * Temporarily removed texture multisampling (not being able to compile using GLES31) * Updated android.jar to api28 Enabled multisampling * Better checking for GLES3 * Removed insert precision for all shaders. This avoided some random precision missmatch error but created rendering issues * Removed border check for GLES, caused filtered shadows not to render on GLES2.0 devices Added texture compare mode for GLES3.0 and better to be able to use sampler2DShadow Modified base materials (Lighting and Unshaded) to use only GLSL100 for post shadow pass * Corrected texture comparison function that were incorrectly changed * Added precision to samplers for GLESSL300 also * Created a subclass of Glsl150ShaderGenerator (Glsl300ShaderGenerator) to support ShaderNodes in GLES SL30 and included it's usage in DesktopAssetManager. Nowadays just copied and overwrote the version string. Needs a full review Added image format RGB16F to be used as texture format only in GLES30 (cannot be used as FB format) Added GLSL300 and/or GLSL310 to different materials * Cleaned GLSL300 generator Fixed shadows glsl lib removing use of GL_EXT_gpu_shaders5 * Fixed usag of textureCubeLod in fragment shader of envMapping which is unsupported in GLES2.0 Modified PBRLighting frag to properly compile on GLES3 * Added GLSL300 and 310 to PostShadowFilter material definition * Make post shadow filter use GLSL100 for GLSL300 Set highp as default precision to fix glitched shadows caused because not enough precision * Changed water_normalmap.dds to uncompressed RGB8 because DXT1 is mostly unsupported in GLES * Fixed GLES30 compilation issues in Water shaders and added GLSL300 to LightScattering material. ** Not fully tested * Added RGB8 dds formatted FullskiesSunset to be used in any platform. Previous file moved to _dtx1.dds * Set GL_TEXTURE_MAX_LEVEL in GLES30 contexts fixing issue with not fully mipmapped images and PBR rendering * Fixed compilation of jme3-android-examples and upgraded sdk version to use * Fixed Geometry Shader and Tessellation Shaders in testdata package to properly compile on GLES320 * Added non-compressed textures to be able to run all examples on android Enabled texture arrays and 3d textures on opengl es 3.0. Peding to implement wrappers to android gl functions (currently getting NullPointerException) * More GLES30 functions included to properly support texture arrays, 3d textures and multisampling matching jme core code * Fixed 3D texture tests for GLES30 Fixed texture 3D and texture array example shader compilation on GLES30 Fixed some random missing precision compilation errors on GLES30 * Fixed TestTextureArray for GLES30 * Some multisample additions and removal of GLES3 multisampling enable caps Added RGBA16F as valid format for GLES32 and using it by default in env camera instead of RGB16F. kept fall back to RGB8 * added float and half float formats for gles30 added rgb10a2 format for gles30 fixed usage of glTexImage2D removed EnvironmentCamera fallback image format as it's useless now * Added more image formats for GLES30 Fixed rgb8 if having Caps.Rgba8 * Enabled RadialBlur for gles30 * Fixed luminance texture formats for gles * Added more depth image formats for gles3 * Enabled multisampling in gles3 * Added GLES30 functions to GLDebugES Reverted TestTexture3D and TestTextureArray to use RGB8 format Updated EnvMapping100.frag to use EXT_shader_texture_lod in gles sl 100 if available * Removed all aditional not used compressed dds files Removed also Pond and rock png files previously used in TestTextureArray * Removed compressed water_normalmap_dxt1.dds * Changed GLES_30 and AndroidGL implementing GL2 to avoid duplicated code checking GL2 vs GLES30 * Added aditional checking to avoid gles30 calls from gles20 only devices
5 years ago
GLES31.glTexStorage2DMultisample(target, samples, internalformat, width, height, fixedsamplelocations);
}
public void glVertexAttribDivisorARB(int index, int divisor) {
Android openGL ES 3 support (#1147) * Update GLImageFormats.java * Added basic support for openGL ES 3.0 and GLSL300 for android Added instancing support for android which is core feature in GLES3.0 Added fix for shadows in android * Fixed required types of GLES30.glDrawElementsInstanced * Properly check GLES3 version and setting precision for shaders for all GLSL ES versions * Added support for Opengl ES 3.1 and 3.2 and their shader versions Added proper checkings for new OpenGL ES versions Fixed some issues with shadow rendering in GLES 3.0 or better (strict type checking, OpenGL ES specific extensions and percision definition) Added GLSL320 and GLSL300 to Unshaded and Lighting materials * Added depth texture 24bit for OpenGL ES * Added geometry shaders and tessellation to GLES 3.1 as extension and GLES 3.2 as core Modified test materials to use GLSL310 * Added FB blit for android GLES30 * Added GlSL300 or better to all effects not able to run in GLSL100 Mods on Shadows.glsllib to try to fix android shadow rendering Fixed ssaoBlur.frag that was using a reserved word Fixed precision type missmatch from vertex to fragment shader * Partial multisample support Framebuffer MRT support * Temporarily removed texture multisampling (not being able to compile using GLES31) * Updated android.jar to api28 Enabled multisampling * Better checking for GLES3 * Removed insert precision for all shaders. This avoided some random precision missmatch error but created rendering issues * Removed border check for GLES, caused filtered shadows not to render on GLES2.0 devices Added texture compare mode for GLES3.0 and better to be able to use sampler2DShadow Modified base materials (Lighting and Unshaded) to use only GLSL100 for post shadow pass * Corrected texture comparison function that were incorrectly changed * Added precision to samplers for GLESSL300 also * Created a subclass of Glsl150ShaderGenerator (Glsl300ShaderGenerator) to support ShaderNodes in GLES SL30 and included it's usage in DesktopAssetManager. Nowadays just copied and overwrote the version string. Needs a full review Added image format RGB16F to be used as texture format only in GLES30 (cannot be used as FB format) Added GLSL300 and/or GLSL310 to different materials * Cleaned GLSL300 generator Fixed shadows glsl lib removing use of GL_EXT_gpu_shaders5 * Fixed usag of textureCubeLod in fragment shader of envMapping which is unsupported in GLES2.0 Modified PBRLighting frag to properly compile on GLES3 * Added GLSL300 and 310 to PostShadowFilter material definition * Make post shadow filter use GLSL100 for GLSL300 Set highp as default precision to fix glitched shadows caused because not enough precision * Changed water_normalmap.dds to uncompressed RGB8 because DXT1 is mostly unsupported in GLES * Fixed GLES30 compilation issues in Water shaders and added GLSL300 to LightScattering material. ** Not fully tested * Added RGB8 dds formatted FullskiesSunset to be used in any platform. Previous file moved to _dtx1.dds * Set GL_TEXTURE_MAX_LEVEL in GLES30 contexts fixing issue with not fully mipmapped images and PBR rendering * Fixed compilation of jme3-android-examples and upgraded sdk version to use * Fixed Geometry Shader and Tessellation Shaders in testdata package to properly compile on GLES320 * Added non-compressed textures to be able to run all examples on android Enabled texture arrays and 3d textures on opengl es 3.0. Peding to implement wrappers to android gl functions (currently getting NullPointerException) * More GLES30 functions included to properly support texture arrays, 3d textures and multisampling matching jme core code * Fixed 3D texture tests for GLES30 Fixed texture 3D and texture array example shader compilation on GLES30 Fixed some random missing precision compilation errors on GLES30 * Fixed TestTextureArray for GLES30 * Some multisample additions and removal of GLES3 multisampling enable caps Added RGBA16F as valid format for GLES32 and using it by default in env camera instead of RGB16F. kept fall back to RGB8 * added float and half float formats for gles30 added rgb10a2 format for gles30 fixed usage of glTexImage2D removed EnvironmentCamera fallback image format as it's useless now * Added more image formats for GLES30 Fixed rgb8 if having Caps.Rgba8 * Enabled RadialBlur for gles30 * Fixed luminance texture formats for gles * Added more depth image formats for gles3 * Enabled multisampling in gles3 * Added GLES30 functions to GLDebugES Reverted TestTexture3D and TestTextureArray to use RGB8 format Updated EnvMapping100.frag to use EXT_shader_texture_lod in gles sl 100 if available * Removed all aditional not used compressed dds files Removed also Pond and rock png files previously used in TestTextureArray * Removed compressed water_normalmap_dxt1.dds * Changed GLES_30 and AndroidGL implementing GL2 to avoid duplicated code checking GL2 vs GLES30 * Added aditional checking to avoid gles30 calls from gles20 only devices
5 years ago
GLES30.glVertexAttribDivisor(index, divisor);
}
public void glBindFramebufferEXT(int param1, int param2) {
GLES20.glBindFramebuffer(param1, param2);
}
public void glBindRenderbufferEXT(int param1, int param2) {
GLES20.glBindRenderbuffer(param1, param2);
}
public int glCheckFramebufferStatusEXT(int param1) {
return GLES20.glCheckFramebufferStatus(param1);
}
public void glDeleteFramebuffersEXT(IntBuffer param1) {
checkLimit(param1);
GLES20.glDeleteFramebuffers(param1.limit(), param1);
}
public void glDeleteRenderbuffersEXT(IntBuffer param1) {
checkLimit(param1);
GLES20.glDeleteRenderbuffers(param1.limit(), param1);
}
public void glFramebufferRenderbufferEXT(int param1, int param2, int param3, int param4) {
GLES20.glFramebufferRenderbuffer(param1, param2, param3, param4);
}
public void glFramebufferTexture2DEXT(int param1, int param2, int param3, int param4, int param5) {
GLES20.glFramebufferTexture2D(param1, param2, param3, param4, param5);
}
public void glGenFramebuffersEXT(IntBuffer param1) {
checkLimit(param1);
GLES20.glGenFramebuffers(param1.limit(), param1);
}
public void glGenRenderbuffersEXT(IntBuffer param1) {
checkLimit(param1);
GLES20.glGenRenderbuffers(param1.limit(), param1);
}
public void glGenerateMipmapEXT(int param1) {
GLES20.glGenerateMipmap(param1);
}
public void glRenderbufferStorageEXT(int param1, int param2, int param3, int param4) {
GLES20.glRenderbufferStorage(param1, param2, param3, param4);
}
@Override
public void glReadPixels(int x, int y, int width, int height, int format, int type, long offset) {
// TODO: no offset???
GLES20.glReadPixels(x, y, width, height, format, type, null);
}
@Override
public int glClientWaitSync(Object sync, int flags, long timeout) {
throw new UnsupportedOperationException("OpenGL ES 2 does not support sync fences");
}
@Override
public void glDeleteSync(Object sync) {
throw new UnsupportedOperationException("OpenGL ES 2 does not support sync fences");
}
@Override
public Object glFenceSync(int condition, int flags) {
throw new UnsupportedOperationException("OpenGL ES 2 does not support sync fences");
}
@Override
public void glBlendEquationSeparate(int colorMode, int alphaMode) {
GLES20.glBlendEquationSeparate(colorMode, alphaMode);
}
@Override
public void glFramebufferTextureLayerEXT(int target, int attachment, int texture, int level, int layer) {
Android openGL ES 3 support (#1147) * Update GLImageFormats.java * Added basic support for openGL ES 3.0 and GLSL300 for android Added instancing support for android which is core feature in GLES3.0 Added fix for shadows in android * Fixed required types of GLES30.glDrawElementsInstanced * Properly check GLES3 version and setting precision for shaders for all GLSL ES versions * Added support for Opengl ES 3.1 and 3.2 and their shader versions Added proper checkings for new OpenGL ES versions Fixed some issues with shadow rendering in GLES 3.0 or better (strict type checking, OpenGL ES specific extensions and percision definition) Added GLSL320 and GLSL300 to Unshaded and Lighting materials * Added depth texture 24bit for OpenGL ES * Added geometry shaders and tessellation to GLES 3.1 as extension and GLES 3.2 as core Modified test materials to use GLSL310 * Added FB blit for android GLES30 * Added GlSL300 or better to all effects not able to run in GLSL100 Mods on Shadows.glsllib to try to fix android shadow rendering Fixed ssaoBlur.frag that was using a reserved word Fixed precision type missmatch from vertex to fragment shader * Partial multisample support Framebuffer MRT support * Temporarily removed texture multisampling (not being able to compile using GLES31) * Updated android.jar to api28 Enabled multisampling * Better checking for GLES3 * Removed insert precision for all shaders. This avoided some random precision missmatch error but created rendering issues * Removed border check for GLES, caused filtered shadows not to render on GLES2.0 devices Added texture compare mode for GLES3.0 and better to be able to use sampler2DShadow Modified base materials (Lighting and Unshaded) to use only GLSL100 for post shadow pass * Corrected texture comparison function that were incorrectly changed * Added precision to samplers for GLESSL300 also * Created a subclass of Glsl150ShaderGenerator (Glsl300ShaderGenerator) to support ShaderNodes in GLES SL30 and included it's usage in DesktopAssetManager. Nowadays just copied and overwrote the version string. Needs a full review Added image format RGB16F to be used as texture format only in GLES30 (cannot be used as FB format) Added GLSL300 and/or GLSL310 to different materials * Cleaned GLSL300 generator Fixed shadows glsl lib removing use of GL_EXT_gpu_shaders5 * Fixed usag of textureCubeLod in fragment shader of envMapping which is unsupported in GLES2.0 Modified PBRLighting frag to properly compile on GLES3 * Added GLSL300 and 310 to PostShadowFilter material definition * Make post shadow filter use GLSL100 for GLSL300 Set highp as default precision to fix glitched shadows caused because not enough precision * Changed water_normalmap.dds to uncompressed RGB8 because DXT1 is mostly unsupported in GLES * Fixed GLES30 compilation issues in Water shaders and added GLSL300 to LightScattering material. ** Not fully tested * Added RGB8 dds formatted FullskiesSunset to be used in any platform. Previous file moved to _dtx1.dds * Set GL_TEXTURE_MAX_LEVEL in GLES30 contexts fixing issue with not fully mipmapped images and PBR rendering * Fixed compilation of jme3-android-examples and upgraded sdk version to use * Fixed Geometry Shader and Tessellation Shaders in testdata package to properly compile on GLES320 * Added non-compressed textures to be able to run all examples on android Enabled texture arrays and 3d textures on opengl es 3.0. Peding to implement wrappers to android gl functions (currently getting NullPointerException) * More GLES30 functions included to properly support texture arrays, 3d textures and multisampling matching jme core code * Fixed 3D texture tests for GLES30 Fixed texture 3D and texture array example shader compilation on GLES30 Fixed some random missing precision compilation errors on GLES30 * Fixed TestTextureArray for GLES30 * Some multisample additions and removal of GLES3 multisampling enable caps Added RGBA16F as valid format for GLES32 and using it by default in env camera instead of RGB16F. kept fall back to RGB8 * added float and half float formats for gles30 added rgb10a2 format for gles30 fixed usage of glTexImage2D removed EnvironmentCamera fallback image format as it's useless now * Added more image formats for GLES30 Fixed rgb8 if having Caps.Rgba8 * Enabled RadialBlur for gles30 * Fixed luminance texture formats for gles * Added more depth image formats for gles3 * Enabled multisampling in gles3 * Added GLES30 functions to GLDebugES Reverted TestTexture3D and TestTextureArray to use RGB8 format Updated EnvMapping100.frag to use EXT_shader_texture_lod in gles sl 100 if available * Removed all aditional not used compressed dds files Removed also Pond and rock png files previously used in TestTextureArray * Removed compressed water_normalmap_dxt1.dds * Changed GLES_30 and AndroidGL implementing GL2 to avoid duplicated code checking GL2 vs GLES30 * Added aditional checking to avoid gles30 calls from gles20 only devices
5 years ago
GLES30.glFramebufferTextureLayer(target, attachment, texture, level, layer);
}
public void glAlphaFunc(int func, float ref) {
}
public void glPointSize(float size) {
}
public void glPolygonMode(int face, int mode) {
}
// Wrapper to DrawBuffers as there's no DrawBuffer method in GLES
public void glDrawBuffer(int mode) {
tmpBuff.clear();
tmpBuff.put(0, mode);
tmpBuff.rewind();
glDrawBuffers(tmpBuff);
}
public void glReadBuffer(int mode) {
GLES30.glReadBuffer(mode);
}
Android openGL ES 3 support (#1147) * Update GLImageFormats.java * Added basic support for openGL ES 3.0 and GLSL300 for android Added instancing support for android which is core feature in GLES3.0 Added fix for shadows in android * Fixed required types of GLES30.glDrawElementsInstanced * Properly check GLES3 version and setting precision for shaders for all GLSL ES versions * Added support for Opengl ES 3.1 and 3.2 and their shader versions Added proper checkings for new OpenGL ES versions Fixed some issues with shadow rendering in GLES 3.0 or better (strict type checking, OpenGL ES specific extensions and percision definition) Added GLSL320 and GLSL300 to Unshaded and Lighting materials * Added depth texture 24bit for OpenGL ES * Added geometry shaders and tessellation to GLES 3.1 as extension and GLES 3.2 as core Modified test materials to use GLSL310 * Added FB blit for android GLES30 * Added GlSL300 or better to all effects not able to run in GLSL100 Mods on Shadows.glsllib to try to fix android shadow rendering Fixed ssaoBlur.frag that was using a reserved word Fixed precision type missmatch from vertex to fragment shader * Partial multisample support Framebuffer MRT support * Temporarily removed texture multisampling (not being able to compile using GLES31) * Updated android.jar to api28 Enabled multisampling * Better checking for GLES3 * Removed insert precision for all shaders. This avoided some random precision missmatch error but created rendering issues * Removed border check for GLES, caused filtered shadows not to render on GLES2.0 devices Added texture compare mode for GLES3.0 and better to be able to use sampler2DShadow Modified base materials (Lighting and Unshaded) to use only GLSL100 for post shadow pass * Corrected texture comparison function that were incorrectly changed * Added precision to samplers for GLESSL300 also * Created a subclass of Glsl150ShaderGenerator (Glsl300ShaderGenerator) to support ShaderNodes in GLES SL30 and included it's usage in DesktopAssetManager. Nowadays just copied and overwrote the version string. Needs a full review Added image format RGB16F to be used as texture format only in GLES30 (cannot be used as FB format) Added GLSL300 and/or GLSL310 to different materials * Cleaned GLSL300 generator Fixed shadows glsl lib removing use of GL_EXT_gpu_shaders5 * Fixed usag of textureCubeLod in fragment shader of envMapping which is unsupported in GLES2.0 Modified PBRLighting frag to properly compile on GLES3 * Added GLSL300 and 310 to PostShadowFilter material definition * Make post shadow filter use GLSL100 for GLSL300 Set highp as default precision to fix glitched shadows caused because not enough precision * Changed water_normalmap.dds to uncompressed RGB8 because DXT1 is mostly unsupported in GLES * Fixed GLES30 compilation issues in Water shaders and added GLSL300 to LightScattering material. ** Not fully tested * Added RGB8 dds formatted FullskiesSunset to be used in any platform. Previous file moved to _dtx1.dds * Set GL_TEXTURE_MAX_LEVEL in GLES30 contexts fixing issue with not fully mipmapped images and PBR rendering * Fixed compilation of jme3-android-examples and upgraded sdk version to use * Fixed Geometry Shader and Tessellation Shaders in testdata package to properly compile on GLES320 * Added non-compressed textures to be able to run all examples on android Enabled texture arrays and 3d textures on opengl es 3.0. Peding to implement wrappers to android gl functions (currently getting NullPointerException) * More GLES30 functions included to properly support texture arrays, 3d textures and multisampling matching jme core code * Fixed 3D texture tests for GLES30 Fixed texture 3D and texture array example shader compilation on GLES30 Fixed some random missing precision compilation errors on GLES30 * Fixed TestTextureArray for GLES30 * Some multisample additions and removal of GLES3 multisampling enable caps Added RGBA16F as valid format for GLES32 and using it by default in env camera instead of RGB16F. kept fall back to RGB8 * added float and half float formats for gles30 added rgb10a2 format for gles30 fixed usage of glTexImage2D removed EnvironmentCamera fallback image format as it's useless now * Added more image formats for GLES30 Fixed rgb8 if having Caps.Rgba8 * Enabled RadialBlur for gles30 * Fixed luminance texture formats for gles * Added more depth image formats for gles3 * Enabled multisampling in gles3 * Added GLES30 functions to GLDebugES Reverted TestTexture3D and TestTextureArray to use RGB8 format Updated EnvMapping100.frag to use EXT_shader_texture_lod in gles sl 100 if available * Removed all aditional not used compressed dds files Removed also Pond and rock png files previously used in TestTextureArray * Removed compressed water_normalmap_dxt1.dds * Changed GLES_30 and AndroidGL implementing GL2 to avoid duplicated code checking GL2 vs GLES30 * Added aditional checking to avoid gles30 calls from gles20 only devices
5 years ago
public void glCompressedTexImage3D(int target, int level, int internalFormat, int width, int height, int depth,
int border, ByteBuffer data) {
GLES30.glCompressedTexImage3D(target, level, internalFormat, width, height, depth, border, getLimitBytes(data), data);
}
public void glCompressedTexSubImage3D(int target, int level, int xoffset, int yoffset, int zoffset, int width,
int height, int depth, int format, ByteBuffer data) {
GLES30.glCompressedTexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, getLimitBytes(data), data);
}
public void glTexImage3D(int target, int level, int internalFormat, int width, int height, int depth, int border,
int format, int type, ByteBuffer data) {
GLES30.glTexImage3D(target, level, internalFormat, width, height, depth, border, format, type, data);
}
public void glTexSubImage3D(int target, int level, int xoffset, int yoffset, int zoffset, int width, int height,
int depth, int format, int type, ByteBuffer data) {
GLES30.glTexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, data);
}
}
Android openGL ES 3 support (#1147) * Update GLImageFormats.java * Added basic support for openGL ES 3.0 and GLSL300 for android Added instancing support for android which is core feature in GLES3.0 Added fix for shadows in android * Fixed required types of GLES30.glDrawElementsInstanced * Properly check GLES3 version and setting precision for shaders for all GLSL ES versions * Added support for Opengl ES 3.1 and 3.2 and their shader versions Added proper checkings for new OpenGL ES versions Fixed some issues with shadow rendering in GLES 3.0 or better (strict type checking, OpenGL ES specific extensions and percision definition) Added GLSL320 and GLSL300 to Unshaded and Lighting materials * Added depth texture 24bit for OpenGL ES * Added geometry shaders and tessellation to GLES 3.1 as extension and GLES 3.2 as core Modified test materials to use GLSL310 * Added FB blit for android GLES30 * Added GlSL300 or better to all effects not able to run in GLSL100 Mods on Shadows.glsllib to try to fix android shadow rendering Fixed ssaoBlur.frag that was using a reserved word Fixed precision type missmatch from vertex to fragment shader * Partial multisample support Framebuffer MRT support * Temporarily removed texture multisampling (not being able to compile using GLES31) * Updated android.jar to api28 Enabled multisampling * Better checking for GLES3 * Removed insert precision for all shaders. This avoided some random precision missmatch error but created rendering issues * Removed border check for GLES, caused filtered shadows not to render on GLES2.0 devices Added texture compare mode for GLES3.0 and better to be able to use sampler2DShadow Modified base materials (Lighting and Unshaded) to use only GLSL100 for post shadow pass * Corrected texture comparison function that were incorrectly changed * Added precision to samplers for GLESSL300 also * Created a subclass of Glsl150ShaderGenerator (Glsl300ShaderGenerator) to support ShaderNodes in GLES SL30 and included it's usage in DesktopAssetManager. Nowadays just copied and overwrote the version string. Needs a full review Added image format RGB16F to be used as texture format only in GLES30 (cannot be used as FB format) Added GLSL300 and/or GLSL310 to different materials * Cleaned GLSL300 generator Fixed shadows glsl lib removing use of GL_EXT_gpu_shaders5 * Fixed usag of textureCubeLod in fragment shader of envMapping which is unsupported in GLES2.0 Modified PBRLighting frag to properly compile on GLES3 * Added GLSL300 and 310 to PostShadowFilter material definition * Make post shadow filter use GLSL100 for GLSL300 Set highp as default precision to fix glitched shadows caused because not enough precision * Changed water_normalmap.dds to uncompressed RGB8 because DXT1 is mostly unsupported in GLES * Fixed GLES30 compilation issues in Water shaders and added GLSL300 to LightScattering material. ** Not fully tested * Added RGB8 dds formatted FullskiesSunset to be used in any platform. Previous file moved to _dtx1.dds * Set GL_TEXTURE_MAX_LEVEL in GLES30 contexts fixing issue with not fully mipmapped images and PBR rendering * Fixed compilation of jme3-android-examples and upgraded sdk version to use * Fixed Geometry Shader and Tessellation Shaders in testdata package to properly compile on GLES320 * Added non-compressed textures to be able to run all examples on android Enabled texture arrays and 3d textures on opengl es 3.0. Peding to implement wrappers to android gl functions (currently getting NullPointerException) * More GLES30 functions included to properly support texture arrays, 3d textures and multisampling matching jme core code * Fixed 3D texture tests for GLES30 Fixed texture 3D and texture array example shader compilation on GLES30 Fixed some random missing precision compilation errors on GLES30 * Fixed TestTextureArray for GLES30 * Some multisample additions and removal of GLES3 multisampling enable caps Added RGBA16F as valid format for GLES32 and using it by default in env camera instead of RGB16F. kept fall back to RGB8 * added float and half float formats for gles30 added rgb10a2 format for gles30 fixed usage of glTexImage2D removed EnvironmentCamera fallback image format as it's useless now * Added more image formats for GLES30 Fixed rgb8 if having Caps.Rgba8 * Enabled RadialBlur for gles30 * Fixed luminance texture formats for gles * Added more depth image formats for gles3 * Enabled multisampling in gles3 * Added GLES30 functions to GLDebugES Reverted TestTexture3D and TestTextureArray to use RGB8 format Updated EnvMapping100.frag to use EXT_shader_texture_lod in gles sl 100 if available * Removed all aditional not used compressed dds files Removed also Pond and rock png files previously used in TestTextureArray * Removed compressed water_normalmap_dxt1.dds * Changed GLES_30 and AndroidGL implementing GL2 to avoid duplicated code checking GL2 vs GLES30 * Added aditional checking to avoid gles30 calls from gles20 only devices
5 years ago