xref: /reactos/dll/opengl/mesa/quads.c (revision 58588b76)
1 /* $Id: quads.c,v 1.5 1997/08/19 02:44:18 brianp Exp $ */
2 
3 /*
4  * Mesa 3-D graphics library
5  * Version:  2.4
6  * Copyright (C) 1995-1997  Brian Paul
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Library General Public
10  * License as published by the Free Software Foundation; either
11  * version 2 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16  * Library General Public License for more details.
17  *
18  * You should have received a copy of the GNU Library General Public
19  * License along with this library; if not, write to the Free
20  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21  */
22 
23 
24 /*
25  * $Log: quads.c,v $
26  * Revision 1.5  1997/08/19 02:44:18  brianp
27  * added null_quad() and re-implemented gl_set_quad_function()
28  *
29  * Revision 1.4  1997/07/24 01:23:44  brianp
30  * changed precompiled header symbol from PCH to PC_HEADER
31  *
32  * Revision 1.3  1997/05/28 03:26:18  brianp
33  * added precompiled header (PCH) support
34  *
35  * Revision 1.2  1997/04/20 19:45:46  brianp
36  * added a comment
37  *
38  * Revision 1.1  1997/04/12 12:24:07  brianp
39  * Initial revision
40  *
41  */
42 
43 
44 /*
45  * Quadrilateral rendering functions.
46  */
47 
48 
49 #ifdef PC_HEADER
50 #include "all.h"
51 #else
52 #include "types.h"
53 #include "quads.h"
54 #endif
55 
56 
57 
58 /*
59  * At this time there is no quadrilateral optimization.  Just call the
60  * triangle function twice.
61  * v0, v1, v2, v3 in CCW order = front facing.
62  */
63 static void quad( GLcontext *ctx,
64                   GLuint v0, GLuint v1, GLuint v2, GLuint v3, GLuint pv )
65 {
66    (*ctx->Driver.TriangleFunc)( ctx, v0, v1, v3, pv );
67    (*ctx->Driver.TriangleFunc)( ctx, v1, v2, v3, pv );
68 }
69 
70 
71 
72 /*
73  * Draw nothing (NULL raster mode)
74  */
75 static void null_quad( GLcontext *ctx,
76                        GLuint v0, GLuint v1, GLuint v2, GLuint v3, GLuint pv )
77 {
78 }
79 
80 
81 
82 void gl_set_quad_function( GLcontext *ctx )
83 {
84    if (ctx->RenderMode==GL_RENDER) {
85       if (ctx->NoRaster) {
86          ctx->Driver.QuadFunc = null_quad;
87       }
88       else if (ctx->Driver.QuadFunc) {
89          /* Device driver will draw quads. */
90       }
91       else {
92          ctx->Driver.QuadFunc = quad;
93       }
94    }
95    else {
96       /* if in feedback or selection mode we can fall back to triangle code */
97       ctx->Driver.QuadFunc = quad;
98    }
99 }
100 
101 
102