Changeset 27069 in vbox for trunk/src/VBox/GuestHost/OpenGL/state_tracker/state_polygon.c
- Timestamp:
- Mar 5, 2010 11:01:49 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/GuestHost/OpenGL/state_tracker/state_polygon.c
r15532 r27069 13 13 void crStatePolygonInit(CRContext *ctx) 14 14 { 15 16 CRStateBits *sb = GetCurrentBits(); 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 15 CRPolygonState *p = &ctx->polygon; 16 CRStateBits *sb = GetCurrentBits(); 17 CRPolygonBits *pb = &(sb->polygon); 18 int i; 19 20 p->polygonSmooth = GL_FALSE; 21 p->polygonOffsetFill = GL_FALSE; 22 p->polygonOffsetLine = GL_FALSE; 23 p->polygonOffsetPoint = GL_FALSE; 24 p->polygonStipple = GL_FALSE; 25 p->cullFace = GL_FALSE; 26 RESET(pb->enable, ctx->bitid); 27 28 p->offsetFactor = 0; 29 p->offsetUnits = 0; 30 RESET(pb->offset, ctx->bitid); 31 32 p->cullFaceMode = GL_BACK; 33 p->frontFace = GL_CCW; 34 p->frontMode = GL_FILL; 35 p->backMode = GL_FILL; 36 RESET(pb->mode, ctx->bitid); 37 38 for (i=0; i<32; i++) 39 p->stipple[i] = 0xFFFFFFFF; 40 RESET(pb->stipple, ctx->bitid); 41 42 RESET(pb->dirty, ctx->bitid); 43 43 } 44 44 45 45 void STATE_APIENTRY crStateCullFace(GLenum mode) 46 46 { 47 48 49 CRStateBits *sb = GetCurrentBits(); 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 47 CRContext *g = GetCurrentContext(); 48 CRPolygonState *p = &(g->polygon); 49 CRStateBits *sb = GetCurrentBits(); 50 CRPolygonBits *pb = &(sb->polygon); 51 52 if (g->current.inBeginEnd) 53 { 54 crStateError(__LINE__, __FILE__, GL_INVALID_OPERATION, 55 "glCullFace called in begin/end"); 56 return; 57 } 58 59 FLUSH(); 60 61 if (mode != GL_FRONT && mode != GL_BACK && mode != GL_FRONT_AND_BACK) 62 { 63 crStateError(__LINE__, __FILE__, GL_INVALID_ENUM, 64 "glCullFace called with bogus mode: 0x%x", mode); 65 return; 66 } 67 68 p->cullFaceMode = mode; 69 DIRTY(pb->mode, g->neg_bitid); 70 DIRTY(pb->dirty, g->neg_bitid); 71 71 } 72 72 73 73 void STATE_APIENTRY crStateFrontFace (GLenum mode) 74 74 { 75 76 77 CRStateBits *sb = GetCurrentBits(); 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 75 CRContext *g = GetCurrentContext(); 76 CRPolygonState *p = &(g->polygon); 77 CRStateBits *sb = GetCurrentBits(); 78 CRPolygonBits *pb = &(sb->polygon); 79 80 if (g->current.inBeginEnd) 81 { 82 crStateError(__LINE__, __FILE__, GL_INVALID_OPERATION, 83 "glFrontFace called in begin/end"); 84 return; 85 } 86 87 FLUSH(); 88 89 if (mode != GL_CW && mode != GL_CCW) 90 { 91 crStateError(__LINE__, __FILE__, GL_INVALID_ENUM, 92 "glFrontFace called with bogus mode: 0x%x", mode); 93 return; 94 } 95 96 p->frontFace = mode; 97 DIRTY(pb->mode, g->neg_bitid); 98 DIRTY(pb->dirty, g->neg_bitid); 99 99 } 100 100 101 101 void STATE_APIENTRY crStatePolygonMode (GLenum face, GLenum mode) 102 102 { 103 104 105 CRStateBits *sb = GetCurrentBits(); 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 103 CRContext *g = GetCurrentContext(); 104 CRPolygonState *p = &(g->polygon); 105 CRStateBits *sb = GetCurrentBits(); 106 CRPolygonBits *pb = &(sb->polygon); 107 108 if (g->current.inBeginEnd) 109 { 110 crStateError(__LINE__, __FILE__, GL_INVALID_OPERATION, 111 "glPolygonMode called in begin/end"); 112 return; 113 } 114 115 FLUSH(); 116 117 if (mode != GL_POINT && mode != GL_LINE && mode != GL_FILL) 118 { 119 crStateError(__LINE__, __FILE__, GL_INVALID_ENUM, 120 "glPolygonMode called with bogus mode: 0x%x", mode); 121 return; 122 } 123 124 switch (face) { 125 case GL_FRONT: 126 p->frontMode = mode; 127 break; 128 case GL_FRONT_AND_BACK: 129 p->frontMode = mode; 130 case GL_BACK: 131 p->backMode = mode; 132 break; 133 default: 134 crStateError(__LINE__, __FILE__, GL_INVALID_ENUM, 135 "glPolygonMode called with bogus face: 0x%x", face); 136 return; 137 } 138 DIRTY(pb->mode, g->neg_bitid); 139 DIRTY(pb->dirty, g->neg_bitid); 140 140 } 141 141 142 142 void STATE_APIENTRY crStatePolygonOffset (GLfloat factor, GLfloat units) 143 143 { 144 145 146 CRStateBits *sb = GetCurrentBits(); 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 144 CRContext *g = GetCurrentContext(); 145 CRPolygonState *p = &(g->polygon); 146 CRStateBits *sb = GetCurrentBits(); 147 CRPolygonBits *pb = &(sb->polygon); 148 149 if (g->current.inBeginEnd) 150 { 151 crStateError(__LINE__, __FILE__, GL_INVALID_OPERATION, 152 "glPolygonOffset called in begin/end"); 153 return; 154 } 155 156 FLUSH(); 157 158 p->offsetFactor = factor; 159 p->offsetUnits = units; 160 161 DIRTY(pb->offset, g->neg_bitid); 162 DIRTY(pb->dirty, g->neg_bitid); 163 163 } 164 164 165 165 void STATE_APIENTRY crStatePolygonStipple (const GLubyte *p) 166 166 { 167 168 169 CRStateBits *sb = GetCurrentBits(); 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 167 CRContext *g = GetCurrentContext(); 168 CRPolygonState *poly = &(g->polygon); 169 CRStateBits *sb = GetCurrentBits(); 170 CRPolygonBits *pb = &(sb->polygon); 171 172 if (g->current.inBeginEnd) 173 { 174 crStateError(__LINE__, __FILE__, GL_INVALID_OPERATION, 175 "glPolygonStipple called in begin/end"); 176 return; 177 } 178 179 FLUSH(); 180 181 if (!p) 182 { 183 crStateError(__LINE__, __FILE__, GL_NO_ERROR, 184 "Void pointer passed to PolygonStipple"); 185 return; 186 } 187 188 crMemcpy((char*)poly->stipple, (char*)p, 128); 189 190 DIRTY(pb->dirty, g->neg_bitid); 191 DIRTY(pb->stipple, g->neg_bitid); 192 192 } 193 193 194 194 void STATE_APIENTRY crStateGetPolygonStipple( GLubyte *b ) 195 195 { 196 197 198 199 200 201 202 203 204 205 206 207 } 196 CRContext *g = GetCurrentContext(); 197 CRPolygonState *poly = &(g->polygon); 198 199 if (g->current.inBeginEnd) 200 { 201 crStateError(__LINE__, __FILE__, GL_INVALID_OPERATION, 202 "glGetPolygonStipple called in begin/end"); 203 return; 204 } 205 206 crMemcpy((char*)b, (char*)poly->stipple, 128); 207 }
Note:
See TracChangeset
for help on using the changeset viewer.