xref: /reactos/dll/opengl/mesa/vb.c (revision 40462c92)
1 /* $Id: vb.c,v 1.8 1997/07/24 01:25:27 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: vb.c,v $
26  * Revision 1.8  1997/07/24 01:25:27  brianp
27  * changed precompiled header symbol from PCH to PC_HEADER
28  *
29  * Revision 1.7  1997/05/28 03:26:49  brianp
30  * added precompiled header (PCH) support
31  *
32  * Revision 1.6  1997/05/09 22:41:55  brianp
33  * replaced gl_init_vb() with gl_alloc_vb()
34  *
35  * Revision 1.5  1997/04/24 00:29:36  brianp
36  * added TexCoordSize
37  *
38  * Revision 1.4  1997/04/20 15:59:30  brianp
39  * removed VERTEX2_BIT stuff
40  *
41  * Revision 1.3  1997/04/12 16:21:24  brianp
42  * updated gl_init_vb()
43  *
44  * Revision 1.2  1996/09/27 01:31:08  brianp
45  * make gl_init_vb() non-static
46  *
47  * Revision 1.1  1996/09/13 01:38:16  brianp
48  * Initial revision
49  *
50  */
51 
52 
53 #ifdef PC_HEADER
54 #include "all.h"
55 #else
56 #include <stdlib.h>
57 #include "types.h"
58 #include "vb.h"
59 #endif
60 
61 
62 /*
63  * Allocate and initialize a vertex buffer.
64  */
65 struct vertex_buffer *gl_alloc_vb(void)
66 {
67    struct vertex_buffer *vb;
68    vb = (struct vertex_buffer *) calloc(sizeof(struct vertex_buffer), 1);
69    if (vb) {
70       /* set non-zero fields */
71       GLuint i;
72       for (i=0;i<VB_SIZE;i++) {
73          vb->MaterialMask[i] = 0;
74          vb->ClipMask[i] = 0;
75          vb->Obj[i][3] = 1.0F;
76          vb->TexCoord[i][2] = 0.0F;
77          vb->TexCoord[i][3] = 1.0F;
78       }
79       vb->VertexSizeMask = VERTEX3_BIT;
80       vb->TexCoordSize = 2;
81       vb->MonoColor = GL_TRUE;
82       vb->MonoMaterial = GL_TRUE;
83       vb->MonoNormal = GL_TRUE;
84       vb->ClipOrMask = 0;
85       vb->ClipAndMask = CLIP_ALL_BITS;
86    }
87    return vb;
88 }
89