Search in sources :

Example 1 with Texture_t

use of com.jme3.system.jopenvr.Texture_t in project jmonkeyengine by jMonkeyEngine.

the class VRViewManagerOSVR method initTextureSubmitStructs.

/**
     * Initialize the system binds of the textures.
     */
private void initTextureSubmitStructs() {
    leftTextureType = new Texture_t();
    rightTextureType = new Texture_t();
    // must be OSVR
    osvr_renderBuffer = new OSVR_RenderBufferOpenGL.ByValue[2];
    osvr_renderBuffer[OSVR.EYE_LEFT] = new OSVR_RenderBufferOpenGL.ByValue();
    osvr_renderBuffer[OSVR.EYE_RIGHT] = new OSVR_RenderBufferOpenGL.ByValue();
    osvr_renderBuffer[OSVR.EYE_LEFT].setAutoSynch(false);
    osvr_renderBuffer[OSVR.EYE_RIGHT].setAutoSynch(false);
    osvr_viewDescFull = new OSVR_ViewportDescription.ByValue();
    osvr_viewDescFull.setAutoSynch(false);
    osvr_viewDescFull.left = osvr_viewDescFull.lower = 0.0;
    osvr_viewDescFull.width = osvr_viewDescFull.height = 1.0;
    osvr_viewDescLeft = new OSVR_ViewportDescription.ByValue();
    osvr_viewDescLeft.setAutoSynch(false);
    osvr_viewDescLeft.left = osvr_viewDescLeft.lower = 0.0;
    osvr_viewDescLeft.width = 0.5;
    osvr_viewDescLeft.height = 1.0;
    osvr_viewDescRight = new OSVR_ViewportDescription.ByValue();
    osvr_viewDescRight.setAutoSynch(false);
    osvr_viewDescRight.left = 0.5;
    osvr_viewDescRight.lower = 0.0;
    osvr_viewDescRight.width = 0.5;
    osvr_viewDescRight.height = 1.0;
    osvr_viewDescRight.write();
    osvr_viewDescLeft.write();
    osvr_viewDescFull.write();
    osvr_renderBuffer[OSVR.EYE_LEFT].depthStencilBufferName = -1;
    osvr_renderBuffer[OSVR.EYE_LEFT].colorBufferName = -1;
    osvr_renderBuffer[OSVR.EYE_RIGHT].depthStencilBufferName = -1;
    osvr_renderBuffer[OSVR.EYE_RIGHT].colorBufferName = -1;
}
Also used : OSVR_RenderBufferOpenGL(com.jme3.system.osvr.osvrrendermanageropengl.OSVR_RenderBufferOpenGL) OSVR_ViewportDescription(com.jme3.system.osvr.osvrrendermanageropengl.OSVR_ViewportDescription) Texture_t(com.jme3.system.jopenvr.Texture_t)

Example 2 with Texture_t

use of com.jme3.system.jopenvr.Texture_t in project jmonkeyengine by jMonkeyEngine.

the class VRViewManagerOpenVR method initTextureSubmitStructs.

/**
     * Initialize the system binds of the textures.
     */
private void initTextureSubmitStructs() {
    leftTextureType = new Texture_t();
    rightTextureType = new Texture_t();
    if (environment != null) {
        if (environment.getVRHardware() instanceof OpenVR) {
            leftTextureBounds = new VRTextureBounds_t();
            rightTextureBounds = new VRTextureBounds_t();
            // left eye
            leftTextureBounds.uMax = 0.5f;
            leftTextureBounds.uMin = 0f;
            leftTextureBounds.vMax = 1f;
            leftTextureBounds.vMin = 0f;
            leftTextureBounds.setAutoSynch(false);
            leftTextureBounds.setAutoRead(false);
            leftTextureBounds.setAutoWrite(false);
            leftTextureBounds.write();
            // right eye
            rightTextureBounds.uMax = 1f;
            rightTextureBounds.uMin = 0.5f;
            rightTextureBounds.vMax = 1f;
            rightTextureBounds.vMin = 0f;
            rightTextureBounds.setAutoSynch(false);
            rightTextureBounds.setAutoRead(false);
            rightTextureBounds.setAutoWrite(false);
            rightTextureBounds.write();
            // texture type
            leftTextureType.eColorSpace = JOpenVRLibrary.EColorSpace.EColorSpace_ColorSpace_Gamma;
            leftTextureType.eType = JOpenVRLibrary.ETextureType.ETextureType_TextureType_OpenGL;
            leftTextureType.setAutoSynch(false);
            leftTextureType.setAutoRead(false);
            leftTextureType.setAutoWrite(false);
            leftTextureType.handle = -1;
            rightTextureType.eColorSpace = JOpenVRLibrary.EColorSpace.EColorSpace_ColorSpace_Gamma;
            rightTextureType.eType = JOpenVRLibrary.ETextureType.ETextureType_TextureType_OpenGL;
            rightTextureType.setAutoSynch(false);
            rightTextureType.setAutoRead(false);
            rightTextureType.setAutoWrite(false);
            rightTextureType.handle = -1;
            logger.config("Init eyes native texture binds");
            logger.config("  Left eye texture");
            logger.config("           address: " + leftTextureType.getPointer());
            logger.config("              size: " + leftTextureType.size() + " bytes");
            logger.config("       color space: " + OpenVRUtil.getEColorSpaceString(leftTextureType.eColorSpace));
            logger.config("              type: " + OpenVRUtil.getETextureTypeString(leftTextureType.eType));
            logger.config("         auto read: " + leftTextureType.getAutoRead());
            logger.config("        auto write: " + leftTextureType.getAutoWrite());
            logger.config("    handle address: " + leftTextureType.handle);
            logger.config("      handle value: " + leftTextureType.handle);
            logger.config("");
            logger.config("  Right eye texture");
            logger.config("           address: " + rightTextureType.getPointer());
            logger.config("              size: " + rightTextureType.size() + " bytes");
            logger.config("       color space: " + OpenVRUtil.getEColorSpaceString(rightTextureType.eColorSpace));
            logger.config("              type: " + OpenVRUtil.getETextureTypeString(rightTextureType.eType));
            logger.config("         auto read: " + rightTextureType.getAutoRead());
            logger.config("        auto write: " + rightTextureType.getAutoWrite());
            logger.config("    handle address: " + rightTextureType.handle);
            logger.config("      handle value: " + rightTextureType.handle);
        }
    } else {
        throw new IllegalStateException("This VR view manager is not attached to any VR environment.");
    }
}
Also used : VRTextureBounds_t(com.jme3.system.jopenvr.VRTextureBounds_t) OpenVR(com.jme3.input.vr.OpenVR) Texture_t(com.jme3.system.jopenvr.Texture_t)

Aggregations

Texture_t (com.jme3.system.jopenvr.Texture_t)2 OpenVR (com.jme3.input.vr.OpenVR)1 VRTextureBounds_t (com.jme3.system.jopenvr.VRTextureBounds_t)1 OSVR_RenderBufferOpenGL (com.jme3.system.osvr.osvrrendermanageropengl.OSVR_RenderBufferOpenGL)1 OSVR_ViewportDescription (com.jme3.system.osvr.osvrrendermanageropengl.OSVR_ViewportDescription)1