Package net.sf.jiga.xtended.impl.game.gl.MemScratch

Examples of net.sf.jiga.xtended.impl.game.gl.MemScratch.Item


                                GL11.glBindTexture(Sf3Texture._EXTtex, buffer);
                                GL11.glTexParameteri(Sf3Texture._EXTtex, GL11.GL_TEXTURE_WRAP_S, GL11.GL_CLAMP);
                                GL11.glTexParameteri(Sf3Texture._EXTtex, GL11.GL_TEXTURE_WRAP_T, GL11.GL_CLAMP);
                                GL11.glTexParameteri(Sf3Texture._EXTtex, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_NEAREST);
                                GL11.glTexParameteri(Sf3Texture._EXTtex, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_NEAREST);
                                sTex.addItem(texture.hashCode(), new Item(buffer, texture.toTexScratchDataStore()));
                                texture.validatePixelBuffer();
                                /**
                                 * PBO loading
                                 */
                                if (ext.PixelBufferObjects.GL_isAvailable()) {
                                        if (!sPbo.hasItem(pboHash)) {
                                                sPbo.genVRAMBuffersMap(1);
                                                sPbo.addItem(pboHash, new Item(sPbo.getVRAMFindVacant(), BufferIO._new(0)));
                                        }
                                        Item pboItem = sPbo.firstItem(pboHash);
                                        ARBPixelBufferObject.glBindBufferARB(ARBPixelBufferObject.GL_PIXEL_UNPACK_BUFFER_ARB, pboItem.name);
                                        if (!pboInput) {
                                                ARBPixelBufferObject.glBufferDataARB(ARBPixelBufferObject.GL_PIXEL_UNPACK_BUFFER_ARB, texture.getTextureBufferSize() * BufferIO.Data._findType(texture.accessPixelBuffer()).byteSize, ARBPixelBufferObject.GL_STREAM_COPY_ARB);
                                                sPbo.firstItem(pboHash).data = ARBPixelBufferObject.glMapBufferARB(ARBPixelBufferObject.GL_PIXEL_UNPACK_BUFFER_ARB, ARBPixelBufferObject.GL_WRITE_ONLY_ARB, texture.getTextureBufferSize() * BufferIO.Data._findType(texture.accessPixelBuffer()).byteSize, null);
                                        }
View Full Code Here


                List<Item<IntBuffer>> tileMap = sTex.hasItem(refHash) ? sTex.getItems(refHash) : sTex._newSet();
                /*Note about using tiles items : Tile is loaded here with a new unique (tile.hashCode()) texture.*/
                _GLLoadVRAM2D(tile, true, refHash, false);
                Sf3TextureTile tileTex = new Sf3TextureTile(refHash, new Dimension(refWidth, refHeight), tile, tileX, tileY);
                /*Note about using tiles items : All Item.name's are hashcodes in the reference (refHash of Sprite) set of tiled TexScratch items. {@link TexScratch#delete(java.nio.IntBuffer)}.*/
                sTex.addItem(refHash, new Item(tile.hashCode(), tileTex.toTexScratchDataStore()));
                return -tileMap.size();
        }
View Full Code Here

                                GL11.glTexParameteri(GL12.GL_TEXTURE_3D, GL11.GL_TEXTURE_WRAP_S, GL11.GL_CLAMP);
                                GL11.glTexParameteri(GL12.GL_TEXTURE_3D, GL11.GL_TEXTURE_WRAP_T, GL11.GL_CLAMP);
                                GL11.glTexParameteri(GL12.GL_TEXTURE_3D, GL12.GL_TEXTURE_WRAP_R, GL11.GL_CLAMP);
                                GL11.glTexParameteri(GL12.GL_TEXTURE_3D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR);
                                GL11.glTexParameteri(GL12.GL_TEXTURE_3D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR);
                                sTex.addItem(texture.hashCode(), new Item(buffer, texture.toTexScratchDataStore()));
                                /**
                                 * PBO loading
                                 */
                                if (ext.PixelBufferObjects.GL_isAvailable() && texture.accessPixelBuffer().limit() != 0) {
                                        if (!sPbo.hasItem(pboHash)) {
                                                sPbo.genVRAMBuffersMap(1);
                                                sPbo.addItem(pboHash, new Item(sPbo.getVRAMFindVacant(), BufferIO._new(0)));
                                        }
                                        Item pboItem = sPbo.firstItem(pboHash);
                                        ARBPixelBufferObject.glBindBufferARB(ARBPixelBufferObject.GL_PIXEL_UNPACK_BUFFER_ARB, pboItem.name);
                                        ARBPixelBufferObject.glBufferDataARB(ARBPixelBufferObject.GL_PIXEL_UNPACK_BUFFER_ARB, texture.accessPixelBuffer().limit() * BufferIO.Data._findType(texture.accessPixelBuffer()).byteSize, ARBPixelBufferObject.GL_STREAM_COPY_ARB);
                                        sPbo.firstItem(pboHash).data = ARBPixelBufferObject.glMapBufferARB(ARBPixelBufferObject.GL_PIXEL_UNPACK_BUFFER_ARB, ARBPixelBufferObject.GL_WRITE_ONLY_ARB, texture.accessPixelBuffer().limit() * BufferIO.Data._findType(texture.accessPixelBuffer()).byteSize, null);
                                }
                                /**
                                 * PBO loading
                                 */
                                if (ext.PixelBufferObjects.GL_isAvailable() && texture.accessPixelBuffer().limit() != 0) {
                                        ByteBuffer b = (ByteBuffer) sPbo.firstItem(pboHash).data;
                                        put(texture.getPixelBufferDataType(), b, texture.getPixelBuffer());
                                        b.flip();
                                        ARBPixelBufferObject.glUnmapBufferARB(ARBPixelBufferObject.GL_PIXEL_UNPACK_BUFFER_ARB);
                                        GL12.glTexImage3D(GL12.GL_TEXTURE_3D, 0, texture.getRenderFormat(), texture.getWidth(), texture.getHeight(), texture.getDepth(), 0, texture.getEXTabgr(), texture.getTextureBufferDataType(), 0);
                                } else {
                                        glloadTexture3D(texture);
                                }
                                if (JXAenvUtils._debug) {
                                        System.out.println("xxxx VRAM xxxx BYTE tex3D");
                                }
                                GL11.glBindTexture(GL12.GL_TEXTURE_3D, 0);
                                if (ext.PixelBufferObjects.GL_isAvailable() && texture.accessPixelBuffer().limit() != 0) {
                                        ARBPixelBufferObject.glBindBufferARB(ARBPixelBufferObject.GL_PIXEL_UNPACK_BUFFER_ARB, 0);
                                        if (!pboKeep) {
                                                sPbo.removeItems(pboHash);
                                        }
                                }
                                if (JXAenvUtils._debug) {
                                        System.out.println("xxxx VRAM xxxx new TEX3D input : " + texture + " bufferSize : " + sTex.getItemScratchSize() + "/" + sTex.getItemScratchCapacity());
                                }
                                GL11.glPrioritizeTextures(BufferIO._wrapi(new int[]{buffer}), BufferIO._wrapf(new float[]{texture.getPty()}));
                        } else {
                                buffer = sTex.firstItemBufferName(hash);
                        }
                } else if (texture2D != null) {
                        GL11.glBindTexture(GL12.GL_TEXTURE_3D, buffer);
                        IntBuffer dim = sTex.firstItem(hash).data;
                        sTex.addItem(texture2D.hashCode(), new Item(buffer, BufferIO._wrapi(new int[]{dim.get(0), dim.get(1), dim.get(2), dim.get(3), rCoord})));
                        texture2D.validatePixelBuffer();
                        /**
                         * PBO loading
                         */
                        if (ext.PixelBufferObjects.GL_isAvailable()) {
                                if (!sPbo.hasItem(pboHash)) {
                                        sPbo.genVRAMBuffersMap(1);
                                        sPbo.addItem(pboHash, new Item(sPbo.getVRAMFindVacant(), BufferIO._new(0)));
                                }
                                Item pboItem = sPbo.firstItem(pboHash);
                                ARBPixelBufferObject.glBindBufferARB(ARBPixelBufferObject.GL_PIXEL_UNPACK_BUFFER_ARB, pboItem.name);
                                ARBPixelBufferObject.glBufferDataARB(ARBPixelBufferObject.GL_PIXEL_UNPACK_BUFFER_ARB, texture2D.accessPixelBuffer().limit() * BufferIO.Data._findType(texture2D.accessPixelBuffer()).byteSize, ARBPixelBufferObject.GL_STREAM_COPY_ARB);
                                sPbo.firstItem(pboHash).data = ARBPixelBufferObject.glMapBufferARB(ARBPixelBufferObject.GL_PIXEL_UNPACK_BUFFER_ARB, ARBPixelBufferObject.GL_WRITE_ONLY_ARB, texture2D.accessPixelBuffer().limit() * BufferIO.Data._findType(texture2D.accessPixelBuffer()).byteSize, null);
                        }
                        /**
 
View Full Code Here

        /**
         * add unaffected items data[s] to data[data.length - 1] to the end of
         * the list
         */
        for (FloatBuffer d : data) {
            GLHandler.sVbo.addItem(getUID(), new Item(GLHandler.sVbo.getVRAMFindVacant(), d));
        }
    }
View Full Code Here

        /**
         * correct buffer sizes
         *
         */
        for (int i = 0; i < 3; i++) {
            Item pbo = GLHandler.sPbo.item(hashCode(), i);
            PBOcheckSize(ARBPixelBufferObject.GL_PIXEL_PACK_BUFFER_ARB, pbo, nSize, preparePbo);
            pbo.data = ROIpack.toMemScratchDataStore();
        }

        /*
 
View Full Code Here

    private void PBOclearArea_DMA(ROI packedClearedArea) {
        /**
         * select third PBO for DMA transfer from/to the texture
         */
        Item i = GLHandler.sPbo.item(hashCode(), 2);
        /**
         * download the texture for update
         */
        PBOgetTex(i);
        /**
 
View Full Code Here

     *
     */

    private void PBOsendPixels_DMA(ROI packedROI) {
        if ((bstate & PACKED) != 0) {
            Item i = GLHandler.sPbo.firstItem(hashCode());
            _PBOsendPixels_DMA(i, packedROI);
        }
    }
View Full Code Here

        PBOsendPixels_DMA(packedArea);
        PBOswap();
    }

    protected void unpackStencilBuffer_noDMA(ROI packedArea) {
        Item i = GLHandler.sPbo.firstItem(hashCode());
        FloatBuffer fb = PBOgetContents_noDMA(i);
        if (fb != null) {
            GL11.glPixelStorei(GL11.GL_UNPACK_SKIP_PIXELS, packedArea.ROI.x - ROIpack.ROI.x);
            GL11.glPixelStorei(GL11.GL_UNPACK_SKIP_ROWS, packedArea.ROI.y - ROIpack.ROI.y);
            GL11.glPixelStorei(GL11.GL_UNPACK_ROW_LENGTH, new ROI((DoubleBuffer) i.data).ROI.width);
View Full Code Here

TOP

Related Classes of net.sf.jiga.xtended.impl.game.gl.MemScratch.Item

Copyright © 2018 www.massapicom. 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.