Server platform builds (dummy) mobile_vr module.

Protect GL functions in mobile_vr with ifdefs.
This commit is contained in:
Fabio Alessandrelli 2018-09-25 12:19:34 +02:00
parent 5adf7aa6b7
commit b0f166987a
3 changed files with 13 additions and 3 deletions

View file

@ -297,6 +297,7 @@ bool MobileVRInterface::initialize() {
mag_current_min = Vector3(0, 0, 0); mag_current_min = Vector3(0, 0, 0);
mag_current_max = Vector3(0, 0, 0); mag_current_max = Vector3(0, 0, 0);
#if !defined(SERVER_ENABLED)
// build our shader // build our shader
if (lens_shader == NULL) { if (lens_shader == NULL) {
///@TODO need to switch between GLES2 and GLES3 version, Reduz suggested moving this into our drivers and making this a core shader ///@TODO need to switch between GLES2 and GLES3 version, Reduz suggested moving this into our drivers and making this a core shader
@ -337,6 +338,7 @@ bool MobileVRInterface::initialize() {
glBindVertexArray(0); glBindVertexArray(0);
glBindBuffer(GL_ARRAY_BUFFER, 0); //unbind glBindBuffer(GL_ARRAY_BUFFER, 0); //unbind
} }
#endif
// reset our orientation // reset our orientation
orientation = Basis(); orientation = Basis();
@ -360,6 +362,7 @@ void MobileVRInterface::uninitialize() {
arvr_server->clear_primary_interface_if(this); arvr_server->clear_primary_interface_if(this);
} }
#if !defined(SERVER_ENABLED)
// cleanup our shader and buffers // cleanup our shader and buffers
if (lens_shader != NULL) { if (lens_shader != NULL) {
glDeleteVertexArrays(1, &half_screen_array); glDeleteVertexArrays(1, &half_screen_array);
@ -368,6 +371,7 @@ void MobileVRInterface::uninitialize() {
delete lens_shader; delete lens_shader;
lens_shader = NULL; lens_shader = NULL;
} }
#endif
initialized = false; initialized = false;
}; };
@ -470,6 +474,7 @@ void MobileVRInterface::commit_for_eye(ARVRInterface::Eyes p_eye, RID p_render_t
// get our render target // get our render target
RID eye_texture = VSG::storage->render_target_get_texture(p_render_target); RID eye_texture = VSG::storage->render_target_get_texture(p_render_target);
uint32_t texid = VS::get_singleton()->texture_get_texid(eye_texture); uint32_t texid = VS::get_singleton()->texture_get_texid(eye_texture);
#if !defined(SERVER_ENABLED)
glActiveTexture(GL_TEXTURE0); glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, texid); glBindTexture(GL_TEXTURE_2D, texid);
@ -484,6 +489,7 @@ void MobileVRInterface::commit_for_eye(ARVRInterface::Eyes p_eye, RID p_render_t
glBindVertexArray(half_screen_array); glBindVertexArray(half_screen_array);
glDrawArrays(GL_TRIANGLE_FAN, 0, 4); glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
glBindVertexArray(0); glBindVertexArray(0);
#endif
}; };
void MobileVRInterface::process() { void MobileVRInterface::process() {

View file

@ -34,7 +34,9 @@
#include "servers/arvr/arvr_interface.h" #include "servers/arvr/arvr_interface.h"
#include "servers/arvr/arvr_positional_tracker.h" #include "servers/arvr/arvr_positional_tracker.h"
#if !defined(SERVER_ENABLED)
#include "shaders/lens_distorted.glsl.gen.h" #include "shaders/lens_distorted.glsl.gen.h"
#endif
/** /**
@author Bastiaan Olij <mux213@gmail.com> @author Bastiaan Olij <mux213@gmail.com>
@ -58,9 +60,13 @@ private:
float eye_height; float eye_height;
uint64_t last_ticks; uint64_t last_ticks;
#if !defined(SERVER_ENABLED)
LensDistortedShaderGLES3 *lens_shader; LensDistortedShaderGLES3 *lens_shader;
GLuint half_screen_quad; GLuint half_screen_quad;
GLuint half_screen_array; GLuint half_screen_array;
#else
void *lens_shader;
#endif
real_t intraocular_dist; real_t intraocular_dist;
real_t display_width; real_t display_width;

View file

@ -29,9 +29,7 @@ def get_opts():
def get_flags(): def get_flags():
return [ return []
("module_mobile_vr_enabled", False),
]
def configure(env): def configure(env):