summaryrefslogtreecommitdiffstats
path: root/progs
diff options
context:
space:
mode:
Diffstat (limited to 'progs')
-rw-r--r--progs/demos/osdemo.c27
1 files changed, 25 insertions, 2 deletions
diff --git a/progs/demos/osdemo.c b/progs/demos/osdemo.c
index 7411d4ad4e0..acb9d3ab01d 100644
--- a/progs/demos/osdemo.c
+++ b/progs/demos/osdemo.c
@@ -1,4 +1,4 @@
-/* $Id: osdemo.c,v 1.4 2000/03/28 16:59:39 rjfrank Exp $ */
+/* $Id: osdemo.c,v 1.5 2000/09/08 16:42:06 brianp Exp $ */
/*
* Demo of off-screen Mesa rendering
@@ -223,15 +223,38 @@ write_ppm(const char *filename, const GLubyte *buffer, int width, int height)
int main( int argc, char *argv[] )
{
+ void *buffer;
+
/* Create an RGBA-mode context */
+#if OSMESA_MAJOR_VERSION * 100 + OSMESA_MINOR_VERSION >= 305
+ /* specify Z, stencil, accum sizes */
+ OSMesaContext ctx = OSMesaCreateContextExt( GL_RGBA, 16, 0, 0, NULL );
+#else
OSMesaContext ctx = OSMesaCreateContext( GL_RGBA, NULL );
+#endif
+ if (!ctx) {
+ printf("OSMesaCreateContext failed!\n");
+ return 0;
+ }
/* Allocate the image buffer */
- void *buffer = malloc( WIDTH * HEIGHT * 4 );
+ buffer = malloc( WIDTH * HEIGHT * 4 );
+ if (!buffer) {
+ printf("Alloc image buffer failed!\n");
+ return 0;
+ }
/* Bind the buffer to the context and make it current */
OSMesaMakeCurrent( ctx, buffer, GL_UNSIGNED_BYTE, WIDTH, HEIGHT );
+ {
+ int z, s, a;
+ glGetIntegerv(GL_DEPTH_BITS, &z);
+ glGetIntegerv(GL_STENCIL_BITS, &s);
+ glGetIntegerv(GL_ACCUM_RED_BITS, &a);
+ printf("%d %d %d\n", z, s, a);
+ }
+
render_image();
if (argc>1) {