33#import "MyOpenGLView.h"
37@interface OOCrosshairs (Private)
39- (void) setUpDataWithPoints:(NSArray *)points
42 overallAlpha:(GLfloat)alpha;
44- (void) setUpDataForOnePoint:(NSArray *)pointInfo
46 colorComps:(
float[4])colorComps
47 overallAlpha:(GLfloat)alpha
48 data:(GLfloat *)ioBuffer;
55- (id) initWithPoints:(NSArray *)points
58 overallAlpha:(GLfloat)alpha
60 if ((
self = [super init]))
62 if (alpha > 0.0f && (color ==
nil || [color alphaComponent] != 0.0f))
87 OOGL(glPushAttrib(GL_ENABLE_BIT));
88 OOGL(glDisable(GL_LIGHTING));
89 OOGL(glDisable(GL_TEXTURE_2D));
93 OOGL(glVertexPointer(2, GL_FLOAT,
sizeof (GLfloat) * 6, _data));
94 OOGL(glColorPointer(4, GL_FLOAT,
sizeof (GLfloat) * 6, _data + 2));
96 OOGL(glEnableClientState(GL_VERTEX_ARRAY));
97 OOGL(glEnableClientState(GL_COLOR_ARRAY));
99 OOGL(glDrawArrays(GL_LINES, 0, _count * 2));
101 OOGL(glDisableClientState(GL_VERTEX_ARRAY));
102 OOGL(glDisableClientState(GL_COLOR_ARRAY));
113- (void) setUpDataWithPoints:(NSArray *)points
116 overallAlpha:(GLfloat)alpha
119 float colorComps[4] = { 0.0f, 1.0f, 0.0f, 1.0f };
120 GLfloat *data = NULL;
122 _count = [points count];
123 if (_count == 0)
return;
125 _data = malloc(
sizeof (GLfloat) * 12 * _count);
130 for (i = 0; i < _count; i++)
132 [
self setUpDataForOnePoint:[points oo_arrayAtIndex:i]
134 colorComps:colorComps
142- (void) setUpDataForOnePoint:(NSArray *)pointInfo
144 colorComps:(
float[4])colorComps
145 overallAlpha:(GLfloat)alpha
146 data:(GLfloat *)ioBuffer
148 GLfloat x1, y1, a1, x2, y2, a2;
151 if ([pointInfo
count] >= 6)
153 a1 = [pointInfo oo_floatAtIndex:0];
154 x1 = [pointInfo oo_floatAtIndex:1] * scale;
155 y1 = [pointInfo oo_floatAtIndex:2] * scale;
156 a2 = [pointInfo oo_floatAtIndex:3];
157 x2 = [pointInfo oo_floatAtIndex:4] * scale;
158 y2 = [pointInfo oo_floatAtIndex:5] * scale;
169 a1 = OOClamp_0_1_f(OOClamp_0_1_f(a1 * a) * alpha);
170 a2 = OOClamp_0_1_f(OOClamp_0_1_f(a2 * a) * alpha);
#define OO_ENTER_OPENGL()
void OOGLPushModelView(void)
void OOGLTranslateModelView(Vector vector)
OOMatrix OOGLPopModelView(void)
#define OOVerifyOpenGLState()
BOOL OOCheckOpenGLErrors(NSString *format,...)
#define OOSetOpenGLState(STATE)
void getRed:green:blue:alpha:(float *red,[green] float *green,[blue] float *blue,[alpha] float *alpha)
void setUpDataWithPoints:scale:color:overallAlpha:(NSArray *points, [scale] GLfloat scale, [color] OOColor *color, [overallAlpha] GLfloat alpha)