Browse Source

Graphics driver tweaks.

Brucey 3 years ago
parent
commit
96c7205740
3 changed files with 22 additions and 13 deletions
  1. 5 2
      glgraphics.mod/glgraphics.linux.c
  2. 6 1
      glgraphics.mod/glgraphics.macos.m
  3. 11 10
      graphics.mod/graphics.bmx

+ 5 - 2
glgraphics.mod/glgraphics.linux.c

@@ -44,7 +44,8 @@ enum{
 	FLAGS_DEPTHBUFFER=	0x8,
 	FLAGS_STENCILBUFFER=0x10,
 	FLAGS_ACCUMBUFFER=	0x20,
-	FLAGS_FULLSCREEN=0x80000000
+	FLAGS_BORDERLESS=	0x40,
+	FLAGS_FULLSCREEN_DESKTOP=0x80
 };
 
 typedef struct BBGLContext BBGLContext;
@@ -280,6 +281,8 @@ BBGLContext *bbGLGraphicsCreateGraphics( int width,int height,int depth,int hz,B
 		XF86VidModeSwitchToMode(xdisplay,xscreen,mode);
 		XF86VidModeSetViewPort(xdisplay,xscreen,0,0);
 
+		int border = (flags & FLAGS_BORDERLESS) ? 0 | CWBorderPixel;
+
 		window=XCreateWindow(
 			xdisplay,
 			RootWindow(xdisplay,xscreen),
@@ -290,7 +293,7 @@ BBGLContext *bbGLGraphicsCreateGraphics( int width,int height,int depth,int hz,B
 			vizinfo->depth,
 			InputOutput,
 			vizinfo->visual,
-			CWBorderPixel|CWEventMask|CWColormap|CWOverrideRedirect,
+			border|CWEventMask|CWColormap|CWOverrideRedirect,
 			&swa
 		);
 

+ 6 - 1
glgraphics.mod/glgraphics.macos.m

@@ -12,6 +12,8 @@ enum{
 	FLAGS_DEPTHBUFFER=	0x8,
 	FLAGS_STENCILBUFFER=0x10,
 	FLAGS_ACCUMBUFFER=	0x20,
+	FLAGS_BORDERLESS=	0x40,
+	FLAGS_FULLSCREEN_DESKTOP=	0x80,
 	FLAGS_FULLSCREEN=	0x80000000
 };
 
@@ -266,10 +268,13 @@ BBGLContext *bbGLGraphicsCreateGraphics( int width,int height,int depth,int hert
 	}else{
 		if (x < 0) x = 0;
 		if (y < 0) y = 0;
+
+		NSWindowStyleMask mask = (flags & FLAGS_BORDERLESS) ? 0 : NSTitledWindowMask|NSClosableWindowMask;
+		if (flags & FLAGS_FULLSCREEN_DESKTOP) mask |= NSWindowStyleMaskFullScreen;
 		
 		window=[[BBGLWindow alloc]
 			initWithContentRect:NSMakeRect( x, y,width,height )
-			styleMask:NSTitledWindowMask|NSClosableWindowMask
+			styleMask:mask
 			backing:NSBackingStoreBuffered
 			defer:YES];
 

+ 11 - 10
graphics.mod/graphics.bmx

@@ -41,19 +41,20 @@ about:
 Use this id with #AddHook to register a function that
 is called every #Flip.
 End Rem
-Global FlipHook:Int=AllocHookId()
+Global FlipHook:Int = AllocHookId()
 
-Const GRAPHICS_BACKBUFFER:Int=	$2
-Const GRAPHICS_ALPHABUFFER:Int=	$4
-Const GRAPHICS_DEPTHBUFFER:Int=	$8
-Const GRAPHICS_STENCILBUFFER:Int=	$10
-Const GRAPHICS_ACCUMBUFFER:Int=	$20
-Const GRAPHICS_BORDERLESS:Int=$40
+Const GRAPHICS_BACKBUFFER:Int = $2
+Const GRAPHICS_ALPHABUFFER:Int = $4
+Const GRAPHICS_DEPTHBUFFER:Int = $8
+Const GRAPHICS_STENCILBUFFER:Int = $10
+Const GRAPHICS_ACCUMBUFFER:Int = $20
+Const GRAPHICS_BORDERLESS:Int = $40
+Const GRAPHICS_FULLSCREEN_DESKTOP:Int = $80
 
-'Const GRAPHICS_SWAPINTERVAL0=	$40
-'Const GRAPHICS_SWAPINTERVAL1=	$80
+Const GRAPHICS_SWAPINTERVAL0:Int = $100
+Const GRAPHICS_SWAPINTERVAL1:Int = $200
 
-'Const GRAPHICS_SWAPINTERVALMASK=GRAPHICS_SWAPINTERVAL0|GRAPHICS_SWAPINTERVAL1
+Const GRAPHICS_SWAPINTERVALMASK:Int = GRAPHICS_SWAPINTERVAL0 | GRAPHICS_SWAPINTERVAL1
 
 Type TGraphics