}
/* render image or only benson */
-void opengl_blit_image(uint8_t *rgb, int filter, int benson_at_line, int render_benson_only, double fov, double monitor_distance, double benson_size)
+void opengl_blit_image(uint8_t *rgb, int filter, int benson_at_line, int render_benson_only, double fov, double monitor_distance, double benson_size, int benson_case)
{
double texture_left = 0;
double texture_right = ((double)image_width) / (double)texture_size;
double slope = tan(fov / 360 * M_PI) * monitor_distance;
/* render image */
+
+ if (benson_case) {
+ glEnable(GL_CULL_FACE);
+ glFrontFace(GL_CW);
+ glCullFace(GL_BACK);
+ }
+
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, image_name);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); /* no modulation with color */
glVertex3f(-benson_size * slope, image_top * slope, -monitor_distance);
glEnd();
glDisable(GL_TEXTURE_2D);
+ /* render benson case */
+ if (benson_case) {
+ double left, right, bottom, top, near, far;
+ left = -benson_size * slope;
+ right = benson_size * slope;
+ bottom = image_bottom * slope;
+ top = image_top * slope;
+ near = -monitor_distance;
+ far = near - benson_size * slope / 3.0;
+ glBegin(GL_QUADS);
+ /* back */
+ glColor4f(0.3, 0.3, 0.3, 1.0);
+ glVertex3f(left, top, far);
+ glVertex3f(right, top, far);
+ glVertex3f(right, bottom, far);
+ glVertex3f(left, bottom, far);
+ /* top */
+ glColor4f(0.2, 0.2, 0.2, 1.0);
+ glVertex3f(left, top, near);
+ glVertex3f(right, top, near);
+ glVertex3f(right, top, far);
+ glVertex3f(left, top, far);
+ /* bottom */
+ glColor4f(0.05, 0.05, 0.05, 1.0);
+ glVertex3f(left, bottom, far);
+ glVertex3f(right, bottom, far);
+ glVertex3f(right, bottom, near);
+ glVertex3f(left, bottom, near);
+ /* left */
+ glColor4f(0.1, 0.1, 0.1, 1.0);
+ glVertex3f(left, bottom, far);
+ glVertex3f(left, bottom, near);
+ glVertex3f(left, top, near);
+ glVertex3f(left, top, far);
+ /* right */
+ glVertex3f(right, top, far);
+ glVertex3f(right, top, near);
+ glVertex3f(right, bottom, near);
+ glVertex3f(right, bottom, far);
+ glEnd();
+ }
+
+ if (benson_case) {
+ glDisable(GL_CULL_FACE);
+ }
}
/* render osd texture */
int init_opengl_osd(int num, int _osd_width, int _osd_height);
void opengl_clear(int flip_y);
void opengl_viewport(int view_width, int view_height, int split, int benson_at_line, double fov, double benson_size);
-void opengl_blit_image(uint8_t *rgb, int filter, int benson_at_line, int render_benson_only, double fov, double monitor_distance, double benson_size);
+void opengl_blit_image(uint8_t *rgb, int filter, int benson_at_line, int render_benson_only, double fov, double monitor_distance, double benson_size, int benson_case);
void opengl_blit_osd(int num, uint8_t *rgba, int filter, int benson_at_line, double fov, double monitor_distnace, double benson_size, double scale_x, double scale_y, double offset_x, double offset_y);
void opengl_render_color(double r, double g, double b, double a);
void opengl_render_polygon(double *x, double *y, double *z, int count, int cull_face);
#endif
if (rc)
goto goto_legacy;
- opengl_blit_image(image, config_video_filter, (double_pixel_size) ? BENSON_AT_LINE * 2 : BENSON_AT_LINE, 1, config_fov, config_monitor_distance, benson_size);
+#ifdef HAVE_OVR
+ opengl_blit_image(image, config_video_filter, (double_pixel_size) ? BENSON_AT_LINE * 2 : BENSON_AT_LINE, 1, config_fov, config_monitor_distance, benson_size, 1);
+#else
+ opengl_blit_image(image, config_video_filter, (double_pixel_size) ? BENSON_AT_LINE * 2 : BENSON_AT_LINE, 1, config_fov, config_monitor_distance, benson_size, 0);
+#endif
if (help_view)
opengl_blit_osd(0, help_osd, config_video_filter, (double_pixel_size) ? BENSON_AT_LINE * 2 : BENSON_AT_LINE, config_fov, config_monitor_distance, benson_size, 1.0, 1.0, 0.0, 0.0);
if (osd_timer) {
/* viewport and frustum is set here */
opengl_viewport(window_width, window_height, (debug_opengl) ? 1 : 0, (double_pixel_size) ? BENSON_AT_LINE * 2 : BENSON_AT_LINE, config_fov, 1.0);
#endif
- opengl_blit_image(image, config_video_filter, (double_pixel_size) ? BENSON_AT_LINE * 2 : BENSON_AT_LINE, 0, config_fov, config_monitor_distance, 1.0);
+ opengl_blit_image(image, config_video_filter, (double_pixel_size) ? BENSON_AT_LINE * 2 : BENSON_AT_LINE, 0, config_fov, config_monitor_distance, 1.0, 0);
if (help_view)
opengl_blit_osd(0, help_osd, config_video_filter, (double_pixel_size) ? BENSON_AT_LINE * 2 : BENSON_AT_LINE, config_fov, config_monitor_distance, 1.0, 1.0, 1.0, 0.0, 0.0);
if (osd_timer) {