protected static void checkLimit(final 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 Material reloadMaterial(Material mat) { //clear the entire cache, there might be more clever things to do, like clearing only the matdef, and the associated shaders. assetManager.clearCache(); //creating a dummy mat with the mat def of the mat to reload // Force the reloading of the asset, otherwise the new shader code will not be applied. Material dummy = new Material(assetManager, mat.getMaterialDef().getAssetName()); for (MatParam matParam : mat.getParams()) { dummy.setParam(matParam.getName(), matParam.getVarType(), matParam.getValue()); } dummy.getAdditionalRenderState().set(mat.getAdditionalRenderState()); //creating a dummy geom and assigning the dummy material to it Geometry dummyGeom = new Geometry("dummyGeom", new Box(1f, 1f, 1f)); dummyGeom.setMaterial(dummy); try { //preloading the dummyGeom, this call will compile the shader again renderManager.preloadScene(dummyGeom); } catch (RendererException e) { //compilation error, the shader code will be output to the console //the following code will output the error //System.err.println(e.getMessage()); Logger.getLogger(MaterialDebugAppState.class.getName()).log(Level.SEVERE, e.getMessage()); return null; } Logger.getLogger(MaterialDebugAppState.class.getName()).log(Level.INFO, "Material succesfully reloaded"); //System.out.println("Material succesfully reloaded"); return dummy; }
public Material reloadMaterial(Material mat) { //clear the entire cache, there might be more clever things to do, like clearing only the matdef, and the associated shaders. assetManager.clearCache(); //creating a dummy mat with the mat def of the mat to reload // Force the reloading of the asset, otherwise the new shader code will not be applied. Material dummy = new Material(assetManager, mat.getMaterialDef().getAssetName()); for (MatParam matParam : mat.getParams()) { dummy.setParam(matParam.getName(), matParam.getVarType(), matParam.getValue()); } dummy.getAdditionalRenderState().set(mat.getAdditionalRenderState()); //creating a dummy geom and assigning the dummy material to it Geometry dummyGeom = new Geometry("dummyGeom", new Box(1f, 1f, 1f)); dummyGeom.setMaterial(dummy); try { //preloading the dummyGeom, this call will compile the shader again renderManager.preloadScene(dummyGeom); } catch (RendererException e) { //compilation error, the shader code will be output to the console //the following code will output the error //System.err.println(e.getMessage()); Logger.getLogger(MaterialDebugAppState.class.getName()).log(Level.SEVERE, e.getMessage()); return null; } Logger.getLogger(MaterialDebugAppState.class.getName()).log(Level.INFO, "Material succesfully reloaded"); //System.out.println("Material succesfully reloaded"); return dummy; }
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"); } }
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"); } }
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"); } }
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"); } }
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"); } }
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"); } }
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"); } }
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"); } }
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 static void checkGLError() { if (!ENABLE_ERROR_CHECKING) { return; } int error = glGetError(); if (error != 0) { String message = null;//GLU.gluErrorString(error); if (message == null) { throw new RendererException("An unknown [" + error + "] OpenGL error has occurred."); } else { throw new RendererException("An OpenGL error has occurred: " + message); } } }
public static GLImageFormat getImageFormatWithError(Format fmt, boolean isSrgb) { GLImageFormat glFmt = getImageFormat(fmt, isSrgb); if (glFmt == null) { throw new RendererException("Image format '" + fmt + "' is unsupported by the video hardware."); } return glFmt; }
/** * Checks for an OpenGL error and throws a {@link RendererException} if * there is one. Ignores the value of * {@link RendererUtil#ENABLE_ERROR_CHECKING}. */ public static void checkGLErrorForced() { int error = GLES20.glGetError(); if (error != 0) { String message = GLU.gluErrorString(error); if (message == null) { throw new RendererException("An unknown OpenGL error has occurred."); } else { throw new RendererException("An OpenGL error has occurred: " + message); } } }
throw new RendererException("Multisample textures are not supported" + " by the video hardware."); throw new RendererException("Array textures are not supported" + " by the video hardware."); throw new RendererException("3D textures are not supported" + " by the video hardware.");
/** * Checks for an OpenGL error and throws a {@link RendererException} if * there is one. Does nothing if {@link RendererUtil#ENABLE_ERROR_CHECKING} * is set to * <code>false</code>. */ public static void checkGLError() { if (!ENABLE_ERROR_CHECKING) { return; } int error = GLES20.glGetError(); if (error != 0) { String message = GLU.gluErrorString(error); if (message == null) { throw new RendererException("An unknown OpenGL error has occurred."); } else { throw new RendererException("An OpenGL error has occurred: " + message); } } } }
protected void checkError() { int err = gl.glGetError(); if (err != 0) { throw new RendererException("An OpenGL error occurred - " + decodeError(err)); } } }
public GLImageFormat getImageFormatWithError(Format fmt, boolean isSrgb) { //if the passed format is one kind of depth there isno point in getting the srgb format; isSrgb = isSrgb && !fmt.isDepthFormat(); GLImageFormat glFmt = getImageFormat(fmt, isSrgb); if (glFmt == null && isSrgb) { glFmt = getImageFormat(fmt, false); logger.log(Level.WARNING, "No sRGB format available for ''{0}''. Failling back to linear.", fmt); } if (glFmt == null) { throw new RendererException("Image format '" + fmt + "' is unsupported by the video hardware."); } return glFmt; }
throw new RendererException("EGL error 0x" + Integer.toHexString(error) + ": " + errorMessage);