I was able to force a homegrown render into each eye. But its perspective looks "wrong". Maybe there's more to this than just creating two renders and pasting it into the right and left eye?
The positive is that it now should support full-screen shaders. The negative is that it is kinda broken. Hooray?
// Project: Replace eye
// Created: 2018-06-18
#option_explicit
// show all errors
SetErrorMode(2)
// set window properties
SetWindowTitle( "Replace eye" )
SetSyncRate(90, 0)
SetWindowSize( 1330, 1584, 0 )
SetVirtualResolution( 1330, 1584 )
SetScissor(0, 0, 0, 0)
SetAntialiasMode( 1 ) // 0=off, 1=4xMSAA
SetDefaultMagFilter( 1 ) // 0=nearest, 1=linear
SetDefaultMinFilter( 1 ) // 0=nearest, 1=linear
//Load the AGKVR plugin
#import_plugin AGKVR
/*===============================================================================
VR TECH STUFFIE
===============================================================================*/
//Set the Camera Range in AGKVR
//It is necessary to use this command for setting the camera's range instead of the standard AGK SetCameraRange command
//AGKVR.SetCameraRange( 0.01, 1000.0 )
AGKVR.SetCameraRange( 0.01, 1000.0 )
//Initialiaze AGKVR
// The parameters are the Right and Left Eye image ID's that will be used to render to the HMD
InitError As Integer
RightEyeImg As Integer = 500
LeftEyeImg As Integer = 501
InitError = AGKVR.Init( RightEyeImg, LeftEyeImg )
// InitError = 0: SUCCESS!
// InitError = 1: Unable to init VR runtime
// InitError = 2: Compositor initialization failed.
//This command will lock the player's heading direction
//to follow the turn angle of the HMD. This would be common in FPS games, where
//you want the forward moving direction's turn angle to change based on where the
//player is looking. LockPlayerTurn is ON(1) by default
AGKVR.LockPlayerTurn( 1 )
//This command will lock the player's heading direction (forward on the Z axis)
//to follow the pitch angle of the HMD. This would be useful in a freeflight style game
//where you want the forward moving direction's pitch angle to change based on where the
//player is looking. LockPlayerPitch is OFF(0) by default
AGKVR.LockPlayerPitch( 0 )
boxie as integer
boxie = CreateObjectBox (0.3, 0.3, 0.3)
setObjectColor(boxie, 30, 230, 80, 255)
setObjectPosition ( boxie, 0.0, 1.2, 2.0)
eyeOffset as float = 0.16
leftEye_Img as integer
leftEye_Img = CreateRenderImage( getImageWidth(LeftEyeImg), getImageHeight(LeftEyeImg), 0, 0 )
leftEye_Spr as integer
leftEye_Spr = createSprite ( lefteye_Img )
setSpriteDepth (leftEye_Spr, 100)
rightEye_Img as integer
rightEye_Img = CreateRenderImage( getImageWidth(LeftEyeImg), getImageHeight(LeftEyeImg), 0, 0 )
rightEye_Spr as integer
rightEye_Spr = createSprite ( rightEye_Img )
setSpriteDepth (rightEye_Spr, 101)
do
AGKVR.UpdatePlayer( )
setSpriteVisible (leftEye_Spr, 0) // We don't wanna show that
setSpriteVisible (rightEye_Spr, 0)
SetCameraPosition( 1, AGKVR.GetHMDX(), AGKVR.GetHMDY(), AGKVR.GetHMDZ() ) // places the camera at the position of the HMD left eye
SetCameraRotation( 1, AGKVR.GetHMDAngleX(), AGKVR.GetHMDAngleY(), AGKVR.GetHMDAngleZ())
MoveCameraLocalX ( 1, -eyeOffset )
SetRenderToImage ( lefteye_Img,0) // render to the sprite leftEye_Spr
ClearScreen () // clear the image before drawing stuff to it
Render()
SetSpriteImage ( leftEye_Spr, lefteye_Img )
SetCameraPosition( 1, AGKVR.GetHMDX(), AGKVR.GetHMDY(), AGKVR.GetHMDZ() ) // places the camera at the position of the HMD left eye
SetCameraRotation( 1, AGKVR.GetHMDAngleX(), AGKVR.GetHMDAngleY(), AGKVR.GetHMDAngleZ())
MoveCameraLocalX ( 1, eyeOffset )
SetRenderToImage ( righteye_Img,0) // render to the sprite leftEye_Spr
ClearScreen () // clear the image before drawing stuff to it
Render()
SetSpriteImage ( rightEye_Spr, righteye_Img )
setSpriteVisible (leftEye_Spr, 1)
setSpriteVisible (rightEye_Spr, 0)
AGKVR.Render_LeftEye()
setSpriteVisible (leftEye_Spr, 0)
setSpriteVisible (rightEye_Spr, 1)
AGKVR.Render_RightEye()
setSpriteVisible (leftEye_Spr, 0) // We don't wanna show that
setSpriteVisible (rightEye_Spr, 0)
Sync() // Normal render to monitor
loop