Skip to content

Commit

Permalink
ovr fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
kfprimm committed Nov 26, 2023
1 parent 16639a2 commit 0eee0b5
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 24 deletions.
4 changes: 3 additions & 1 deletion src/modules/bb/graphics.gl/canvas.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
}
Expand Down
3 changes: 1 addition & 2 deletions src/modules/bb/graphics.gl/canvas.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
19 changes: 0 additions & 19 deletions src/modules/bb/runtime.vrapi/runtime.vrapi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -309,26 +309,13 @@ 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;

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;

Expand All @@ -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(){
}

Expand Down
4 changes: 2 additions & 2 deletions test/modules/graphics.bb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 0eee0b5

Please sign in to comment.