1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
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
|
/* Copyright (c) 2001, Stanford University
* All rights reserved
*
* See the file LICENSE.txt for information on redistributing this software.
*/
#include <stdio.h>
#include "state.h"
#include "state/cr_statetypes.h"
#include "state_internals.h"
void crStateHintInit (CRContext *ctx)
{
CRHintState *h = &ctx->hint;
CRStateBits *sb = GetCurrentBits();
CRHintBits *hb = &(sb->hint);
h->perspectiveCorrection = GL_DONT_CARE;
RESET(hb->perspectiveCorrection, ctx->bitid);
h->pointSmooth = GL_DONT_CARE;
RESET(hb->pointSmooth, ctx->bitid);
h->lineSmooth = GL_DONT_CARE;
RESET(hb->lineSmooth, ctx->bitid);
h->polygonSmooth = GL_DONT_CARE;
RESET(hb->polygonSmooth, ctx->bitid);
h->fog = GL_DONT_CARE;
RESET(hb->fog, ctx->bitid);
#ifdef CR_EXT_clip_volume_hint
h->clipVolumeClipping = GL_DONT_CARE;
RESET(hb->clipVolumeClipping, ctx->bitid);
#endif
#ifdef CR_ARB_texture_compression
h->textureCompression = GL_DONT_CARE;
RESET(hb->textureCompression, ctx->bitid);
#endif
#ifdef CR_SGIS_generate_mipmap
h->generateMipmap = GL_DONT_CARE;
RESET(hb->generateMipmap, ctx->bitid);
#endif
RESET(hb->dirty, ctx->bitid);
}
void STATE_APIENTRY crStateHint(GLenum target, GLenum mode)
{
CRContext *g = GetCurrentContext();
CRHintState *h = &(g->hint);
CRStateBits *sb = GetCurrentBits();
CRHintBits *hb = &(sb->hint);
if (g->current.inBeginEnd)
{
crStateError(__LINE__, __FILE__, GL_INVALID_OPERATION,
"glHint called in Begin/End");
return;
}
FLUSH();
if (mode != GL_FASTEST && mode != GL_NICEST && mode != GL_DONT_CARE) {
crStateError(__LINE__, __FILE__, GL_INVALID_ENUM,
"glHint(mode)");
return;
}
switch (target) {
case GL_PERSPECTIVE_CORRECTION_HINT:
h->perspectiveCorrection = mode;
DIRTY(hb->perspectiveCorrection, g->neg_bitid);
break;
case GL_FOG_HINT:
h->fog = mode;
DIRTY(hb->fog, g->neg_bitid);
break;
case GL_LINE_SMOOTH_HINT:
h->lineSmooth = mode;
DIRTY(hb->lineSmooth, g->neg_bitid);
break;
case GL_POINT_SMOOTH_HINT:
h->pointSmooth = mode;
DIRTY(hb->pointSmooth, g->neg_bitid);
break;
case GL_POLYGON_SMOOTH_HINT:
h->polygonSmooth = mode;
DIRTY(hb->polygonSmooth, g->neg_bitid);
break;
#ifdef CR_EXT_clip_volume_hint
case GL_CLIP_VOLUME_CLIPPING_HINT_EXT:
if (g->extensions.EXT_clip_volume_hint) {
h->clipVolumeClipping = mode;
DIRTY(hb->clipVolumeClipping, g->neg_bitid);
}
else {
crStateError(__LINE__, __FILE__, GL_INVALID_ENUM,
"glHint(target)");
return;
}
break;
#endif
#ifdef CR_ARB_texture_compression
case GL_TEXTURE_COMPRESSION_HINT_ARB:
if (g->extensions.ARB_texture_compression) {
h->textureCompression = mode;
DIRTY(hb->textureCompression, g->neg_bitid);
}
else {
crStateError(__LINE__, __FILE__, GL_INVALID_ENUM,
"glHint(target)");
return;
}
break;
#endif
#ifdef CR_SGIS_generate_mipmap
case GL_GENERATE_MIPMAP_HINT_SGIS:
if (g->extensions.SGIS_generate_mipmap) {
h->generateMipmap = mode;
DIRTY(hb->generateMipmap, g->neg_bitid);
}
else {
crStateError(__LINE__, __FILE__, GL_INVALID_ENUM,
"glHint(target)");
return;
}
break;
#endif
default:
crStateError(__LINE__, __FILE__, GL_INVALID_ENUM,
"glHint(target)");
return;
}
DIRTY(hb->dirty, g->neg_bitid);
}
|