ReactOS 0.4.16-dev-297-gc569aee
polygon.c
Go to the documentation of this file.
1/* $Id: polygon.c,v 1.7 1997/07/24 01:23:44 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: polygon.c,v $
26 * Revision 1.7 1997/07/24 01:23:44 brianp
27 * changed precompiled header symbol from PCH to PC_HEADER
28 *
29 * Revision 1.6 1997/06/03 01:58:27 brianp
30 * fixed unpacking bug in gl_PolygonStipple()
31 *
32 * Revision 1.5 1997/05/28 03:26:02 brianp
33 * added precompiled header (PCH) support
34 *
35 * Revision 1.4 1997/04/12 16:54:05 brianp
36 * new NEW_POLYGON state flag
37 *
38 * Revision 1.3 1996/10/11 03:44:58 brianp
39 * removed Polygon.OffsetBias
40 *
41 * Revision 1.2 1996/09/26 22:48:40 brianp
42 * set NEW_RASTER_OPS flag in gl_PolygonStipple() if stippling enabled
43 *
44 * Revision 1.1 1996/09/13 01:38:16 brianp
45 * Initial revision
46 *
47 */
48
49
50#ifdef PC_HEADER
51#include "all.h"
52#else
53#include <assert.h>
54#include <stdlib.h>
55#include <string.h>
56#include "context.h"
57#include "macros.h"
58#include "polygon.h"
59#include "types.h"
60#endif
61
62
63
65{
67 gl_error( ctx, GL_INVALID_ENUM, "glCullFace" );
68 return;
69 }
70 if (INSIDE_BEGIN_END(ctx)) {
71 gl_error( ctx, GL_INVALID_OPERATION, "glCullFace" );
72 return;
73 }
74 ctx->Polygon.CullFaceMode = mode;
75 ctx->NewState |= NEW_POLYGON;
76}
77
78
79
81{
82 if (INSIDE_BEGIN_END(ctx)) {
83 gl_error( ctx, GL_INVALID_OPERATION, "glFrontFace" );
84 return;
85 }
86 if (mode!=GL_CW && mode!=GL_CCW) {
87 gl_error( ctx, GL_INVALID_ENUM, "glFrontFace" );
88 return;
89 }
90 ctx->Polygon.FrontFace = mode;
91}
92
93
94
96{
97 if (INSIDE_BEGIN_END(ctx)) {
98 gl_error( ctx, GL_INVALID_OPERATION, "glPolygonMode" );
99 return;
100 }
102 gl_error( ctx, GL_INVALID_ENUM, "glPolygonMode(face)" );
103 return;
104 }
105 else if (mode!=GL_POINT && mode!=GL_LINE && mode!=GL_FILL) {
106 gl_error( ctx, GL_INVALID_ENUM, "glPolygonMode(mode)" );
107 return;
108 }
109
111 ctx->Polygon.FrontMode = mode;
112 }
114 ctx->Polygon.BackMode = mode;
115 }
116
117 /* Compute a handy "shortcut" value: */
118 if (ctx->Polygon.FrontMode!=GL_FILL || ctx->Polygon.BackMode!=GL_FILL) {
119 ctx->Polygon.Unfilled = GL_TRUE;
120 }
121 else {
122 ctx->Polygon.Unfilled = GL_FALSE;
123 }
124
125 ctx->NewState |= NEW_POLYGON;
126}
127
128
129
131{
132 GLint i;
133
134 if (INSIDE_BEGIN_END(ctx)) {
135 gl_error( ctx, GL_INVALID_OPERATION, "glPolygonStipple" );
136 return;
137 }
138
139 /* TODO: bit twiddling, unpacking */
140 for (i=0;i<32;i++) {
141 ctx->PolygonStipple[i] = (mask[i*4+0] << 24)
142 | (mask[i*4+1] << 16)
143 | (mask[i*4+2] << 8)
144 | (mask[i*4+3]);
145 }
146
147 if (ctx->Polygon.StippleFlag) {
148 ctx->NewState |= NEW_RASTER_OPS;
149 }
150}
151
152
153
155{
156 /* TODO */
157}
158
159
160
163{
164 if (INSIDE_BEGIN_END(ctx)) {
165 gl_error( ctx, GL_INVALID_OPERATION, "glPolygonOffset" );
166 return;
167 }
168 ctx->Polygon.OffsetFactor = factor;
169 ctx->Polygon.OffsetUnits = units;
170}
171
void gl_error(GLcontext *ctx, GLenum error, const char *s)
Definition: context.c:1421
#define NEW_RASTER_OPS
Definition: types.h:1233
#define NEW_POLYGON
Definition: types.h:1235
unsigned char GLubyte
Definition: gl.h:157
#define GL_TRUE
Definition: gl.h:174
#define GL_POINT
Definition: gl.h:265
float GLfloat
Definition: gl.h:161
#define GL_FRONT_AND_BACK
Definition: gl.h:336
#define GL_CW
Definition: gl.h:268
#define GL_INVALID_OPERATION
Definition: gl.h:696
unsigned int GLenum
Definition: gl.h:150
#define GL_BACK
Definition: gl.h:271
#define GL_CCW
Definition: gl.h:269
#define GL_FILL
Definition: gl.h:267
#define GL_LINE
Definition: gl.h:266
#define GL_FALSE
Definition: gl.h:173
int GLint
Definition: gl.h:156
#define GL_FRONT
Definition: gl.h:270
#define GL_INVALID_ENUM
Definition: gl.h:694
GLenum GLint GLuint mask
Definition: glext.h:6028
GLenum GLuint GLint GLenum face
Definition: glext.h:7025
GLenum mode
Definition: glext.h:6217
GLfloat units
Definition: glext.h:11727
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint factor
Definition: glfuncs.h:178
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define INSIDE_BEGIN_END(CTX)
Definition: macros.h:135
void gl_FrontFace(GLcontext *ctx, GLenum mode)
Definition: polygon.c:80
void gl_GetPolygonStipple(GLcontext *ctx, GLubyte *mask)
Definition: polygon.c:154
void gl_PolygonStipple(GLcontext *ctx, const GLubyte *mask)
Definition: polygon.c:130
void gl_CullFace(GLcontext *ctx, GLenum mode)
Definition: polygon.c:64
void gl_PolygonOffset(GLcontext *ctx, GLfloat factor, GLfloat units)
Definition: polygon.c:161
void gl_PolygonMode(GLcontext *ctx, GLenum face, GLenum mode)
Definition: polygon.c:95