VirtualBox

source: vbox/trunk/src/VBox/GuestHost/OpenGL/state_tracker/state_line.c@ 36140

Last change on this file since 36140 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: 2.0 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 crStateLineInit (CRContext *ctx)
13{
14 CRLineState *l = &ctx->line;
15 CRStateBits *sb = GetCurrentBits();
16 CRLineBits *lb = &(sb->line);
17
18 l->lineSmooth = GL_FALSE;
19 l->lineStipple = GL_FALSE;
20 RESET(lb->enable, ctx->bitid);
21 l->width = 1.0f;
22 RESET(lb->width, ctx->bitid);
23 l->pattern = 0xFFFF;
24 l->repeat = 1;
25 RESET(lb->stipple, ctx->bitid);
26 /*
27 *l->aliasedlinewidth_min = c->aliasedlinewidth_min;
28 *l->aliasedlinewidth_max = c->aliasedlinewidth_max;
29 *l->aliasedlinegranularity = c->aliasedlinegranularity;
30 *l->smoothlinewidth_min = c->smoothlinewidth_min;
31 *l->smoothlinewidth_max = c->smoothlinewidth_max;
32 *l->smoothlinegranularity = c->smoothlinegranularity; */
33
34 RESET(lb->dirty, ctx->bitid);
35}
36
37void STATE_APIENTRY crStateLineWidth(GLfloat width)
38{
39 CRContext *g = GetCurrentContext();
40 CRLineState *l = &(g->line);
41 CRStateBits *sb = GetCurrentBits();
42 CRLineBits *lb = &(sb->line);
43
44 if (g->current.inBeginEnd)
45 {
46 crStateError(__LINE__, __FILE__, GL_INVALID_OPERATION, "glLineWidth called in begin/end");
47 return;
48 }
49
50 FLUSH();
51
52 if (width <= 0.0f)
53 {
54 crStateError(__LINE__, __FILE__, GL_INVALID_VALUE, "glLineWidth called with size <= 0.0: %f", width);
55 return;
56 }
57
58 l->width = width;
59 DIRTY(lb->width, g->neg_bitid);
60 DIRTY(lb->dirty, g->neg_bitid);
61}
62
63void STATE_APIENTRY crStateLineStipple(GLint factor, GLushort pattern)
64{
65 CRContext *g = GetCurrentContext();
66 CRLineState *l = &(g->line);
67 CRStateBits *sb = GetCurrentBits();
68 CRLineBits *lb = &(sb->line);
69
70 if (g->current.inBeginEnd)
71 {
72 crStateError(__LINE__, __FILE__, GL_INVALID_OPERATION,
73 "glLineStipple called in begin/end");
74 return;
75 }
76
77 FLUSH();
78
79 if (factor < 1) factor = 1;
80 if (factor > 256) factor = 256;
81
82 l->pattern = pattern;
83 l->repeat = factor;
84 DIRTY(lb->stipple, g->neg_bitid);
85 DIRTY(lb->dirty, g->neg_bitid);
86}
87
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