Examples of RenderBuffer

@author Portet to jme3 by user starcom "Paul Kashofer Austria" @see ImageGraphics
  • com.thecherno.cherno.engine.interfaces.RenderBuffer
    @author Yan
  • sun.java2d.pipe.RenderBuffer
    The RenderBuffer class is a simplified, high-performance, Unsafe wrapper used for buffering rendering operations in a single-threaded rendering environment. It's functionality is similar to the ByteBuffer and related NIO classes. However, the methods in this class perform little to no alignment or bounds checks for performance reasons. Therefore, it is the caller's responsibility to ensure that all put() calls are properly aligned and within bounds: - int and float values must be aligned on 4-byte boundaries - long and double values must be aligned on 8-byte boundaries This class only includes the bare minimum of methods to support single-threaded rendering. For example, there is no put(double[]) method because we currently have no need for such a method in the STR classes.

  • Examples of ae.sun.java2d.pipe.RenderBuffer

            try {
                // make sure we make the context associated with the given
                // GraphicsConfig current before disposing the native resources
                OGLContext.setScratchSurface(pConfigInfo);

                RenderBuffer buf = rq.getBuffer();
                rq.ensureCapacityAndAlignment(12, 4);
                buf.putInt(DISPOSE_CONFIG);
                buf.putLong(pConfigInfo);

                // this call is expected to complete synchronously, so flush now
                rq.flushNow();
            } finally {
                rq.unlock();
    View Full Code Here

    Examples of ae.sun.java2d.pipe.RenderBuffer

            // invalidate the current context
            currentContext = null;

            // set the scratch context
            OGLRenderQueue rq = OGLRenderQueue.getInstance();
            RenderBuffer buf = rq.getBuffer();
            rq.ensureCapacityAndAlignment(12, 4);
            buf.putInt(SET_SCRATCH_SURFACE);
            buf.putLong(pConfigInfo);
        }
    View Full Code Here

    Examples of ae.sun.java2d.pipe.RenderBuffer

            try {
                // make sure we have a current context before
                // disposing the native resources (e.g. texture object)
                OGLContext.setScratchSurface(graphicsConfig);

                RenderBuffer buf = rq.getBuffer();
                rq.ensureCapacityAndAlignment(12, 4);
                buf.putInt(FLUSH_SURFACE);
                buf.putLong(getNativeOps());

                // this call is expected to complete synchronously, so flush now
                rq.flushNow();
            } finally {
                rq.unlock();
    View Full Code Here

    Examples of ae.sun.java2d.pipe.RenderBuffer

            try {
                // make sure we have a current context before
                // disposing the native resources (e.g. texture object)
                OGLContext.setScratchSurface(pConfigInfo);

                RenderBuffer buf = rq.getBuffer();
                rq.ensureCapacityAndAlignment(12, 4);
                buf.putInt(DISPOSE_SURFACE);
                buf.putLong(pData);

                // this call is expected to complete synchronously, so flush now
                rq.flushNow();
            } finally {
                rq.unlock();
    View Full Code Here

    Examples of ae.sun.java2d.pipe.RenderBuffer

        static void swapBuffers(long window) {
            OGLRenderQueue rq = OGLRenderQueue.getInstance();
            rq.lock();
            try {
                RenderBuffer buf = rq.getBuffer();
                rq.ensureCapacityAndAlignment(12, 4);
                buf.putInt(SWAP_BUFFERS);
                buf.putLong(window);
                rq.flushNow();
            } finally {
                rq.unlock();
            }
        }
    View Full Code Here

    Examples of ae.sun.java2d.pipe.RenderBuffer

                                        int sx2, int sy2,
                                        double dx1, double dy1,
                                        double dx2, double dy2)
        {
            // assert rq.lock.isHeldByCurrentThread();
            RenderBuffer buf = rq.getBuffer();
            rq.ensureCapacityAndAlignment(72, 24);
            buf.putInt(BLIT);
            buf.putInt(packedParams);
            buf.putInt(sx1).putInt(sy1);
            buf.putInt(sx2).putInt(sy2);
            buf.putDouble(dx1).putDouble(dy1);
            buf.putDouble(dx2).putDouble(dy2);
            buf.putLong(src.getNativeOps());
            buf.putLong(dst.getNativeOps());
        }
    View Full Code Here

    Examples of ae.sun.java2d.pipe.RenderBuffer

                // make sure the RenderQueue keeps a hard reference to the
                // destination (sysmem) SurfaceData to prevent it from being
                // disposed while the operation is processed on the QFT
                rq.addReference(dst);

                RenderBuffer buf = rq.getBuffer();
                OGLContext.validateContext((OGLSurfaceData)src);

                rq.ensureCapacityAndAlignment(48, 32);
                buf.putInt(SURFACE_TO_SW_BLIT);
                buf.putInt(sx).putInt(sy);
                buf.putInt(dx).putInt(dy);
                buf.putInt(w).putInt(h);
                buf.putInt(typeval);
                buf.putLong(src.getNativeOps());
                buf.putLong(dst.getNativeOps());

                // always flush immediately
                rq.flushNow();
            } finally {
                rq.unlock();
    View Full Code Here

    Examples of com.jme3.texture.FrameBuffer.RenderBuffer

            }

            // generate mipmaps for last FB if needed
            if (lastFb != null) {
                for (int i = 0; i < lastFb.getNumColorBuffers(); i++) {
                    RenderBuffer rb = lastFb.getColorBuffer(i);
                    Texture tex = rb.getTexture();
                    if (tex != null
                            && tex.getMinFilter().usesMipMapLevels()) {
                        setTexture(0, rb.getTexture());

                        int textureType = convertTextureType(tex.getType(), tex.getImage().getMultiSamples(), rb.getFace());
                        glEnable(textureType);
                        glGenerateMipmapEXT(textureType);
                        glDisable(textureType);
                    }
                }
            }

            if (fb == null) {
                // unbind any fbos
                if (context.boundFBO != 0) {
                    glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
                    statistics.onFrameBufferUse(null, true);

                    context.boundFBO = 0;
                }
                // select back buffer
                if (context.boundDrawBuf != -1) {
                    glDrawBuffer(initialDrawBuf);
                    context.boundDrawBuf = -1;
                }
                if (context.boundReadBuf != -1) {
                    glReadBuffer(initialReadBuf);
                    context.boundReadBuf = -1;
                }

                lastFb = null;
            } else {
                if (fb.getNumColorBuffers() == 0 && fb.getDepthBuffer() == null) {
                    throw new IllegalArgumentException("The framebuffer: " + fb
                            + "\nDoesn't have any color/depth buffers");
                }

                if (fb.isUpdateNeeded()) {
                    updateFrameBuffer(fb);
                }

                if (context.boundFBO != fb.getId()) {
                    glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fb.getId());
                    statistics.onFrameBufferUse(fb, true);

                    // update viewport to reflect framebuffer's resolution
                    setViewPort(0, 0, fb.getWidth(), fb.getHeight());

                    context.boundFBO = fb.getId();
                } else {
                    statistics.onFrameBufferUse(fb, false);
                }
                if (fb.getNumColorBuffers() == 0) {
                    // make sure to select NONE as draw buf
                    // no color buffer attached. select NONE
                    if (context.boundDrawBuf != -2) {
                        glDrawBuffer(GL_NONE);
                        context.boundDrawBuf = -2;
                    }
                    if (context.boundReadBuf != -2) {
                        glReadBuffer(GL_NONE);
                        context.boundReadBuf = -2;
                    }
                } else {
                    if (fb.getNumColorBuffers() > maxFBOAttachs) {
                        throw new RendererException("Framebuffer has more color "
                                + "attachments than are supported"
                                + " by the video hardware!");
                    }
                    if (fb.isMultiTarget()) {
                        if (fb.getNumColorBuffers() > maxMRTFBOAttachs) {
                            throw new RendererException("Framebuffer has more"
                                    + " multi targets than are supported"
                                    + " by the video hardware!");
                        }

                        if (context.boundDrawBuf != 100 + fb.getNumColorBuffers()) {
                            intBuf16.clear();
                            for (int i = 0; i < fb.getNumColorBuffers(); i++) {
                                intBuf16.put(GL_COLOR_ATTACHMENT0_EXT + i);
                            }

                            intBuf16.flip();
                            glDrawBuffers(intBuf16);
                            context.boundDrawBuf = 100 + fb.getNumColorBuffers();
                        }
                    } else {
                        RenderBuffer rb = fb.getColorBuffer(fb.getTargetIndex());
                        // select this draw buffer
                        if (context.boundDrawBuf != rb.getSlot()) {
                            glDrawBuffer(GL_COLOR_ATTACHMENT0_EXT + rb.getSlot());
                            context.boundDrawBuf = rb.getSlot();
                        }
                    }
                }

                assert fb.getId() >= 0;
    View Full Code Here

    Examples of com.jme3.texture.FrameBuffer.RenderBuffer

            }
        }

        public void readFrameBuffer(FrameBuffer fb, ByteBuffer byteBuf) {
            if (fb != null) {
                RenderBuffer rb = fb.getColorBuffer();
                if (rb == null) {
                    throw new IllegalArgumentException("Specified framebuffer"
                            + " does not have a colorbuffer");
                }

                setFrameBuffer(fb);
                if (context.boundReadBuf != rb.getSlot()) {
                    glReadBuffer(GL_COLOR_ATTACHMENT0_EXT + rb.getSlot());
                    context.boundReadBuf = rb.getSlot();
                }
            } else {
                setFrameBuffer(null);
            }
    View Full Code Here

    Examples of com.thecherno.cherno.engine.interfaces.RenderBuffer

      public void drawString(final String text, final int x, final int y, final Color color) {
        drawString(text, x, y, font, color);
      }

      public void drawString(final String text, final int x, final int y, final Font font, final Color color) {
        buffer.add(new RenderBuffer() {
          public void render(Graphics graphics) {
            int[] rgb = color.getRGB();
            graphics.setFont(font);
            graphics.setColor(new java.awt.Color(rgb[0], rgb[1], rgb[2]));
            graphics.drawString(text, x, y);
    View Full Code Here
    TOP
    Copyright © 2018 www.massapi.com. All rights reserved.
    All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.