/** * Create a framebuffer for an eye. */ public void setupFramebuffers(int eye) { // Find the chain length IntBuffer length = BufferUtils.createIntBuffer(1); ovr_GetTextureSwapChainLength(session, chains[eye], length); int chainLength = length.get(); LOGGER.fine("HMD Eye #" + eye + " texture chain length: " + chainLength); // Create the frame buffers framebuffers[eye] = new FrameBuffer[chainLength]; for (int i = 0; i < chainLength; i++) { // find the GL texture ID for this texture IntBuffer textureIdB = BufferUtils.createIntBuffer(1); OVRGL.ovr_GetTextureSwapChainBufferGL(session, chains[eye], i, textureIdB); int textureId = textureIdB.get(); // TODO less hacky way of getting our texture into JMonkeyEngine Image img = new Image(); img.setId(textureId); img.setFormat(Image.Format.RGBA8); img.setWidth(textureW); img.setHeight(textureH); Texture2D tex = new Texture2D(img); FrameBuffer buffer = new FrameBuffer(textureW, textureH, 1); buffer.setDepthBuffer(Image.Format.Depth); buffer.setColorTexture(tex); framebuffers[eye][i] = buffer; } }
img.setId(texId); objManager.registerObject(img);
@Test public void testSortByTexture() { Material texture1Mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md"); Material texture2Mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md"); Material texture3Mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md"); Texture tex1 = createTexture("A"); tex1.getImage().setId(1); Texture tex2 = createTexture("B"); tex2.getImage().setId(2); Texture tex3 = createTexture("C"); tex3.getImage().setId(3); texture1Mat.setName("TexA"); texture1Mat.setTexture("ColorMap", tex1); texture2Mat.setName("TexB"); texture2Mat.setTexture("ColorMap", tex2); texture3Mat.setName("TexC"); texture3Mat.setTexture("ColorMap", tex3); testSort(texture1Mat, texture2Mat, texture3Mat); }
img.setId(texId); objManager.registerObject(img);
img.setId(texId); objManager.registerObject(img);