ReactOS 0.4.16-dev-297-gc569aee
polygon.c File Reference
#include <assert.h>
#include <stdlib.h>
#include <string.h>
#include "context.h"
#include "macros.h"
#include "polygon.h"
#include "types.h"
Include dependency graph for polygon.c:

Go to the source code of this file.

Functions

void gl_CullFace (GLcontext *ctx, GLenum mode)
 
void gl_FrontFace (GLcontext *ctx, GLenum mode)
 
void gl_PolygonMode (GLcontext *ctx, GLenum face, GLenum mode)
 
void gl_PolygonStipple (GLcontext *ctx, const GLubyte *mask)
 
void gl_GetPolygonStipple (GLcontext *ctx, GLubyte *mask)
 
void gl_PolygonOffset (GLcontext *ctx, GLfloat factor, GLfloat units)
 

Function Documentation

◆ gl_CullFace()

void gl_CullFace ( GLcontext ctx,
GLenum  mode 
)

Definition at line 64 of file polygon.c.

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}
void gl_error(GLcontext *ctx, GLenum error, const char *s)
Definition: context.c:1421
#define NEW_POLYGON
Definition: types.h:1235
#define GL_FRONT_AND_BACK
Definition: gl.h:336
#define GL_INVALID_OPERATION
Definition: gl.h:696
#define GL_BACK
Definition: gl.h:271
#define GL_FRONT
Definition: gl.h:270
#define GL_INVALID_ENUM
Definition: gl.h:694
GLenum mode
Definition: glext.h:6217
#define INSIDE_BEGIN_END(CTX)
Definition: macros.h:135

Referenced by execute_list(), and init_exec_pointers().

◆ gl_FrontFace()

void gl_FrontFace ( GLcontext ctx,
GLenum  mode 
)

Definition at line 80 of file polygon.c.

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}
#define GL_CW
Definition: gl.h:268
#define GL_CCW
Definition: gl.h:269

Referenced by execute_list(), and init_exec_pointers().

◆ gl_GetPolygonStipple()

void gl_GetPolygonStipple ( GLcontext ctx,
GLubyte mask 
)

Definition at line 154 of file polygon.c.

155{
156 /* TODO */
157}

Referenced by init_dlist_pointers(), and init_exec_pointers().

◆ gl_PolygonMode()

void gl_PolygonMode ( GLcontext ctx,
GLenum  face,
GLenum  mode 
)

Definition at line 95 of file polygon.c.

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}
#define GL_TRUE
Definition: gl.h:174
#define GL_POINT
Definition: gl.h:265
#define GL_FILL
Definition: gl.h:267
#define GL_LINE
Definition: gl.h:266
#define GL_FALSE
Definition: gl.h:173
GLenum GLuint GLint GLenum face
Definition: glext.h:7025

Referenced by execute_list(), and init_exec_pointers().

◆ gl_PolygonOffset()

void gl_PolygonOffset ( GLcontext ctx,
GLfloat  factor,
GLfloat  units 
)

Definition at line 161 of file polygon.c.

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}
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

Referenced by execute_list(), and init_exec_pointers().

◆ gl_PolygonStipple()

void gl_PolygonStipple ( GLcontext ctx,
const GLubyte mask 
)

Definition at line 130 of file polygon.c.

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}
#define NEW_RASTER_OPS
Definition: types.h:1233
int GLint
Definition: gl.h:156
GLenum GLint GLuint mask
Definition: glext.h:6028
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

Referenced by execute_list(), and init_exec_pointers().