From 0eee0b5e1406f792a1080df73305da6fcc5cda70 Mon Sep 17 00:00:00 2001 From: Kevin Primm Date: Sun, 26 Nov 2023 18:51:33 -0500 Subject: [PATCH] ovr fixes --- src/modules/bb/graphics.gl/canvas.cpp | 4 +++- src/modules/bb/graphics.gl/canvas.h | 3 +-- .../bb/runtime.vrapi/runtime.vrapi.cpp | 19 ------------------- test/modules/graphics.bb | 4 ++-- 4 files changed, 6 insertions(+), 24 deletions(-) diff --git a/src/modules/bb/graphics.gl/canvas.cpp b/src/modules/bb/graphics.gl/canvas.cpp index 304593d4..e790babd 100644 --- a/src/modules/bb/graphics.gl/canvas.cpp +++ b/src/modules/bb/graphics.gl/canvas.cpp @@ -569,8 +569,10 @@ unsigned GLCanvas::getClsColor()const{ } void GLCanvas::set(){ + const GLenum modes[1]{ mode }; + GL( glBindFramebuffer( GL_FRAMEBUFFER,framebufferId() ) ); - GL( glDrawBuffer( mode ) ); + GL( glDrawBuffers( 1,modes ) ); GL( glReadBuffer( mode ) ); setViewport( vx,vy,vw,vh ); } diff --git a/src/modules/bb/graphics.gl/canvas.h b/src/modules/bb/graphics.gl/canvas.h index a0d24cb0..bb726ceb 100644 --- a/src/modules/bb/graphics.gl/canvas.h +++ b/src/modules/bb/graphics.gl/canvas.h @@ -14,8 +14,7 @@ class GLCanvas : public BBCanvas{ mutable unsigned char *pixels; BBImageFont *font; - int mode; - unsigned int framebuffer; + unsigned framebuffer, mode; int vx,vy,vw,vh; float scale_x,scale_y; diff --git a/src/modules/bb/runtime.vrapi/runtime.vrapi.cpp b/src/modules/bb/runtime.vrapi/runtime.vrapi.cpp index 0c23a261..0856ae9a 100644 --- a/src/modules/bb/runtime.vrapi/runtime.vrapi.cpp +++ b/src/modules/bb/runtime.vrapi/runtime.vrapi.cpp @@ -309,16 +309,6 @@ bb_int_t BBCALL bbHMDPivot() { return (bb_int_t)HMDPivot(); } -class VRAPIDefaultCanvas : public GLDefaultCanvas{ -protected: -public: - VRAPIDefaultCanvas( ContextResources *res,unsigned framebuffer,int mode,int flags ):GLDefaultCanvas(res,framebuffer,mode,flags){} - - void getViewport( int *x,int *y,int *w,int *h )const{ - *x=0;*y=0;*w=getWidth();*h=getHeight(); - } -}; - class VRAPIGraphics : public GLGraphics{ protected: int window_width,window_height,drawable_width,drawable_height; @@ -326,9 +316,6 @@ class VRAPIGraphics : public GLGraphics{ unsigned short gamma_red[256], gamma_green[256], gamma_blue[256]; public: VRAPIGraphics(){ - front_canvas=d_new VRAPIDefaultCanvas( &res,0,GL_FRONT,0 ); - back_canvas=d_new VRAPIDefaultCanvas( &res,0,GL_BACK,0 ); - drawable_width=window_width=1440; drawable_height=window_height=1584; @@ -337,12 +324,6 @@ class VRAPIGraphics : public GLGraphics{ resize(); } - ~VRAPIGraphics(){ - if( front_canvas ) delete front_canvas; - if( back_canvas ) delete back_canvas; - front_canvas=back_canvas=0; - } - void resize(){ } diff --git a/test/modules/graphics.bb b/test/modules/graphics.bb index 78e81de7..7650270a 100644 --- a/test/modules/graphics.bb +++ b/test/modules/graphics.bb @@ -24,8 +24,8 @@ Graphics 1280,720,32,2 AppTitle "hello, earth" -ExpectInt StringWidth("hello, world"), 84 -ExpectInt StringWidth("hello, wörld"), 84 +Expect StringWidth("hello, world")>0,"Strings have height" +Expect StringWidth("hello, wörld")>0,"Strings have height" ClsColor 255,0,0 Cls