/** * Enables the use of a color buffer for this <code>FrameBuffer</code>. * * @param format The format to use for the color buffer. * @throws IllegalArgumentException If <code>format</code> is not a color format. */ public void setColorBuffer(Image.Format format){ if (id != -1) throw new UnsupportedOperationException("FrameBuffer already initialized."); if (format.isDepthFormat()) throw new IllegalArgumentException("Color buffer format must be color/luminance."); RenderBuffer colorBuf = new RenderBuffer(); colorBuf.slot = 0; colorBuf.format = format; colorBufs.clear(); colorBufs.add(colorBuf); }
/** * Add a color buffer without a texture bound to it. * If MRT is enabled, then each subsequently added texture or buffer can be * rendered to through a shader that writes to the array <code>gl_FragData</code>. * If MRT is not enabled, then the index set with {@link FrameBuffer#setTargetIndex(int) } * is rendered to by the shader. * * @param format the format of the color buffer * @see #addColorTexture(com.jme3.texture.Texture2D) */ public void addColorBuffer(Image.Format format){ if (id != -1) throw new UnsupportedOperationException("FrameBuffer already initialized."); if (format.isDepthFormat()) throw new IllegalArgumentException("Color buffer format must be color/luminance."); RenderBuffer colorBuf = new RenderBuffer(); colorBuf.slot = colorBufs.size(); colorBuf.format = format; colorBufs.add(colorBuf); }
/** * Enables the use of a depth buffer for this <code>FrameBuffer</code>. * * @param format The format to use for the depth buffer. * @throws IllegalArgumentException If <code>format</code> is not a depth format. */ public void setDepthBuffer(Image.Format format){ if (id != -1) throw new UnsupportedOperationException("FrameBuffer already initialized."); if (!format.isDepthFormat()) throw new IllegalArgumentException("Depth buffer format must be depth."); depthBuf = new RenderBuffer(); depthBuf.slot = format.isDepthStencilFormat() ? SLOT_DEPTH_STENCIL : SLOT_DEPTH; depthBuf.format = format; }
/** * Enables the use of a color buffer for this <code>FrameBuffer</code>. * * @param format The format to use for the color buffer. * @throws IllegalArgumentException If <code>format</code> is not a color format. */ public void setColorBuffer(Image.Format format){ if (id != -1) throw new UnsupportedOperationException("FrameBuffer already initialized."); if (format.isDepthFormat()) throw new IllegalArgumentException("Color buffer format must be color/luminance."); RenderBuffer colorBuf = new RenderBuffer(); colorBuf.slot = 0; colorBuf.format = format; colorBufs.clear(); colorBufs.add(colorBuf); }
/** * Enables the use of a color buffer for this <code>FrameBuffer</code>. * * @param format The format to use for the color buffer. * @throws IllegalArgumentException If <code>format</code> is not a color format. */ public void setColorBuffer(Image.Format format){ if (id != -1) throw new UnsupportedOperationException("FrameBuffer already initialized."); if (format.isDepthFormat()) throw new IllegalArgumentException("Color buffer format must be color/luminance."); RenderBuffer colorBuf = new RenderBuffer(); colorBuf.slot = 0; colorBuf.format = format; colorBufs.clear(); colorBufs.add(colorBuf); }
private void checkSetTexture(Texture tex, boolean depth){ Image img = tex.getImage(); if (img == null) throw new IllegalArgumentException("Texture not initialized with RTT."); if (depth && !img.getFormat().isDepthFormat()) throw new IllegalArgumentException("Texture image format must be depth."); else if (!depth && img.getFormat().isDepthFormat()) throw new IllegalArgumentException("Texture image format must be color/luminance."); // check that resolution matches texture resolution if (width != img.getWidth() || height != img.getHeight()) throw new IllegalArgumentException("Texture image resolution " + "must match FB resolution"); if (samples != tex.getImage().getMultiSamples()) throw new IllegalStateException("Texture samples must match framebuffer samples"); }
/** * Enables the use of a depth buffer for this <code>FrameBuffer</code>. * * @param format The format to use for the depth buffer. * @throws IllegalArgumentException If <code>format</code> is not a depth format. */ public void setDepthBuffer(Image.Format format){ if (id != -1) throw new UnsupportedOperationException("FrameBuffer already initialized."); if (!format.isDepthFormat()) throw new IllegalArgumentException("Depth buffer format must be depth."); depthBuf = new RenderBuffer(); depthBuf.slot = -100; // -100 == special slot for DEPTH_BUFFER depthBuf.format = format; }
private void checkSetTexture(Texture tex, boolean depth){ Image img = tex.getImage(); if (img == null) throw new IllegalArgumentException("Texture not initialized with RTT."); if (depth && !img.getFormat().isDepthFormat()) throw new IllegalArgumentException("Texture image format must be depth."); else if (!depth && img.getFormat().isDepthFormat()) throw new IllegalArgumentException("Texture image format must be color/luminance."); // check that resolution matches texture resolution if (width != img.getWidth() || height != img.getHeight()) throw new IllegalArgumentException("Texture image resolution " + "must match FB resolution"); if (samples != tex.getImage().getMultiSamples()) throw new IllegalStateException("Texture samples must match framebuffer samples"); }
/** * Enables the use of a depth buffer for this <code>FrameBuffer</code>. * * @param format The format to use for the depth buffer. * @throws IllegalArgumentException If <code>format</code> is not a depth format. */ public void setDepthBuffer(Image.Format format){ if (id != -1) throw new UnsupportedOperationException("FrameBuffer already initialized."); if (!format.isDepthFormat()) throw new IllegalArgumentException("Depth buffer format must be depth."); depthBuf = new RenderBuffer(); depthBuf.slot = format.isDepthStencilFormat() ? SLOT_DEPTH_STENCIL : SLOT_DEPTH; depthBuf.format = format; }
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; }
/** * Creates a new three-dimensional texture using the given image. * @param img The image to use. */ public Texture3D(Image img) { super(); setImage(img); if (img.getFormat().isDepthFormat()) { setMagFilter(MagFilter.Nearest); setMinFilter(MinFilter.NearestNoMipMaps); } }
/** * Creates a new two-dimensional texture using the given image. * @param img The image to use. */ public Texture2D(Image img){ super(); setImage(img); if (img.getFormat().isDepthFormat()){ setMagFilter(MagFilter.Nearest); setMinFilter(MinFilter.NearestNoMipMaps); } }
/** * Creates a new three-dimensional texture using the given image. * @param img The image to use. */ public Texture3D(Image img) { super(); setImage(img); if (img.getFormat().isDepthFormat()) { setMagFilter(MagFilter.Nearest); setMinFilter(MinFilter.NearestNoMipMaps); } }
if (img.getFormat().isDepthFormat()) { img.setMultiSamples(Math.min(limits.get(Limits.DepthTextureSamples), imageSamples)); } else { if (img.getFormat().isDepthFormat() && !caps.contains(Caps.DepthTexture)) { throw new RendererException("Depth textures are not supported by the video hardware");
} else if (jmeFormat.isDepthFormat()) { throw new UnsupportedOperationException("Updating depth images is not supported");
if (depthBuf != null){ Format depthFmt = depthBuf.getFormat(); if (!depthFmt.isDepthFormat()){ return false; }else{
private static boolean supportsColorBuffer(Collection<Caps> caps, RenderBuffer colorBuf){ Format colorFmt = colorBuf.getFormat(); if (colorFmt.isDepthFormat()) return false; if (colorFmt.isCompressed()) return false; switch (colorFmt){ case RGB111110F: return caps.contains(Caps.PackedFloatColorBuffer); case RGB16F_to_RGB111110F: case RGB16F_to_RGB9E5: case RGB9E5: return false; default: if (colorFmt.isFloatingPont()) return caps.contains(Caps.FloatColorBuffer); return true; } }
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; }
private void checkSetTexture(Texture tex, boolean depth){ Image img = tex.getImage(); if (img == null) throw new IllegalArgumentException("Texture not initialized with RTT."); if (depth && !img.getFormat().isDepthFormat()) throw new IllegalArgumentException("Texture image format must be depth."); else if (!depth && img.getFormat().isDepthFormat()) throw new IllegalArgumentException("Texture image format must be color/luminance."); // check that resolution matches texture resolution if (width != img.getWidth() || height != img.getHeight()) throw new IllegalArgumentException("Texture image resolution " + "must match FB resolution"); if (samples != tex.getImage().getMultiSamples()) throw new IllegalStateException("Texture samples must match framebuffer samples"); }
/** * Creates a new three-dimensional texture using the given image. * @param img The image to use. */ public Texture3D(Image img) { super(); setImage(img); if (img.getFormat().isDepthFormat()) { setMagFilter(MagFilter.Nearest); setMinFilter(MinFilter.NearestNoMipMaps); } }