summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Paul <brian.paul@tungstengraphics.com>2000-03-31 01:05:51 +0000
committerBrian Paul <brian.paul@tungstengraphics.com>2000-03-31 01:05:51 +0000
commitb371e0da2b51da7d941de557b62434aaaca5be02 (patch)
tree27cde542cb4fa8181a1144c68e101d115f738522
parentf2123080b51f4a242bf1d73a8e566b9abb202897 (diff)
added _mesa_create/destroy_visual()
-rw-r--r--src/mesa/main/context.c87
-rw-r--r--src/mesa/main/context.h27
2 files changed, 92 insertions, 22 deletions
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index e19fecedd9..9207753312 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -1,4 +1,4 @@
-/* $Id: context.c,v 1.51 2000/03/27 17:54:17 brianp Exp $ */
+/* $Id: context.c,v 1.52 2000/03/31 01:05:51 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -267,18 +267,23 @@ static void print_timings( GLcontext *ctx )
* Return: pointer to new GLvisual or NULL if requested parameters can't
* be met.
*/
-GLvisual *gl_create_visual( GLboolean rgbFlag,
- GLboolean alphaFlag,
- GLboolean dbFlag,
- GLboolean stereoFlag,
- GLint depthBits,
- GLint stencilBits,
- GLint accumBits,
- GLint indexBits,
- GLint redBits,
- GLint greenBits,
- GLint blueBits,
- GLint alphaBits )
+GLvisual *
+_mesa_create_visual( GLboolean rgbFlag,
+ GLboolean alphaFlag,
+ GLboolean dbFlag,
+ GLboolean stereoFlag,
+ GLint redBits,
+ GLint greenBits,
+ GLint blueBits,
+ GLint alphaBits,
+ GLint indexBits,
+ GLint depthBits,
+ GLint stencilBits,
+ GLint accumRedBits,
+ GLint accumGreenBits,
+ GLint accumBlueBits,
+ GLint accumAlphaBits,
+ GLint numSamples )
{
GLvisual *vis;
@@ -294,7 +299,16 @@ GLvisual *gl_create_visual( GLboolean rgbFlag,
if (stencilBits < 0 || stencilBits > (GLint) (8 * sizeof(GLstencil))) {
return NULL;
}
- if (accumBits < 0 || accumBits > (GLint) (8 * sizeof(GLaccum))) {
+ if (accumRedBits < 0 || accumRedBits > (GLint) (8 * sizeof(GLaccum))) {
+ return NULL;
+ }
+ if (accumGreenBits < 0 || accumGreenBits > (GLint) (8 * sizeof(GLaccum))) {
+ return NULL;
+ }
+ if (accumBlueBits < 0 || accumBlueBits > (GLint) (8 * sizeof(GLaccum))) {
+ return NULL;
+ }
+ if (accumAlphaBits < 0 || accumAlphaBits > (GLint) (8 * sizeof(GLaccum))) {
return NULL;
}
@@ -311,10 +325,13 @@ GLvisual *gl_create_visual( GLboolean rgbFlag,
vis->BlueBits = blueBits;
vis->AlphaBits = alphaFlag ? (8 * sizeof(GLubyte)) : alphaBits;
- vis->IndexBits = indexBits;
- vis->DepthBits = depthBits;
- vis->AccumBits = (accumBits > 0) ? (8 * sizeof(GLaccum)) : 0;
- vis->StencilBits = (stencilBits > 0) ? (8 * sizeof(GLstencil)) : 0;
+ vis->IndexBits = indexBits;
+ vis->DepthBits = depthBits;
+ vis->AccumRedBits = (accumRedBits > 0) ? (8 * sizeof(GLaccum)) : 0;
+ vis->AccumGreenBits = (accumGreenBits > 0) ? (8 * sizeof(GLaccum)) : 0;
+ vis->AccumBlueBits = (accumBlueBits > 0) ? (8 * sizeof(GLaccum)) : 0;
+ vis->AccumAlphaBits = (accumAlphaBits > 0) ? (8 * sizeof(GLaccum)) : 0;
+ vis->StencilBits = (stencilBits > 0) ? (8 * sizeof(GLstencil)) : 0;
vis->SoftwareAlpha = alphaFlag;
@@ -334,10 +351,38 @@ GLvisual *gl_create_visual( GLboolean rgbFlag,
}
+/* This function should no longer be used. Use _mesa_create_visual() instead */
+GLvisual *gl_create_visual( GLboolean rgbFlag,
+ GLboolean alphaFlag,
+ GLboolean dbFlag,
+ GLboolean stereoFlag,
+ GLint depthBits,
+ GLint stencilBits,
+ GLint accumBits,
+ GLint indexBits,
+ GLint redBits,
+ GLint greenBits,
+ GLint blueBits,
+ GLint alphaBits )
+{
+ return _mesa_create_visual(rgbFlag, alphaFlag, dbFlag, stereoFlag,
+ redBits, greenBits, blueBits, alphaBits,
+ indexBits, depthBits, stencilBits,
+ accumBits, accumBits, accumBits, accumBits, 0);
+}
+
+
+void
+_mesa_destroy_visual( GLvisual *vis )
+{
+ FREE(vis);
+}
+
+/* obsolete */
void gl_destroy_visual( GLvisual *vis )
{
- FREE( vis );
+ _mesa_destroy_visual(vis);
}
@@ -381,7 +426,9 @@ GLframebuffer *gl_create_framebuffer( GLvisual *visual,
}
if (softwareAccum) {
assert(visual->RGBAflag);
- assert(visual->AccumBits > 0);
+ assert(visual->AccumRedBits > 0);
+ assert(visual->AccumGreenBits > 0);
+ assert(visual->AccumBlueBits > 0);
}
if (softwareAlpha) {
assert(visual->RGBAflag);
diff --git a/src/mesa/main/context.h b/src/mesa/main/context.h
index b9cc69bc69..8e691445f1 100644
--- a/src/mesa/main/context.h
+++ b/src/mesa/main/context.h
@@ -1,4 +1,4 @@
-/* $Id: context.h,v 1.14 2000/03/19 01:10:11 brianp Exp $ */
+/* $Id: context.h,v 1.15 2000/03/31 01:05:51 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -57,6 +57,25 @@
* the colorbuffer, depth buffer, stencil buffer and accum buffer which will
* be used by the GL context and framebuffer.
*/
+extern GLvisual *
+_mesa_create_visual( GLboolean rgbFlag,
+ GLboolean alphaFlag,
+ GLboolean dbFlag,
+ GLboolean stereoFlag,
+ GLint redBits,
+ GLint greenBits,
+ GLint blueBits,
+ GLint alphaBits,
+ GLint indexBits,
+ GLint depthBits,
+ GLint stencilBits,
+ GLint accumRedBits,
+ GLint accumGreenBits,
+ GLint accumBlueBits,
+ GLint accumAlphaBits,
+ GLint numSamples );
+
+/* this function is obsolete */
extern GLvisual *gl_create_visual( GLboolean rgbFlag,
GLboolean alphaFlag,
GLboolean dbFlag,
@@ -70,7 +89,11 @@ extern GLvisual *gl_create_visual( GLboolean rgbFlag,
GLint blueBits,
GLint alphaBits );
-extern void gl_destroy_visual( GLvisual *vis );
+
+extern void
+_mesa_destroy_visual( GLvisual *vis );
+
+/*obsolete */ extern void gl_destroy_visual( GLvisual *vis );
/*