We talked about this in the past, but I don't recall why virtualgl.org
stayed with opt-in-stencils rather than opt-out.   I've been carrying
this patch for a few years with no complaints.

-Nathan
>From 9830736048ff418941d1e93ab73324af83c5960f Mon Sep 17 00:00:00 2001
From: Nathan Kidd <nk...@opentext.com>
Date: Tue, 17 Feb 2015 16:46:49 -0500
Subject: [PATCH 3/8] Request stencil buffer in default FBConfig

Rationale: It's better to work out of the box for
known applications that require a stencil buffer. Any downside
(video memory use? performance?) is only theoretical and
not in the same severity category as not working at all.

If a stencil buffer is explicitly not wanted, use
VGL_DEFAULTFBCONFIG=GLX_STENCIL_SIZE,0
---
 doc/apprecipes.txt   | 24 ------------------------
 server/faker-glx.cpp |  8 +++++---
 2 files changed, 5 insertions(+), 27 deletions(-)

diff --git a/doc/apprecipes.txt b/doc/apprecipes.txt
index d4afceb..b3cf133 100644
--- a/doc/apprecipes.txt
+++ b/doc/apprecipes.txt
@@ -28,18 +28,6 @@
 		''libdlfaker.so'' from VirtualGL is preloaded into it.  This may be true \
 		for other versions of Abaqus as well. \
 	|
-| Abaqus v6 | Linux \
-	| Set the ''VGL_DEFAULTFBCONFIG'' environment variable to \
-		''GLX_STENCIL_SIZE,8'' prior to launching the application with ''vglrun'' \
-	| Abaqus 6.10 requires a visual with a stencil buffer, but it does not call \
-		''glXChooseVisual()'' to specify its desire for such a visual.  Thus, \
-		VirtualGL has no idea of the application's preference, and it is \
-		necessary to use ''VGL_DEFAULTFBCONFIG'' to give VirtualGL a hint as to \
-		what the application wants.  Otherwise, VirtualGL will create a Pbuffer \
-		without a stencil buffer, and this will cause incorrect rendering when \
-		using certain functions within Abaqus (such as View Cut.)  See \
-		{ref prefix="Section ": VGL_DEFAULTFBCONFIG} for further information. \
-	|
 | Cadence Allegro v16.5 | Linux \
 	| ''vglrun +sync allegro''  \
 	| Allegro relies on mixed X11/OpenGL rendering, and thus certain features \
@@ -133,18 +121,6 @@
 	| ''vglrun heretic2 +set vid_ref glx'' \
 	| {:} \
 	|
-| MAGMA5 | Linux \
-	| Set the ''VGL_DEFAULTFBCONFIG'' environment variable to \
-		''GLX_STENCIL_SIZE,8'' prior to launching the application with ''vglrun'' \
-	| MAGMA5 requires a visual with a stencil buffer, but it does not call \
-		''glXChooseVisual()'' to specify its desire for such a visual.  Thus, \
-		VirtualGL has no idea of the application's preference, and it is \
-		necessary to use ''VGL_DEFAULTFBCONFIG'' to give VirtualGL a hint as to \
-		what the application wants.  Otherwise, VirtualGL will create a Pbuffer \
-		without a stencil buffer, and this will cause incorrect rendering when \
-		using certain functions within MAGMA5.  See \
-		{ref prefix="Section ": VGL_DEFAULTFBCONFIG} for further information. \
-	|
 | Mathematica 7 | Linux \
 	| Set the ''VGL_ALLOWINDIRECT'' environment variable to ''1'' prior to \
 		launching the application with ''vglrun'' \
diff --git a/server/faker-glx.cpp b/server/faker-glx.cpp
index 328174b..d8e58ce 100644
--- a/server/faker-glx.cpp
+++ b/server/faker-glx.cpp
@@ -70,7 +70,8 @@ static GLXFBConfig matchConfig(Display *dpy, XVisualInfo *vis,
 		int defaultAttribs[]={GLX_DOUBLEBUFFER, 1, GLX_RED_SIZE, 8,
 			GLX_GREEN_SIZE, 8, GLX_BLUE_SIZE, 8, GLX_RENDER_TYPE, GLX_RGBA_BIT,
 			GLX_STEREO, 0, GLX_DRAWABLE_TYPE, GLX_PBUFFER_BIT,
-			GLX_X_VISUAL_TYPE, GLX_TRUE_COLOR, GLX_DEPTH_SIZE, 1, None};
+			GLX_X_VISUAL_TYPE, GLX_TRUE_COLOR, GLX_DEPTH_SIZE, 1,
+			GLX_STENCIL_SIZE, 8, None};
 		int attribs[256];
 
 		if(pixmap || fconfig.drawable==RRDRAWABLE_PIXMAP)
@@ -101,7 +102,7 @@ static GLXFBConfig matchConfig(Display *dpy, XVisualInfo *vis,
 				argv[argc]=arg;  argc++;
 				arg=strtok(NULL, " \t,");
 			}
-			for(int i=0, j=18; i<argc && j<256; i++)
+			for(int i=0, j=20; i<argc && j<256; i++)
 			{
 				int index;
 				index=2;
@@ -112,8 +113,9 @@ static GLXFBConfig matchConfig(Display *dpy, XVisualInfo *vis,
 				testattrib(GLX_BLUE_SIZE, index, 0, INT_MAX);
 				index=16;
 				testattrib(GLX_DEPTH_SIZE, index, 0, INT_MAX);
+				index=18;
+				testattrib(GLX_STENCIL_SIZE, index, 0, INT_MAX);
 				testattrib(GLX_ALPHA_SIZE, j, 0, INT_MAX);
-				testattrib(GLX_STENCIL_SIZE, j, 0, INT_MAX);
 				testattrib(GLX_AUX_BUFFERS, j, 0, INT_MAX);
 				testattrib(GLX_ACCUM_RED_SIZE, j, 0, INT_MAX);
 				testattrib(GLX_ACCUM_GREEN_SIZE, j, 0, INT_MAX);
-- 
1.9.1

------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
VirtualGL-Devel mailing list
VirtualGL-Devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/virtualgl-devel

Reply via email to