VirtualBox

source: vbox/trunk/src/VBox/GuestHost/OpenGL/state_tracker/state_hint.c@ 16574

Last change on this file since 16574 was 15532, checked in by vboxsync, 16 years ago

crOpenGL: export to OSE

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 3.2 KB
Line 
1/* Copyright (c) 2001, Stanford University
2 * All rights reserved
3 *
4 * See the file LICENSE.txt for information on redistributing this software.
5 */
6
7#include <stdio.h>
8#include "state.h"
9#include "state/cr_statetypes.h"
10#include "state_internals.h"
11
12void crStateHintInit (CRContext *ctx)
13{
14 CRHintState *h = &ctx->hint;
15 CRStateBits *sb = GetCurrentBits();
16 CRHintBits *hb = &(sb->hint);
17
18 h->perspectiveCorrection = GL_DONT_CARE;
19 RESET(hb->perspectiveCorrection, ctx->bitid);
20 h->pointSmooth = GL_DONT_CARE;
21 RESET(hb->pointSmooth, ctx->bitid);
22 h->lineSmooth = GL_DONT_CARE;
23 RESET(hb->lineSmooth, ctx->bitid);
24 h->polygonSmooth = GL_DONT_CARE;
25 RESET(hb->polygonSmooth, ctx->bitid);
26 h->fog = GL_DONT_CARE;
27 RESET(hb->fog, ctx->bitid);
28#ifdef CR_EXT_clip_volume_hint
29 h->clipVolumeClipping = GL_DONT_CARE;
30 RESET(hb->clipVolumeClipping, ctx->bitid);
31#endif
32#ifdef CR_ARB_texture_compression
33 h->textureCompression = GL_DONT_CARE;
34 RESET(hb->textureCompression, ctx->bitid);
35#endif
36#ifdef CR_SGIS_generate_mipmap
37 h->generateMipmap = GL_DONT_CARE;
38 RESET(hb->generateMipmap, ctx->bitid);
39#endif
40 RESET(hb->dirty, ctx->bitid);
41}
42
43void STATE_APIENTRY crStateHint(GLenum target, GLenum mode)
44{
45 CRContext *g = GetCurrentContext();
46 CRHintState *h = &(g->hint);
47 CRStateBits *sb = GetCurrentBits();
48 CRHintBits *hb = &(sb->hint);
49
50 if (g->current.inBeginEnd)
51 {
52 crStateError(__LINE__, __FILE__, GL_INVALID_OPERATION,
53 "glHint called in Begin/End");
54 return;
55 }
56
57 FLUSH();
58
59 if (mode != GL_FASTEST && mode != GL_NICEST && mode != GL_DONT_CARE) {
60 crStateError(__LINE__, __FILE__, GL_INVALID_ENUM,
61 "glHint(mode)");
62 return;
63 }
64
65 switch (target) {
66 case GL_PERSPECTIVE_CORRECTION_HINT:
67 h->perspectiveCorrection = mode;
68 DIRTY(hb->perspectiveCorrection, g->neg_bitid);
69 break;
70 case GL_FOG_HINT:
71 h->fog = mode;
72 DIRTY(hb->fog, g->neg_bitid);
73 break;
74 case GL_LINE_SMOOTH_HINT:
75 h->lineSmooth = mode;
76 DIRTY(hb->lineSmooth, g->neg_bitid);
77 break;
78 case GL_POINT_SMOOTH_HINT:
79 h->pointSmooth = mode;
80 DIRTY(hb->pointSmooth, g->neg_bitid);
81 break;
82 case GL_POLYGON_SMOOTH_HINT:
83 h->polygonSmooth = mode;
84 DIRTY(hb->polygonSmooth, g->neg_bitid);
85 break;
86#ifdef CR_EXT_clip_volume_hint
87 case GL_CLIP_VOLUME_CLIPPING_HINT_EXT:
88 if (g->extensions.EXT_clip_volume_hint) {
89 h->clipVolumeClipping = mode;
90 DIRTY(hb->clipVolumeClipping, g->neg_bitid);
91 }
92 else {
93 crStateError(__LINE__, __FILE__, GL_INVALID_ENUM,
94 "glHint(target)");
95 return;
96 }
97 break;
98#endif
99#ifdef CR_ARB_texture_compression
100 case GL_TEXTURE_COMPRESSION_HINT_ARB:
101 if (g->extensions.ARB_texture_compression) {
102 h->textureCompression = mode;
103 DIRTY(hb->textureCompression, g->neg_bitid);
104 }
105 else {
106 crStateError(__LINE__, __FILE__, GL_INVALID_ENUM,
107 "glHint(target)");
108 return;
109 }
110 break;
111#endif
112#ifdef CR_SGIS_generate_mipmap
113 case GL_GENERATE_MIPMAP_HINT_SGIS:
114 if (g->extensions.SGIS_generate_mipmap) {
115 h->generateMipmap = mode;
116 DIRTY(hb->generateMipmap, g->neg_bitid);
117 }
118 else {
119 crStateError(__LINE__, __FILE__, GL_INVALID_ENUM,
120 "glHint(target)");
121 return;
122 }
123 break;
124#endif
125 default:
126 crStateError(__LINE__, __FILE__, GL_INVALID_ENUM,
127 "glHint(target)");
128 return;
129 }
130
131 DIRTY(hb->dirty, g->neg_bitid);
132}
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette