diff options
Diffstat (limited to '')
-rw-r--r-- | linden/indra/llui/llui.cpp | 1048 |
1 files changed, 528 insertions, 520 deletions
diff --git a/linden/indra/llui/llui.cpp b/linden/indra/llui/llui.cpp index f6ce985..5904573 100644 --- a/linden/indra/llui/llui.cpp +++ b/linden/indra/llui/llui.cpp | |||
@@ -42,6 +42,7 @@ | |||
42 | #include "v2math.h" | 42 | #include "v2math.h" |
43 | #include "v4color.h" | 43 | #include "v4color.h" |
44 | #include "llgl.h" | 44 | #include "llgl.h" |
45 | #include "llglimmediate.h" | ||
45 | #include "llrect.h" | 46 | #include "llrect.h" |
46 | #include "llimagegl.h" | 47 | #include "llimagegl.h" |
47 | //#include "llviewerimage.h" | 48 | //#include "llviewerimage.h" |
@@ -148,26 +149,26 @@ void gl_draw_x(const LLRect& rect, const LLColor4& color) | |||
148 | { | 149 | { |
149 | LLGLSNoTexture no_texture; | 150 | LLGLSNoTexture no_texture; |
150 | 151 | ||
151 | glColor4fv( color.mV ); | 152 | gGL.color4fv( color.mV ); |
152 | 153 | ||
153 | glBegin( GL_LINES ); | 154 | gGL.begin( GL_LINES ); |
154 | glVertex2i( rect.mLeft, rect.mTop ); | 155 | gGL.vertex2i( rect.mLeft, rect.mTop ); |
155 | glVertex2i( rect.mRight, rect.mBottom ); | 156 | gGL.vertex2i( rect.mRight, rect.mBottom ); |
156 | glVertex2i( rect.mLeft, rect.mBottom ); | 157 | gGL.vertex2i( rect.mLeft, rect.mBottom ); |
157 | glVertex2i( rect.mRight, rect.mTop ); | 158 | gGL.vertex2i( rect.mRight, rect.mTop ); |
158 | glEnd(); | 159 | gGL.end(); |
159 | } | 160 | } |
160 | 161 | ||
161 | 162 | ||
162 | void gl_rect_2d_offset_local( S32 left, S32 top, S32 right, S32 bottom, const LLColor4 &color, S32 pixel_offset, BOOL filled) | 163 | void gl_rect_2d_offset_local( S32 left, S32 top, S32 right, S32 bottom, const LLColor4 &color, S32 pixel_offset, BOOL filled) |
163 | { | 164 | { |
164 | glColor4fv(color.mV); | 165 | gGL.color4fv(color.mV); |
165 | gl_rect_2d_offset_local(left, top, right, bottom, pixel_offset, filled); | 166 | gl_rect_2d_offset_local(left, top, right, bottom, pixel_offset, filled); |
166 | } | 167 | } |
167 | 168 | ||
168 | void gl_rect_2d_offset_local( S32 left, S32 top, S32 right, S32 bottom, S32 pixel_offset, BOOL filled) | 169 | void gl_rect_2d_offset_local( S32 left, S32 top, S32 right, S32 bottom, S32 pixel_offset, BOOL filled) |
169 | { | 170 | { |
170 | glPushMatrix(); | 171 | gGL.pushMatrix(); |
171 | left += LLFontGL::sCurOrigin.mX; | 172 | left += LLFontGL::sCurOrigin.mX; |
172 | right += LLFontGL::sCurOrigin.mX; | 173 | right += LLFontGL::sCurOrigin.mX; |
173 | bottom += LLFontGL::sCurOrigin.mY; | 174 | bottom += LLFontGL::sCurOrigin.mY; |
@@ -179,7 +180,7 @@ void gl_rect_2d_offset_local( S32 left, S32 top, S32 right, S32 bottom, S32 pixe | |||
179 | llfloor((F32)right * LLUI::sGLScaleFactor.mV[VX]) + pixel_offset, | 180 | llfloor((F32)right * LLUI::sGLScaleFactor.mV[VX]) + pixel_offset, |
180 | llfloor((F32)bottom * LLUI::sGLScaleFactor.mV[VY]) - pixel_offset, | 181 | llfloor((F32)bottom * LLUI::sGLScaleFactor.mV[VY]) - pixel_offset, |
181 | filled); | 182 | filled); |
182 | glPopMatrix(); | 183 | gGL.popMatrix(); |
183 | } | 184 | } |
184 | 185 | ||
185 | 186 | ||
@@ -191,48 +192,48 @@ void gl_rect_2d(S32 left, S32 top, S32 right, S32 bottom, BOOL filled ) | |||
191 | // Counterclockwise quad will face the viewer | 192 | // Counterclockwise quad will face the viewer |
192 | if( filled ) | 193 | if( filled ) |
193 | { | 194 | { |
194 | glBegin( GL_QUADS ); | 195 | gGL.begin( GL_QUADS ); |
195 | glVertex2i(left, top); | 196 | gGL.vertex2i(left, top); |
196 | glVertex2i(left, bottom); | 197 | gGL.vertex2i(left, bottom); |
197 | glVertex2i(right, bottom); | 198 | gGL.vertex2i(right, bottom); |
198 | glVertex2i(right, top); | 199 | gGL.vertex2i(right, top); |
199 | glEnd(); | 200 | gGL.end(); |
200 | } | 201 | } |
201 | else | 202 | else |
202 | { | 203 | { |
203 | if( gGLManager.mATIOffsetVerticalLines ) | 204 | if( gGLManager.mATIOffsetVerticalLines ) |
204 | { | 205 | { |
205 | // Work around bug in ATI driver: vertical lines are offset by (-1,-1) | 206 | // Work around bug in ATI driver: vertical lines are offset by (-1,-1) |
206 | glBegin( GL_LINES ); | 207 | gGL.begin( GL_LINES ); |
207 | 208 | ||
208 | // Verticals | 209 | // Verticals |
209 | glVertex2i(left + 1, top); | 210 | gGL.vertex2i(left + 1, top); |
210 | glVertex2i(left + 1, bottom); | 211 | gGL.vertex2i(left + 1, bottom); |
211 | 212 | ||
212 | glVertex2i(right, bottom); | 213 | gGL.vertex2i(right, bottom); |
213 | glVertex2i(right, top); | 214 | gGL.vertex2i(right, top); |
214 | 215 | ||
215 | // Horizontals | 216 | // Horizontals |
216 | top--; | 217 | top--; |
217 | right--; | 218 | right--; |
218 | glVertex2i(left, bottom); | 219 | gGL.vertex2i(left, bottom); |
219 | glVertex2i(right, bottom); | 220 | gGL.vertex2i(right, bottom); |
220 | 221 | ||
221 | glVertex2i(left, top); | 222 | gGL.vertex2i(left, top); |
222 | glVertex2i(right, top); | 223 | gGL.vertex2i(right, top); |
223 | glEnd(); | 224 | gGL.end(); |
224 | } | 225 | } |
225 | else | 226 | else |
226 | { | 227 | { |
227 | top--; | 228 | top--; |
228 | right--; | 229 | right--; |
229 | glBegin( GL_LINE_STRIP ); | 230 | gGL.begin( GL_LINE_STRIP ); |
230 | glVertex2i(left, top); | 231 | gGL.vertex2i(left, top); |
231 | glVertex2i(left, bottom); | 232 | gGL.vertex2i(left, bottom); |
232 | glVertex2i(right, bottom); | 233 | gGL.vertex2i(right, bottom); |
233 | glVertex2i(right, top); | 234 | gGL.vertex2i(right, top); |
234 | glVertex2i(left, top); | 235 | gGL.vertex2i(left, top); |
235 | glEnd(); | 236 | gGL.end(); |
236 | } | 237 | } |
237 | } | 238 | } |
238 | stop_glerror(); | 239 | stop_glerror(); |
@@ -240,14 +241,14 @@ void gl_rect_2d(S32 left, S32 top, S32 right, S32 bottom, BOOL filled ) | |||
240 | 241 | ||
241 | void gl_rect_2d(S32 left, S32 top, S32 right, S32 bottom, const LLColor4 &color, BOOL filled ) | 242 | void gl_rect_2d(S32 left, S32 top, S32 right, S32 bottom, const LLColor4 &color, BOOL filled ) |
242 | { | 243 | { |
243 | glColor4fv( color.mV ); | 244 | gGL.color4fv( color.mV ); |
244 | gl_rect_2d( left, top, right, bottom, filled ); | 245 | gl_rect_2d( left, top, right, bottom, filled ); |
245 | } | 246 | } |
246 | 247 | ||
247 | 248 | ||
248 | void gl_rect_2d( const LLRect& rect, const LLColor4& color, BOOL filled ) | 249 | void gl_rect_2d( const LLRect& rect, const LLColor4& color, BOOL filled ) |
249 | { | 250 | { |
250 | glColor4fv( color.mV ); | 251 | gGL.color4fv( color.mV ); |
251 | gl_rect_2d( rect.mLeft, rect.mTop, rect.mRight, rect.mBottom, filled ); | 252 | gl_rect_2d( rect.mLeft, rect.mTop, rect.mRight, rect.mBottom, filled ); |
252 | } | 253 | } |
253 | 254 | ||
@@ -267,52 +268,52 @@ void gl_drop_shadow(S32 left, S32 top, S32 right, S32 bottom, const LLColor4 &st | |||
267 | LLColor4 end_color = start_color; | 268 | LLColor4 end_color = start_color; |
268 | end_color.mV[VALPHA] = 0.f; | 269 | end_color.mV[VALPHA] = 0.f; |
269 | 270 | ||
270 | glBegin(GL_QUADS); | 271 | gGL.begin(GL_QUADS); |
271 | 272 | ||
272 | // Right edge, CCW faces screen | 273 | // Right edge, CCW faces screen |
273 | glColor4fv(start_color.mV); | 274 | gGL.color4fv(start_color.mV); |
274 | glVertex2i(right, top-lines); | 275 | gGL.vertex2i(right, top-lines); |
275 | glVertex2i(right, bottom); | 276 | gGL.vertex2i(right, bottom); |
276 | glColor4fv(end_color.mV); | 277 | gGL.color4fv(end_color.mV); |
277 | glVertex2i(right+lines, bottom); | 278 | gGL.vertex2i(right+lines, bottom); |
278 | glVertex2i(right+lines, top-lines); | 279 | gGL.vertex2i(right+lines, top-lines); |
279 | 280 | ||
280 | // Bottom edge, CCW faces screen | 281 | // Bottom edge, CCW faces screen |
281 | glColor4fv(start_color.mV); | 282 | gGL.color4fv(start_color.mV); |
282 | glVertex2i(right, bottom); | 283 | gGL.vertex2i(right, bottom); |
283 | glVertex2i(left+lines, bottom); | 284 | gGL.vertex2i(left+lines, bottom); |
284 | glColor4fv(end_color.mV); | 285 | gGL.color4fv(end_color.mV); |
285 | glVertex2i(left+lines, bottom-lines); | 286 | gGL.vertex2i(left+lines, bottom-lines); |
286 | glVertex2i(right, bottom-lines); | 287 | gGL.vertex2i(right, bottom-lines); |
287 | 288 | ||
288 | // bottom left Corner | 289 | // bottom left Corner |
289 | glColor4fv(start_color.mV); | 290 | gGL.color4fv(start_color.mV); |
290 | glVertex2i(left+lines, bottom); | 291 | gGL.vertex2i(left+lines, bottom); |
291 | glColor4fv(end_color.mV); | 292 | gGL.color4fv(end_color.mV); |
292 | glVertex2i(left, bottom); | 293 | gGL.vertex2i(left, bottom); |
293 | // make the bottom left corner not sharp | 294 | // make the bottom left corner not sharp |
294 | glVertex2i(left+1, bottom-lines+1); | 295 | gGL.vertex2i(left+1, bottom-lines+1); |
295 | glVertex2i(left+lines, bottom-lines); | 296 | gGL.vertex2i(left+lines, bottom-lines); |
296 | 297 | ||
297 | // bottom right corner | 298 | // bottom right corner |
298 | glColor4fv(start_color.mV); | 299 | gGL.color4fv(start_color.mV); |
299 | glVertex2i(right, bottom); | 300 | gGL.vertex2i(right, bottom); |
300 | glColor4fv(end_color.mV); | 301 | gGL.color4fv(end_color.mV); |
301 | glVertex2i(right, bottom-lines); | 302 | gGL.vertex2i(right, bottom-lines); |
302 | // make the rightmost corner not sharp | 303 | // make the rightmost corner not sharp |
303 | glVertex2i(right+lines-1, bottom-lines+1); | 304 | gGL.vertex2i(right+lines-1, bottom-lines+1); |
304 | glVertex2i(right+lines, bottom); | 305 | gGL.vertex2i(right+lines, bottom); |
305 | 306 | ||
306 | // top right corner | 307 | // top right corner |
307 | glColor4fv(start_color.mV); | 308 | gGL.color4fv(start_color.mV); |
308 | glVertex2i( right, top-lines ); | 309 | gGL.vertex2i( right, top-lines ); |
309 | glColor4fv(end_color.mV); | 310 | gGL.color4fv(end_color.mV); |
310 | glVertex2i( right+lines, top-lines ); | 311 | gGL.vertex2i( right+lines, top-lines ); |
311 | // make the corner not sharp | 312 | // make the corner not sharp |
312 | glVertex2i( right+lines-1, top-1 ); | 313 | gGL.vertex2i( right+lines-1, top-1 ); |
313 | glVertex2i( right, top ); | 314 | gGL.vertex2i( right, top ); |
314 | 315 | ||
315 | glEnd(); | 316 | gGL.end(); |
316 | stop_glerror(); | 317 | stop_glerror(); |
317 | } | 318 | } |
318 | 319 | ||
@@ -329,10 +330,10 @@ void gl_line_2d(S32 x1, S32 y1, S32 x2, S32 y2 ) | |||
329 | 330 | ||
330 | LLGLSNoTexture no_texture; | 331 | LLGLSNoTexture no_texture; |
331 | 332 | ||
332 | glBegin(GL_LINES); | 333 | gGL.begin(GL_LINES); |
333 | glVertex2i(x1, y1); | 334 | gGL.vertex2i(x1, y1); |
334 | glVertex2i(x2, y2); | 335 | gGL.vertex2i(x2, y2); |
335 | glEnd(); | 336 | gGL.end(); |
336 | } | 337 | } |
337 | 338 | ||
338 | void gl_line_2d(S32 x1, S32 y1, S32 x2, S32 y2, const LLColor4 &color ) | 339 | void gl_line_2d(S32 x1, S32 y1, S32 x2, S32 y2, const LLColor4 &color ) |
@@ -348,32 +349,32 @@ void gl_line_2d(S32 x1, S32 y1, S32 x2, S32 y2, const LLColor4 &color ) | |||
348 | 349 | ||
349 | LLGLSNoTexture no_texture; | 350 | LLGLSNoTexture no_texture; |
350 | 351 | ||
351 | glColor4fv( color.mV ); | 352 | gGL.color4fv( color.mV ); |
352 | 353 | ||
353 | glBegin(GL_LINES); | 354 | gGL.begin(GL_LINES); |
354 | glVertex2i(x1, y1); | 355 | gGL.vertex2i(x1, y1); |
355 | glVertex2i(x2, y2); | 356 | gGL.vertex2i(x2, y2); |
356 | glEnd(); | 357 | gGL.end(); |
357 | } | 358 | } |
358 | 359 | ||
359 | void gl_triangle_2d(S32 x1, S32 y1, S32 x2, S32 y2, S32 x3, S32 y3, const LLColor4& color, BOOL filled) | 360 | void gl_triangle_2d(S32 x1, S32 y1, S32 x2, S32 y2, S32 x3, S32 y3, const LLColor4& color, BOOL filled) |
360 | { | 361 | { |
361 | LLGLSNoTexture no_texture; | 362 | LLGLSNoTexture no_texture; |
362 | 363 | ||
363 | glColor4fv(color.mV); | 364 | gGL.color4fv(color.mV); |
364 | 365 | ||
365 | if (filled) | 366 | if (filled) |
366 | { | 367 | { |
367 | glBegin(GL_TRIANGLES); | 368 | gGL.begin(GL_TRIANGLES); |
368 | } | 369 | } |
369 | else | 370 | else |
370 | { | 371 | { |
371 | glBegin(GL_LINE_LOOP); | 372 | gGL.begin(GL_LINE_LOOP); |
372 | } | 373 | } |
373 | glVertex2i(x1, y1); | 374 | gGL.vertex2i(x1, y1); |
374 | glVertex2i(x2, y2); | 375 | gGL.vertex2i(x2, y2); |
375 | glVertex2i(x3, y3); | 376 | gGL.vertex2i(x3, y3); |
376 | glEnd(); | 377 | gGL.end(); |
377 | } | 378 | } |
378 | 379 | ||
379 | void gl_corners_2d(S32 left, S32 top, S32 right, S32 bottom, S32 length, F32 max_frac) | 380 | void gl_corners_2d(S32 left, S32 top, S32 right, S32 bottom, S32 length, F32 max_frac) |
@@ -382,31 +383,31 @@ void gl_corners_2d(S32 left, S32 top, S32 right, S32 bottom, S32 length, F32 max | |||
382 | 383 | ||
383 | length = llmin((S32)(max_frac*(right - left)), length); | 384 | length = llmin((S32)(max_frac*(right - left)), length); |
384 | length = llmin((S32)(max_frac*(top - bottom)), length); | 385 | length = llmin((S32)(max_frac*(top - bottom)), length); |
385 | glBegin(GL_LINES); | 386 | gGL.begin(GL_LINES); |
386 | glVertex2i(left, top); | 387 | gGL.vertex2i(left, top); |
387 | glVertex2i(left + length, top); | 388 | gGL.vertex2i(left + length, top); |
388 | 389 | ||
389 | glVertex2i(left, top); | 390 | gGL.vertex2i(left, top); |
390 | glVertex2i(left, top - length); | 391 | gGL.vertex2i(left, top - length); |
391 | 392 | ||
392 | glVertex2i(left, bottom); | 393 | gGL.vertex2i(left, bottom); |
393 | glVertex2i(left + length, bottom); | 394 | gGL.vertex2i(left + length, bottom); |
394 | 395 | ||
395 | glVertex2i(left, bottom); | 396 | gGL.vertex2i(left, bottom); |
396 | glVertex2i(left, bottom + length); | 397 | gGL.vertex2i(left, bottom + length); |
397 | 398 | ||
398 | glVertex2i(right, top); | 399 | gGL.vertex2i(right, top); |
399 | glVertex2i(right - length, top); | 400 | gGL.vertex2i(right - length, top); |
400 | 401 | ||
401 | glVertex2i(right, top); | 402 | gGL.vertex2i(right, top); |
402 | glVertex2i(right, top - length); | 403 | gGL.vertex2i(right, top - length); |
403 | 404 | ||
404 | glVertex2i(right, bottom); | 405 | gGL.vertex2i(right, bottom); |
405 | glVertex2i(right - length, bottom); | 406 | gGL.vertex2i(right - length, bottom); |
406 | 407 | ||
407 | glVertex2i(right, bottom); | 408 | gGL.vertex2i(right, bottom); |
408 | glVertex2i(right, bottom + length); | 409 | gGL.vertex2i(right, bottom + length); |
409 | glEnd(); | 410 | gGL.end(); |
410 | } | 411 | } |
411 | 412 | ||
412 | 413 | ||
@@ -499,136 +500,136 @@ void gl_draw_scaled_image_with_border(S32 x, S32 y, S32 width, S32 height, LLIma | |||
499 | glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_ALPHA_ARB, GL_SRC_ALPHA); | 500 | glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_ALPHA_ARB, GL_SRC_ALPHA); |
500 | } | 501 | } |
501 | 502 | ||
502 | glPushMatrix(); | 503 | gGL.pushMatrix(); |
503 | { | 504 | { |
504 | glTranslatef((F32)x, (F32)y, 0.f); | 505 | gGL.translatef((F32)x, (F32)y, 0.f); |
505 | 506 | ||
506 | image->bind(); | 507 | image->bind(); |
507 | 508 | ||
508 | glColor4fv(color.mV); | 509 | gGL.color4fv(color.mV); |
509 | 510 | ||
510 | glBegin(GL_QUADS); | 511 | gGL.begin(GL_QUADS); |
511 | { | 512 | { |
512 | // draw bottom left | 513 | // draw bottom left |
513 | glTexCoord2d(uv_rect.mLeft, uv_rect.mBottom); | 514 | gGL.texCoord2f(uv_rect.mLeft, uv_rect.mBottom); |
514 | glVertex2i(0, 0); | 515 | gGL.vertex2i(0, 0); |
515 | 516 | ||
516 | glTexCoord2f(clipped_scale_rect.mLeft, uv_rect.mBottom); | 517 | gGL.texCoord2f(clipped_scale_rect.mLeft, uv_rect.mBottom); |
517 | glVertex2i(draw_scale_rect.mLeft, 0); | 518 | gGL.vertex2i(draw_scale_rect.mLeft, 0); |
518 | 519 | ||
519 | glTexCoord2f(clipped_scale_rect.mLeft, clipped_scale_rect.mBottom); | 520 | gGL.texCoord2f(clipped_scale_rect.mLeft, clipped_scale_rect.mBottom); |
520 | glVertex2i(draw_scale_rect.mLeft, draw_scale_rect.mBottom); | 521 | gGL.vertex2i(draw_scale_rect.mLeft, draw_scale_rect.mBottom); |
521 | 522 | ||
522 | glTexCoord2d(uv_rect.mLeft, clipped_scale_rect.mBottom); | 523 | gGL.texCoord2f(uv_rect.mLeft, clipped_scale_rect.mBottom); |
523 | glVertex2i(0, draw_scale_rect.mBottom); | 524 | gGL.vertex2i(0, draw_scale_rect.mBottom); |
524 | 525 | ||
525 | // draw bottom middle | 526 | // draw bottom middle |
526 | glTexCoord2f(clipped_scale_rect.mLeft, uv_rect.mBottom); | 527 | gGL.texCoord2f(clipped_scale_rect.mLeft, uv_rect.mBottom); |
527 | glVertex2i(draw_scale_rect.mLeft, 0); | 528 | gGL.vertex2i(draw_scale_rect.mLeft, 0); |
528 | 529 | ||
529 | glTexCoord2d(clipped_scale_rect.mRight, uv_rect.mBottom); | 530 | gGL.texCoord2f(clipped_scale_rect.mRight, uv_rect.mBottom); |
530 | glVertex2i(draw_scale_rect.mRight, 0); | 531 | gGL.vertex2i(draw_scale_rect.mRight, 0); |
531 | 532 | ||
532 | glTexCoord2d(clipped_scale_rect.mRight, clipped_scale_rect.mBottom); | 533 | gGL.texCoord2f(clipped_scale_rect.mRight, clipped_scale_rect.mBottom); |
533 | glVertex2i(draw_scale_rect.mRight, draw_scale_rect.mBottom); | 534 | gGL.vertex2i(draw_scale_rect.mRight, draw_scale_rect.mBottom); |
534 | 535 | ||
535 | glTexCoord2f(clipped_scale_rect.mLeft, clipped_scale_rect.mBottom); | 536 | gGL.texCoord2f(clipped_scale_rect.mLeft, clipped_scale_rect.mBottom); |
536 | glVertex2i(draw_scale_rect.mLeft, draw_scale_rect.mBottom); | 537 | gGL.vertex2i(draw_scale_rect.mLeft, draw_scale_rect.mBottom); |
537 | 538 | ||
538 | // draw bottom right | 539 | // draw bottom right |
539 | glTexCoord2d(clipped_scale_rect.mRight, uv_rect.mBottom); | 540 | gGL.texCoord2f(clipped_scale_rect.mRight, uv_rect.mBottom); |
540 | glVertex2i(draw_scale_rect.mRight, 0); | 541 | gGL.vertex2i(draw_scale_rect.mRight, 0); |
541 | 542 | ||
542 | glTexCoord2d(uv_rect.mRight, uv_rect.mBottom); | 543 | gGL.texCoord2f(uv_rect.mRight, uv_rect.mBottom); |
543 | glVertex2i(width, 0); | 544 | gGL.vertex2i(width, 0); |
544 | 545 | ||
545 | glTexCoord2d(uv_rect.mRight, clipped_scale_rect.mBottom); | 546 | gGL.texCoord2f(uv_rect.mRight, clipped_scale_rect.mBottom); |
546 | glVertex2i(width, draw_scale_rect.mBottom); | 547 | gGL.vertex2i(width, draw_scale_rect.mBottom); |
547 | 548 | ||
548 | glTexCoord2d(clipped_scale_rect.mRight, clipped_scale_rect.mBottom); | 549 | gGL.texCoord2f(clipped_scale_rect.mRight, clipped_scale_rect.mBottom); |
549 | glVertex2i(draw_scale_rect.mRight, draw_scale_rect.mBottom); | 550 | gGL.vertex2i(draw_scale_rect.mRight, draw_scale_rect.mBottom); |
550 | 551 | ||
551 | // draw left | 552 | // draw left |
552 | glTexCoord2d(uv_rect.mLeft, clipped_scale_rect.mBottom); | 553 | gGL.texCoord2f(uv_rect.mLeft, clipped_scale_rect.mBottom); |
553 | glVertex2i(0, draw_scale_rect.mBottom); | 554 | gGL.vertex2i(0, draw_scale_rect.mBottom); |
554 | 555 | ||
555 | glTexCoord2f(clipped_scale_rect.mLeft, clipped_scale_rect.mBottom); | 556 | gGL.texCoord2f(clipped_scale_rect.mLeft, clipped_scale_rect.mBottom); |
556 | glVertex2i(draw_scale_rect.mLeft, draw_scale_rect.mBottom); | 557 | gGL.vertex2i(draw_scale_rect.mLeft, draw_scale_rect.mBottom); |
557 | 558 | ||
558 | glTexCoord2f(clipped_scale_rect.mLeft, clipped_scale_rect.mTop); | 559 | gGL.texCoord2f(clipped_scale_rect.mLeft, clipped_scale_rect.mTop); |
559 | glVertex2i(draw_scale_rect.mLeft, draw_scale_rect.mTop); | 560 | gGL.vertex2i(draw_scale_rect.mLeft, draw_scale_rect.mTop); |
560 | 561 | ||
561 | glTexCoord2d(uv_rect.mLeft, clipped_scale_rect.mTop); | 562 | gGL.texCoord2f(uv_rect.mLeft, clipped_scale_rect.mTop); |
562 | glVertex2i(0, draw_scale_rect.mTop); | 563 | gGL.vertex2i(0, draw_scale_rect.mTop); |
563 | 564 | ||
564 | // draw middle | 565 | // draw middle |
565 | glTexCoord2f(clipped_scale_rect.mLeft, clipped_scale_rect.mBottom); | 566 | gGL.texCoord2f(clipped_scale_rect.mLeft, clipped_scale_rect.mBottom); |
566 | glVertex2i(draw_scale_rect.mLeft, draw_scale_rect.mBottom); | 567 | gGL.vertex2i(draw_scale_rect.mLeft, draw_scale_rect.mBottom); |
567 | 568 | ||
568 | glTexCoord2d(clipped_scale_rect.mRight, clipped_scale_rect.mBottom); | 569 | gGL.texCoord2f(clipped_scale_rect.mRight, clipped_scale_rect.mBottom); |
569 | glVertex2i(draw_scale_rect.mRight, draw_scale_rect.mBottom); | 570 | gGL.vertex2i(draw_scale_rect.mRight, draw_scale_rect.mBottom); |
570 | 571 | ||
571 | glTexCoord2d(clipped_scale_rect.mRight, clipped_scale_rect.mTop); | 572 | gGL.texCoord2f(clipped_scale_rect.mRight, clipped_scale_rect.mTop); |
572 | glVertex2i(draw_scale_rect.mRight, draw_scale_rect.mTop); | 573 | gGL.vertex2i(draw_scale_rect.mRight, draw_scale_rect.mTop); |
573 | 574 | ||
574 | glTexCoord2f(clipped_scale_rect.mLeft, clipped_scale_rect.mTop); | 575 | gGL.texCoord2f(clipped_scale_rect.mLeft, clipped_scale_rect.mTop); |
575 | glVertex2i(draw_scale_rect.mLeft, draw_scale_rect.mTop); | 576 | gGL.vertex2i(draw_scale_rect.mLeft, draw_scale_rect.mTop); |
576 | 577 | ||
577 | // draw right | 578 | // draw right |
578 | glTexCoord2d(clipped_scale_rect.mRight, clipped_scale_rect.mBottom); | 579 | gGL.texCoord2f(clipped_scale_rect.mRight, clipped_scale_rect.mBottom); |
579 | glVertex2i(draw_scale_rect.mRight, draw_scale_rect.mBottom); | 580 | gGL.vertex2i(draw_scale_rect.mRight, draw_scale_rect.mBottom); |
580 | 581 | ||
581 | glTexCoord2d(uv_rect.mRight, clipped_scale_rect.mBottom); | 582 | gGL.texCoord2f(uv_rect.mRight, clipped_scale_rect.mBottom); |
582 | glVertex2i(width, draw_scale_rect.mBottom); | 583 | gGL.vertex2i(width, draw_scale_rect.mBottom); |
583 | 584 | ||
584 | glTexCoord2d(uv_rect.mRight, clipped_scale_rect.mTop); | 585 | gGL.texCoord2f(uv_rect.mRight, clipped_scale_rect.mTop); |
585 | glVertex2i(width, draw_scale_rect.mTop); | 586 | gGL.vertex2i(width, draw_scale_rect.mTop); |
586 | 587 | ||
587 | glTexCoord2d(clipped_scale_rect.mRight, clipped_scale_rect.mTop); | 588 | gGL.texCoord2f(clipped_scale_rect.mRight, clipped_scale_rect.mTop); |
588 | glVertex2i(draw_scale_rect.mRight, draw_scale_rect.mTop); | 589 | gGL.vertex2i(draw_scale_rect.mRight, draw_scale_rect.mTop); |
589 | 590 | ||
590 | // draw top left | 591 | // draw top left |
591 | glTexCoord2d(uv_rect.mLeft, clipped_scale_rect.mTop); | 592 | gGL.texCoord2f(uv_rect.mLeft, clipped_scale_rect.mTop); |
592 | glVertex2i(0, draw_scale_rect.mTop); | 593 | gGL.vertex2i(0, draw_scale_rect.mTop); |
593 | 594 | ||
594 | glTexCoord2f(clipped_scale_rect.mLeft, clipped_scale_rect.mTop); | 595 | gGL.texCoord2f(clipped_scale_rect.mLeft, clipped_scale_rect.mTop); |
595 | glVertex2i(draw_scale_rect.mLeft, draw_scale_rect.mTop); | 596 | gGL.vertex2i(draw_scale_rect.mLeft, draw_scale_rect.mTop); |
596 | 597 | ||
597 | glTexCoord2f(clipped_scale_rect.mLeft, uv_rect.mTop); | 598 | gGL.texCoord2f(clipped_scale_rect.mLeft, uv_rect.mTop); |
598 | glVertex2i(draw_scale_rect.mLeft, height); | 599 | gGL.vertex2i(draw_scale_rect.mLeft, height); |
599 | 600 | ||
600 | glTexCoord2d(uv_rect.mLeft, uv_rect.mTop); | 601 | gGL.texCoord2f(uv_rect.mLeft, uv_rect.mTop); |
601 | glVertex2i(0, height); | 602 | gGL.vertex2i(0, height); |
602 | 603 | ||
603 | // draw top middle | 604 | // draw top middle |
604 | glTexCoord2f(clipped_scale_rect.mLeft, clipped_scale_rect.mTop); | 605 | gGL.texCoord2f(clipped_scale_rect.mLeft, clipped_scale_rect.mTop); |
605 | glVertex2i(draw_scale_rect.mLeft, draw_scale_rect.mTop); | 606 | gGL.vertex2i(draw_scale_rect.mLeft, draw_scale_rect.mTop); |
606 | 607 | ||
607 | glTexCoord2d(clipped_scale_rect.mRight, clipped_scale_rect.mTop); | 608 | gGL.texCoord2f(clipped_scale_rect.mRight, clipped_scale_rect.mTop); |
608 | glVertex2i(draw_scale_rect.mRight, draw_scale_rect.mTop); | 609 | gGL.vertex2i(draw_scale_rect.mRight, draw_scale_rect.mTop); |
609 | 610 | ||
610 | glTexCoord2d(clipped_scale_rect.mRight, uv_rect.mTop); | 611 | gGL.texCoord2f(clipped_scale_rect.mRight, uv_rect.mTop); |
611 | glVertex2i(draw_scale_rect.mRight, height); | 612 | gGL.vertex2i(draw_scale_rect.mRight, height); |
612 | 613 | ||
613 | glTexCoord2f(clipped_scale_rect.mLeft, uv_rect.mTop); | 614 | gGL.texCoord2f(clipped_scale_rect.mLeft, uv_rect.mTop); |
614 | glVertex2i(draw_scale_rect.mLeft, height); | 615 | gGL.vertex2i(draw_scale_rect.mLeft, height); |
615 | 616 | ||
616 | // draw top right | 617 | // draw top right |
617 | glTexCoord2d(clipped_scale_rect.mRight, clipped_scale_rect.mTop); | 618 | gGL.texCoord2f(clipped_scale_rect.mRight, clipped_scale_rect.mTop); |
618 | glVertex2i(draw_scale_rect.mRight, draw_scale_rect.mTop); | 619 | gGL.vertex2i(draw_scale_rect.mRight, draw_scale_rect.mTop); |
619 | 620 | ||
620 | glTexCoord2d(uv_rect.mRight, clipped_scale_rect.mTop); | 621 | gGL.texCoord2f(uv_rect.mRight, clipped_scale_rect.mTop); |
621 | glVertex2i(width, draw_scale_rect.mTop); | 622 | gGL.vertex2i(width, draw_scale_rect.mTop); |
622 | 623 | ||
623 | glTexCoord2d(uv_rect.mRight, uv_rect.mTop); | 624 | gGL.texCoord2f(uv_rect.mRight, uv_rect.mTop); |
624 | glVertex2i(width, height); | 625 | gGL.vertex2i(width, height); |
625 | 626 | ||
626 | glTexCoord2d(clipped_scale_rect.mRight, uv_rect.mTop); | 627 | gGL.texCoord2f(clipped_scale_rect.mRight, uv_rect.mTop); |
627 | glVertex2i(draw_scale_rect.mRight, height); | 628 | gGL.vertex2i(draw_scale_rect.mRight, height); |
628 | } | 629 | } |
629 | glEnd(); | 630 | gGL.end(); |
630 | } | 631 | } |
631 | glPopMatrix(); | 632 | gGL.popMatrix(); |
632 | 633 | ||
633 | if (solid_color) | 634 | if (solid_color) |
634 | { | 635 | { |
@@ -651,39 +652,39 @@ void gl_draw_scaled_rotated_image(S32 x, S32 y, S32 width, S32 height, F32 degre | |||
651 | 652 | ||
652 | LLGLSUIDefault gls_ui; | 653 | LLGLSUIDefault gls_ui; |
653 | 654 | ||
654 | glPushMatrix(); | 655 | gGL.pushMatrix(); |
655 | { | 656 | { |
656 | glTranslatef((F32)x, (F32)y, 0.f); | 657 | gGL.translatef((F32)x, (F32)y, 0.f); |
657 | if( degrees ) | 658 | if( degrees ) |
658 | { | 659 | { |
659 | F32 offset_x = F32(width/2); | 660 | F32 offset_x = F32(width/2); |
660 | F32 offset_y = F32(height/2); | 661 | F32 offset_y = F32(height/2); |
661 | glTranslatef( offset_x, offset_y, 0.f); | 662 | gGL.translatef( offset_x, offset_y, 0.f); |
662 | glRotatef( degrees, 0.f, 0.f, 1.f ); | 663 | glRotatef( degrees, 0.f, 0.f, 1.f ); |
663 | glTranslatef( -offset_x, -offset_y, 0.f ); | 664 | gGL.translatef( -offset_x, -offset_y, 0.f ); |
664 | } | 665 | } |
665 | 666 | ||
666 | image->bind(); | 667 | image->bind(); |
667 | 668 | ||
668 | glColor4fv(color.mV); | 669 | gGL.color4fv(color.mV); |
669 | 670 | ||
670 | glBegin(GL_QUADS); | 671 | gGL.begin(GL_QUADS); |
671 | { | 672 | { |
672 | glTexCoord2f(uv_rect.mRight, uv_rect.mTop); | 673 | gGL.texCoord2f(uv_rect.mRight, uv_rect.mTop); |
673 | glVertex2i(width, height ); | 674 | gGL.vertex2i(width, height ); |
674 | 675 | ||
675 | glTexCoord2f(uv_rect.mLeft, uv_rect.mTop); | 676 | gGL.texCoord2f(uv_rect.mLeft, uv_rect.mTop); |
676 | glVertex2i(0, height ); | 677 | gGL.vertex2i(0, height ); |
677 | 678 | ||
678 | glTexCoord2f(uv_rect.mLeft, uv_rect.mBottom); | 679 | gGL.texCoord2f(uv_rect.mLeft, uv_rect.mBottom); |
679 | glVertex2i(0, 0); | 680 | gGL.vertex2i(0, 0); |
680 | 681 | ||
681 | glTexCoord2f(uv_rect.mRight, uv_rect.mBottom); | 682 | gGL.texCoord2f(uv_rect.mRight, uv_rect.mBottom); |
682 | glVertex2i(width, 0); | 683 | gGL.vertex2i(width, 0); |
683 | } | 684 | } |
684 | glEnd(); | 685 | gGL.end(); |
685 | } | 686 | } |
686 | glPopMatrix(); | 687 | gGL.popMatrix(); |
687 | } | 688 | } |
688 | 689 | ||
689 | 690 | ||
@@ -697,31 +698,31 @@ void gl_draw_scaled_image_inverted(S32 x, S32 y, S32 width, S32 height, LLImageG | |||
697 | 698 | ||
698 | LLGLSUIDefault gls_ui; | 699 | LLGLSUIDefault gls_ui; |
699 | 700 | ||
700 | glPushMatrix(); | 701 | gGL.pushMatrix(); |
701 | { | 702 | { |
702 | glTranslatef((F32)x, (F32)y, 0.f); | 703 | gGL.translatef((F32)x, (F32)y, 0.f); |
703 | 704 | ||
704 | image->bind(); | 705 | image->bind(); |
705 | 706 | ||
706 | glColor4fv(color.mV); | 707 | gGL.color4fv(color.mV); |
707 | 708 | ||
708 | glBegin(GL_QUADS); | 709 | gGL.begin(GL_QUADS); |
709 | { | 710 | { |
710 | glTexCoord2f(uv_rect.mRight, uv_rect.mBottom); | 711 | gGL.texCoord2f(uv_rect.mRight, uv_rect.mBottom); |
711 | glVertex2i(width, height ); | 712 | gGL.vertex2i(width, height ); |
712 | 713 | ||
713 | glTexCoord2f(uv_rect.mLeft, uv_rect.mBottom); | 714 | gGL.texCoord2f(uv_rect.mLeft, uv_rect.mBottom); |
714 | glVertex2i(0, height ); | 715 | gGL.vertex2i(0, height ); |
715 | 716 | ||
716 | glTexCoord2f(uv_rect.mLeft, uv_rect.mTop); | 717 | gGL.texCoord2f(uv_rect.mLeft, uv_rect.mTop); |
717 | glVertex2i(0, 0); | 718 | gGL.vertex2i(0, 0); |
718 | 719 | ||
719 | glTexCoord2f(uv_rect.mRight, uv_rect.mTop); | 720 | gGL.texCoord2f(uv_rect.mRight, uv_rect.mTop); |
720 | glVertex2i(width, 0); | 721 | gGL.vertex2i(width, 0); |
721 | } | 722 | } |
722 | glEnd(); | 723 | gGL.end(); |
723 | } | 724 | } |
724 | glPopMatrix(); | 725 | gGL.popMatrix(); |
725 | } | 726 | } |
726 | 727 | ||
727 | 728 | ||
@@ -734,16 +735,18 @@ void gl_stippled_line_3d( const LLVector3& start, const LLVector3& end, const LL | |||
734 | // Stippled line | 735 | // Stippled line |
735 | LLGLEnable stipple(GL_LINE_STIPPLE); | 736 | LLGLEnable stipple(GL_LINE_STIPPLE); |
736 | 737 | ||
737 | glColor4f(color.mV[VRED], color.mV[VGREEN], color.mV[VBLUE], color.mV[VALPHA]); | 738 | gGL.color4f(color.mV[VRED], color.mV[VGREEN], color.mV[VBLUE], color.mV[VALPHA]); |
739 | |||
740 | gGL.flush(); | ||
738 | glLineWidth(2.5f); | 741 | glLineWidth(2.5f); |
739 | glLineStipple(2, 0x3333 << shift); | 742 | glLineStipple(2, 0x3333 << shift); |
740 | 743 | ||
741 | glBegin(GL_LINES); | 744 | gGL.begin(GL_LINES); |
742 | { | 745 | { |
743 | glVertex3fv( start.mV ); | 746 | gGL.vertex3fv( start.mV ); |
744 | glVertex3fv( end.mV ); | 747 | gGL.vertex3fv( end.mV ); |
745 | } | 748 | } |
746 | glEnd(); | 749 | gGL.end(); |
747 | 750 | ||
748 | LLUI::setLineWidth(1.f); | 751 | LLUI::setLineWidth(1.f); |
749 | } | 752 | } |
@@ -751,16 +754,16 @@ void gl_stippled_line_3d( const LLVector3& start, const LLVector3& end, const LL | |||
751 | 754 | ||
752 | void gl_rect_2d_xor(S32 left, S32 top, S32 right, S32 bottom) | 755 | void gl_rect_2d_xor(S32 left, S32 top, S32 right, S32 bottom) |
753 | { | 756 | { |
754 | glColor4fv( LLColor4::white.mV ); | 757 | gGL.color4fv( LLColor4::white.mV ); |
755 | glLogicOp( GL_XOR ); | 758 | glLogicOp( GL_XOR ); |
756 | stop_glerror(); | 759 | stop_glerror(); |
757 | 760 | ||
758 | glBegin(GL_QUADS); | 761 | gGL.begin(GL_QUADS); |
759 | glVertex2i(left, top); | 762 | gGL.vertex2i(left, top); |
760 | glVertex2i(left, bottom); | 763 | gGL.vertex2i(left, bottom); |
761 | glVertex2i(right, bottom); | 764 | gGL.vertex2i(right, bottom); |
762 | glVertex2i(right, top); | 765 | gGL.vertex2i(right, top); |
763 | glEnd(); | 766 | gGL.end(); |
764 | 767 | ||
765 | glLogicOp( GL_COPY ); | 768 | glLogicOp( GL_COPY ); |
766 | stop_glerror(); | 769 | stop_glerror(); |
@@ -774,9 +777,9 @@ void gl_arc_2d(F32 center_x, F32 center_y, F32 radius, S32 steps, BOOL filled, F | |||
774 | end_angle += F_TWO_PI; | 777 | end_angle += F_TWO_PI; |
775 | } | 778 | } |
776 | 779 | ||
777 | glPushMatrix(); | 780 | gGL.pushMatrix(); |
778 | { | 781 | { |
779 | glTranslatef(center_x, center_y, 0.f); | 782 | gGL.translatef(center_x, center_y, 0.f); |
780 | 783 | ||
781 | // Inexact, but reasonably fast. | 784 | // Inexact, but reasonably fast. |
782 | F32 delta = (end_angle - start_angle) / steps; | 785 | F32 delta = (end_angle - start_angle) / steps; |
@@ -787,35 +790,35 @@ void gl_arc_2d(F32 center_x, F32 center_y, F32 radius, S32 steps, BOOL filled, F | |||
787 | 790 | ||
788 | if (filled) | 791 | if (filled) |
789 | { | 792 | { |
790 | glBegin(GL_TRIANGLE_FAN); | 793 | gGL.begin(GL_TRIANGLE_FAN); |
791 | glVertex2f(0.f, 0.f); | 794 | gGL.vertex2f(0.f, 0.f); |
792 | // make sure circle is complete | 795 | // make sure circle is complete |
793 | steps += 1; | 796 | steps += 1; |
794 | } | 797 | } |
795 | else | 798 | else |
796 | { | 799 | { |
797 | glBegin(GL_LINE_STRIP); | 800 | gGL.begin(GL_LINE_STRIP); |
798 | } | 801 | } |
799 | 802 | ||
800 | while( steps-- ) | 803 | while( steps-- ) |
801 | { | 804 | { |
802 | // Successive rotations | 805 | // Successive rotations |
803 | glVertex2f( x, y ); | 806 | gGL.vertex2f( x, y ); |
804 | F32 x_new = x * cos_delta - y * sin_delta; | 807 | F32 x_new = x * cos_delta - y * sin_delta; |
805 | y = x * sin_delta + y * cos_delta; | 808 | y = x * sin_delta + y * cos_delta; |
806 | x = x_new; | 809 | x = x_new; |
807 | } | 810 | } |
808 | glEnd(); | 811 | gGL.end(); |
809 | } | 812 | } |
810 | glPopMatrix(); | 813 | gGL.popMatrix(); |
811 | } | 814 | } |
812 | 815 | ||
813 | void gl_circle_2d(F32 center_x, F32 center_y, F32 radius, S32 steps, BOOL filled) | 816 | void gl_circle_2d(F32 center_x, F32 center_y, F32 radius, S32 steps, BOOL filled) |
814 | { | 817 | { |
815 | glPushMatrix(); | 818 | gGL.pushMatrix(); |
816 | { | 819 | { |
817 | LLGLSNoTexture gls_no_texture; | 820 | LLGLSNoTexture gls_no_texture; |
818 | glTranslatef(center_x, center_y, 0.f); | 821 | gGL.translatef(center_x, center_y, 0.f); |
819 | 822 | ||
820 | // Inexact, but reasonably fast. | 823 | // Inexact, but reasonably fast. |
821 | F32 delta = F_TWO_PI / steps; | 824 | F32 delta = F_TWO_PI / steps; |
@@ -826,27 +829,27 @@ void gl_circle_2d(F32 center_x, F32 center_y, F32 radius, S32 steps, BOOL filled | |||
826 | 829 | ||
827 | if (filled) | 830 | if (filled) |
828 | { | 831 | { |
829 | glBegin(GL_TRIANGLE_FAN); | 832 | gGL.begin(GL_TRIANGLE_FAN); |
830 | glVertex2f(0.f, 0.f); | 833 | gGL.vertex2f(0.f, 0.f); |
831 | // make sure circle is complete | 834 | // make sure circle is complete |
832 | steps += 1; | 835 | steps += 1; |
833 | } | 836 | } |
834 | else | 837 | else |
835 | { | 838 | { |
836 | glBegin(GL_LINE_LOOP); | 839 | gGL.begin(GL_LINE_LOOP); |
837 | } | 840 | } |
838 | 841 | ||
839 | while( steps-- ) | 842 | while( steps-- ) |
840 | { | 843 | { |
841 | // Successive rotations | 844 | // Successive rotations |
842 | glVertex2f( x, y ); | 845 | gGL.vertex2f( x, y ); |
843 | F32 x_new = x * cos_delta - y * sin_delta; | 846 | F32 x_new = x * cos_delta - y * sin_delta; |
844 | y = x * sin_delta + y * cos_delta; | 847 | y = x * sin_delta + y * cos_delta; |
845 | x = x_new; | 848 | x = x_new; |
846 | } | 849 | } |
847 | glEnd(); | 850 | gGL.end(); |
848 | } | 851 | } |
849 | glPopMatrix(); | 852 | gGL.popMatrix(); |
850 | } | 853 | } |
851 | 854 | ||
852 | // Renders a ring with sides (tube shape) | 855 | // Renders a ring with sides (tube shape) |
@@ -855,40 +858,40 @@ void gl_deep_circle( F32 radius, F32 depth, S32 steps ) | |||
855 | F32 x = radius; | 858 | F32 x = radius; |
856 | F32 y = 0.f; | 859 | F32 y = 0.f; |
857 | F32 angle_delta = F_TWO_PI / (F32)steps; | 860 | F32 angle_delta = F_TWO_PI / (F32)steps; |
858 | glBegin( GL_TRIANGLE_STRIP ); | 861 | gGL.begin( GL_TRIANGLE_STRIP ); |
859 | { | 862 | { |
860 | S32 step = steps + 1; // An extra step to close the circle. | 863 | S32 step = steps + 1; // An extra step to close the circle. |
861 | while( step-- ) | 864 | while( step-- ) |
862 | { | 865 | { |
863 | glVertex3f( x, y, depth ); | 866 | gGL.vertex3f( x, y, depth ); |
864 | glVertex3f( x, y, 0.f ); | 867 | gGL.vertex3f( x, y, 0.f ); |
865 | 868 | ||
866 | F32 x_new = x * cosf(angle_delta) - y * sinf(angle_delta); | 869 | F32 x_new = x * cosf(angle_delta) - y * sinf(angle_delta); |
867 | y = x * sinf(angle_delta) + y * cosf(angle_delta); | 870 | y = x * sinf(angle_delta) + y * cosf(angle_delta); |
868 | x = x_new; | 871 | x = x_new; |
869 | } | 872 | } |
870 | } | 873 | } |
871 | glEnd(); | 874 | gGL.end(); |
872 | } | 875 | } |
873 | 876 | ||
874 | void gl_ring( F32 radius, F32 width, const LLColor4& center_color, const LLColor4& side_color, S32 steps, BOOL render_center ) | 877 | void gl_ring( F32 radius, F32 width, const LLColor4& center_color, const LLColor4& side_color, S32 steps, BOOL render_center ) |
875 | { | 878 | { |
876 | glPushMatrix(); | 879 | gGL.pushMatrix(); |
877 | { | 880 | { |
878 | glTranslatef(0.f, 0.f, -width / 2); | 881 | gGL.translatef(0.f, 0.f, -width / 2); |
879 | if( render_center ) | 882 | if( render_center ) |
880 | { | 883 | { |
881 | glColor4fv(center_color.mV); | 884 | gGL.color4fv(center_color.mV); |
882 | gl_deep_circle( radius, width, steps ); | 885 | gl_deep_circle( radius, width, steps ); |
883 | } | 886 | } |
884 | else | 887 | else |
885 | { | 888 | { |
886 | gl_washer_2d(radius, radius - width, steps, side_color, side_color); | 889 | gl_washer_2d(radius, radius - width, steps, side_color, side_color); |
887 | glTranslatef(0.f, 0.f, width); | 890 | gGL.translatef(0.f, 0.f, width); |
888 | gl_washer_2d(radius - width, radius, steps, side_color, side_color); | 891 | gl_washer_2d(radius - width, radius, steps, side_color, side_color); |
889 | } | 892 | } |
890 | } | 893 | } |
891 | glPopMatrix(); | 894 | gGL.popMatrix(); |
892 | } | 895 | } |
893 | 896 | ||
894 | // Draw gray and white checkerboard with black border | 897 | // Draw gray and white checkerboard with black border |
@@ -913,15 +916,17 @@ void gl_rect_2d_checkerboard(const LLRect& rect) | |||
913 | LLGLSNoTexture gls_no_texture; | 916 | LLGLSNoTexture gls_no_texture; |
914 | 917 | ||
915 | // ...white squares | 918 | // ...white squares |
916 | glColor3f( 1.f, 1.f, 1.f ); | 919 | gGL.color3f( 1.f, 1.f, 1.f ); |
917 | gl_rect_2d(rect); | 920 | gl_rect_2d(rect); |
918 | 921 | ||
919 | // ...gray squares | 922 | // ...gray squares |
920 | glColor3f( .7f, .7f, .7f ); | 923 | gGL.color3f( .7f, .7f, .7f ); |
924 | gGL.flush(); | ||
921 | glPolygonStipple( checkerboard ); | 925 | glPolygonStipple( checkerboard ); |
922 | 926 | ||
923 | LLGLEnable polygon_stipple(GL_POLYGON_STIPPLE); | 927 | LLGLEnable polygon_stipple(GL_POLYGON_STIPPLE); |
924 | gl_rect_2d(rect); | 928 | gl_rect_2d(rect); |
929 | gGL.flush(); | ||
925 | } | 930 | } |
926 | 931 | ||
927 | 932 | ||
@@ -940,15 +945,15 @@ void gl_washer_2d(F32 outer_radius, F32 inner_radius, S32 steps, const LLColor4& | |||
940 | 945 | ||
941 | LLGLSNoTexture gls_no_texture; | 946 | LLGLSNoTexture gls_no_texture; |
942 | 947 | ||
943 | glBegin( GL_TRIANGLE_STRIP ); | 948 | gGL.begin( GL_TRIANGLE_STRIP ); |
944 | { | 949 | { |
945 | steps += 1; // An extra step to close the circle. | 950 | steps += 1; // An extra step to close the circle. |
946 | while( steps-- ) | 951 | while( steps-- ) |
947 | { | 952 | { |
948 | glColor4fv(outer_color.mV); | 953 | gGL.color4fv(outer_color.mV); |
949 | glVertex2f( x1, y1 ); | 954 | gGL.vertex2f( x1, y1 ); |
950 | glColor4fv(inner_color.mV); | 955 | gGL.color4fv(inner_color.mV); |
951 | glVertex2f( x2, y2 ); | 956 | gGL.vertex2f( x2, y2 ); |
952 | 957 | ||
953 | F32 x1_new = x1 * COS_DELTA - y1 * SIN_DELTA; | 958 | F32 x1_new = x1 * COS_DELTA - y1 * SIN_DELTA; |
954 | y1 = x1 * SIN_DELTA + y1 * COS_DELTA; | 959 | y1 = x1 * SIN_DELTA + y1 * COS_DELTA; |
@@ -959,7 +964,7 @@ void gl_washer_2d(F32 outer_radius, F32 inner_radius, S32 steps, const LLColor4& | |||
959 | x2 = x2_new; | 964 | x2 = x2_new; |
960 | } | 965 | } |
961 | } | 966 | } |
962 | glEnd(); | 967 | gGL.end(); |
963 | } | 968 | } |
964 | 969 | ||
965 | // Draws the area between two concentric circles, like | 970 | // Draws the area between two concentric circles, like |
@@ -976,15 +981,15 @@ void gl_washer_segment_2d(F32 outer_radius, F32 inner_radius, F32 start_radians, | |||
976 | F32 y2 = inner_radius * sin( start_radians ); | 981 | F32 y2 = inner_radius * sin( start_radians ); |
977 | 982 | ||
978 | LLGLSNoTexture gls_no_texture; | 983 | LLGLSNoTexture gls_no_texture; |
979 | glBegin( GL_TRIANGLE_STRIP ); | 984 | gGL.begin( GL_TRIANGLE_STRIP ); |
980 | { | 985 | { |
981 | steps += 1; // An extra step to close the circle. | 986 | steps += 1; // An extra step to close the circle. |
982 | while( steps-- ) | 987 | while( steps-- ) |
983 | { | 988 | { |
984 | glColor4fv(outer_color.mV); | 989 | gGL.color4fv(outer_color.mV); |
985 | glVertex2f( x1, y1 ); | 990 | gGL.vertex2f( x1, y1 ); |
986 | glColor4fv(inner_color.mV); | 991 | gGL.color4fv(inner_color.mV); |
987 | glVertex2f( x2, y2 ); | 992 | gGL.vertex2f( x2, y2 ); |
988 | 993 | ||
989 | F32 x1_new = x1 * COS_DELTA - y1 * SIN_DELTA; | 994 | F32 x1_new = x1 * COS_DELTA - y1 * SIN_DELTA; |
990 | y1 = x1 * SIN_DELTA + y1 * COS_DELTA; | 995 | y1 = x1 * SIN_DELTA + y1 * COS_DELTA; |
@@ -995,7 +1000,7 @@ void gl_washer_segment_2d(F32 outer_radius, F32 inner_radius, F32 start_radians, | |||
995 | x2 = x2_new; | 1000 | x2 = x2_new; |
996 | } | 1001 | } |
997 | } | 1002 | } |
998 | glEnd(); | 1003 | gGL.end(); |
999 | } | 1004 | } |
1000 | 1005 | ||
1001 | // Draws spokes around a circle. | 1006 | // Draws spokes around a circle. |
@@ -1013,14 +1018,14 @@ void gl_washer_spokes_2d(F32 outer_radius, F32 inner_radius, S32 count, const LL | |||
1013 | 1018 | ||
1014 | LLGLSNoTexture gls_no_texture; | 1019 | LLGLSNoTexture gls_no_texture; |
1015 | 1020 | ||
1016 | glBegin( GL_LINES ); | 1021 | gGL.begin( GL_LINES ); |
1017 | { | 1022 | { |
1018 | while( count-- ) | 1023 | while( count-- ) |
1019 | { | 1024 | { |
1020 | glColor4fv(outer_color.mV); | 1025 | gGL.color4fv(outer_color.mV); |
1021 | glVertex2f( x1, y1 ); | 1026 | gGL.vertex2f( x1, y1 ); |
1022 | glColor4fv(inner_color.mV); | 1027 | gGL.color4fv(inner_color.mV); |
1023 | glVertex2f( x2, y2 ); | 1028 | gGL.vertex2f( x2, y2 ); |
1024 | 1029 | ||
1025 | F32 x1_new = x1 * COS_DELTA - y1 * SIN_DELTA; | 1030 | F32 x1_new = x1 * COS_DELTA - y1 * SIN_DELTA; |
1026 | y1 = x1 * SIN_DELTA + y1 * COS_DELTA; | 1031 | y1 = x1 * SIN_DELTA + y1 * COS_DELTA; |
@@ -1031,36 +1036,36 @@ void gl_washer_spokes_2d(F32 outer_radius, F32 inner_radius, S32 count, const LL | |||
1031 | x2 = x2_new; | 1036 | x2 = x2_new; |
1032 | } | 1037 | } |
1033 | } | 1038 | } |
1034 | glEnd(); | 1039 | gGL.end(); |
1035 | } | 1040 | } |
1036 | 1041 | ||
1037 | void gl_rect_2d_simple_tex( S32 width, S32 height ) | 1042 | void gl_rect_2d_simple_tex( S32 width, S32 height ) |
1038 | { | 1043 | { |
1039 | glBegin( GL_QUADS ); | 1044 | gGL.begin( GL_QUADS ); |
1040 | 1045 | ||
1041 | glTexCoord2f(1.f, 1.f); | 1046 | gGL.texCoord2f(1.f, 1.f); |
1042 | glVertex2i(width, height); | 1047 | gGL.vertex2i(width, height); |
1043 | 1048 | ||
1044 | glTexCoord2f(0.f, 1.f); | 1049 | gGL.texCoord2f(0.f, 1.f); |
1045 | glVertex2i(0, height); | 1050 | gGL.vertex2i(0, height); |
1046 | 1051 | ||
1047 | glTexCoord2f(0.f, 0.f); | 1052 | gGL.texCoord2f(0.f, 0.f); |
1048 | glVertex2i(0, 0); | 1053 | gGL.vertex2i(0, 0); |
1049 | 1054 | ||
1050 | glTexCoord2f(1.f, 0.f); | 1055 | gGL.texCoord2f(1.f, 0.f); |
1051 | glVertex2i(width, 0); | 1056 | gGL.vertex2i(width, 0); |
1052 | 1057 | ||
1053 | glEnd(); | 1058 | gGL.end(); |
1054 | } | 1059 | } |
1055 | 1060 | ||
1056 | void gl_rect_2d_simple( S32 width, S32 height ) | 1061 | void gl_rect_2d_simple( S32 width, S32 height ) |
1057 | { | 1062 | { |
1058 | glBegin( GL_QUADS ); | 1063 | gGL.begin( GL_QUADS ); |
1059 | glVertex2i(width, height); | 1064 | gGL.vertex2i(width, height); |
1060 | glVertex2i(0, height); | 1065 | gGL.vertex2i(0, height); |
1061 | glVertex2i(0, 0); | 1066 | gGL.vertex2i(0, 0); |
1062 | glVertex2i(width, 0); | 1067 | gGL.vertex2i(width, 0); |
1063 | glEnd(); | 1068 | gGL.end(); |
1064 | } | 1069 | } |
1065 | 1070 | ||
1066 | void gl_segmented_rect_2d_tex(const S32 left, | 1071 | void gl_segmented_rect_2d_tex(const S32 left, |
@@ -1075,9 +1080,9 @@ void gl_segmented_rect_2d_tex(const S32 left, | |||
1075 | S32 width = llabs(right - left); | 1080 | S32 width = llabs(right - left); |
1076 | S32 height = llabs(top - bottom); | 1081 | S32 height = llabs(top - bottom); |
1077 | 1082 | ||
1078 | glPushMatrix(); | 1083 | gGL.pushMatrix(); |
1079 | 1084 | ||
1080 | glTranslatef((F32)left, (F32)bottom, 0.f); | 1085 | gGL.translatef((F32)left, (F32)bottom, 0.f); |
1081 | LLVector2 border_uv_scale((F32)border_size / (F32)texture_width, (F32)border_size / (F32)texture_height); | 1086 | LLVector2 border_uv_scale((F32)border_size / (F32)texture_width, (F32)border_size / (F32)texture_height); |
1082 | 1087 | ||
1083 | if (border_uv_scale.mV[VX] > 0.5f) | 1088 | if (border_uv_scale.mV[VX] > 0.5f) |
@@ -1097,128 +1102,128 @@ void gl_segmented_rect_2d_tex(const S32 left, | |||
1097 | LLVector2 width_vec((F32)width, 0.f); | 1102 | LLVector2 width_vec((F32)width, 0.f); |
1098 | LLVector2 height_vec(0.f, (F32)height); | 1103 | LLVector2 height_vec(0.f, (F32)height); |
1099 | 1104 | ||
1100 | glBegin(GL_QUADS); | 1105 | gGL.begin(GL_QUADS); |
1101 | { | 1106 | { |
1102 | // draw bottom left | 1107 | // draw bottom left |
1103 | glTexCoord2f(0.f, 0.f); | 1108 | gGL.texCoord2f(0.f, 0.f); |
1104 | glVertex2f(0.f, 0.f); | 1109 | gGL.vertex2f(0.f, 0.f); |
1105 | 1110 | ||
1106 | glTexCoord2f(border_uv_scale.mV[VX], 0.f); | 1111 | gGL.texCoord2f(border_uv_scale.mV[VX], 0.f); |
1107 | glVertex2fv(border_width_left.mV); | 1112 | gGL.vertex2fv(border_width_left.mV); |
1108 | 1113 | ||
1109 | glTexCoord2f(border_uv_scale.mV[VX], border_uv_scale.mV[VY]); | 1114 | gGL.texCoord2f(border_uv_scale.mV[VX], border_uv_scale.mV[VY]); |
1110 | glVertex2fv((border_width_left + border_height_bottom).mV); | 1115 | gGL.vertex2fv((border_width_left + border_height_bottom).mV); |
1111 | 1116 | ||
1112 | glTexCoord2f(0.f, border_uv_scale.mV[VY]); | 1117 | gGL.texCoord2f(0.f, border_uv_scale.mV[VY]); |
1113 | glVertex2fv(border_height_bottom.mV); | 1118 | gGL.vertex2fv(border_height_bottom.mV); |
1114 | 1119 | ||
1115 | // draw bottom middle | 1120 | // draw bottom middle |
1116 | glTexCoord2f(border_uv_scale.mV[VX], 0.f); | 1121 | gGL.texCoord2f(border_uv_scale.mV[VX], 0.f); |
1117 | glVertex2fv(border_width_left.mV); | 1122 | gGL.vertex2fv(border_width_left.mV); |
1118 | 1123 | ||
1119 | glTexCoord2f(1.f - border_uv_scale.mV[VX], 0.f); | 1124 | gGL.texCoord2f(1.f - border_uv_scale.mV[VX], 0.f); |
1120 | glVertex2fv((width_vec - border_width_right).mV); | 1125 | gGL.vertex2fv((width_vec - border_width_right).mV); |
1121 | 1126 | ||
1122 | glTexCoord2f(1.f - border_uv_scale.mV[VX], border_uv_scale.mV[VY]); | 1127 | gGL.texCoord2f(1.f - border_uv_scale.mV[VX], border_uv_scale.mV[VY]); |
1123 | glVertex2fv((width_vec - border_width_right + border_height_bottom).mV); | 1128 | gGL.vertex2fv((width_vec - border_width_right + border_height_bottom).mV); |
1124 | 1129 | ||
1125 | glTexCoord2f(border_uv_scale.mV[VX], border_uv_scale.mV[VY]); | 1130 | gGL.texCoord2f(border_uv_scale.mV[VX], border_uv_scale.mV[VY]); |
1126 | glVertex2fv((border_width_left + border_height_bottom).mV); | 1131 | gGL.vertex2fv((border_width_left + border_height_bottom).mV); |
1127 | 1132 | ||
1128 | // draw bottom right | 1133 | // draw bottom right |
1129 | glTexCoord2f(1.f - border_uv_scale.mV[VX], 0.f); | 1134 | gGL.texCoord2f(1.f - border_uv_scale.mV[VX], 0.f); |
1130 | glVertex2fv((width_vec - border_width_right).mV); | 1135 | gGL.vertex2fv((width_vec - border_width_right).mV); |
1131 | 1136 | ||
1132 | glTexCoord2f(1.f, 0.f); | 1137 | gGL.texCoord2f(1.f, 0.f); |
1133 | glVertex2fv(width_vec.mV); | 1138 | gGL.vertex2fv(width_vec.mV); |
1134 | 1139 | ||
1135 | glTexCoord2f(1.f, border_uv_scale.mV[VY]); | 1140 | gGL.texCoord2f(1.f, border_uv_scale.mV[VY]); |
1136 | glVertex2fv((width_vec + border_height_bottom).mV); | 1141 | gGL.vertex2fv((width_vec + border_height_bottom).mV); |
1137 | 1142 | ||
1138 | glTexCoord2f(1.f - border_uv_scale.mV[VX], border_uv_scale.mV[VY]); | 1143 | gGL.texCoord2f(1.f - border_uv_scale.mV[VX], border_uv_scale.mV[VY]); |
1139 | glVertex2fv((width_vec - border_width_right + border_height_bottom).mV); | 1144 | gGL.vertex2fv((width_vec - border_width_right + border_height_bottom).mV); |
1140 | 1145 | ||
1141 | // draw left | 1146 | // draw left |
1142 | glTexCoord2f(0.f, border_uv_scale.mV[VY]); | 1147 | gGL.texCoord2f(0.f, border_uv_scale.mV[VY]); |
1143 | glVertex2fv(border_height_bottom.mV); | 1148 | gGL.vertex2fv(border_height_bottom.mV); |
1144 | 1149 | ||
1145 | glTexCoord2f(border_uv_scale.mV[VX], border_uv_scale.mV[VY]); | 1150 | gGL.texCoord2f(border_uv_scale.mV[VX], border_uv_scale.mV[VY]); |
1146 | glVertex2fv((border_width_left + border_height_bottom).mV); | 1151 | gGL.vertex2fv((border_width_left + border_height_bottom).mV); |
1147 | 1152 | ||
1148 | glTexCoord2f(border_uv_scale.mV[VX], 1.f - border_uv_scale.mV[VY]); | 1153 | gGL.texCoord2f(border_uv_scale.mV[VX], 1.f - border_uv_scale.mV[VY]); |
1149 | glVertex2fv((border_width_left + height_vec - border_height_top).mV); | 1154 | gGL.vertex2fv((border_width_left + height_vec - border_height_top).mV); |
1150 | 1155 | ||
1151 | glTexCoord2f(0.f, 1.f - border_uv_scale.mV[VY]); | 1156 | gGL.texCoord2f(0.f, 1.f - border_uv_scale.mV[VY]); |
1152 | glVertex2fv((height_vec - border_height_top).mV); | 1157 | gGL.vertex2fv((height_vec - border_height_top).mV); |
1153 | 1158 | ||
1154 | // draw middle | 1159 | // draw middle |
1155 | glTexCoord2f(border_uv_scale.mV[VX], border_uv_scale.mV[VY]); | 1160 | gGL.texCoord2f(border_uv_scale.mV[VX], border_uv_scale.mV[VY]); |
1156 | glVertex2fv((border_width_left + border_height_bottom).mV); | 1161 | gGL.vertex2fv((border_width_left + border_height_bottom).mV); |
1157 | 1162 | ||
1158 | glTexCoord2f(1.f - border_uv_scale.mV[VX], border_uv_scale.mV[VY]); | 1163 | gGL.texCoord2f(1.f - border_uv_scale.mV[VX], border_uv_scale.mV[VY]); |
1159 | glVertex2fv((width_vec - border_width_right + border_height_bottom).mV); | 1164 | gGL.vertex2fv((width_vec - border_width_right + border_height_bottom).mV); |
1160 | 1165 | ||
1161 | glTexCoord2f(1.f - border_uv_scale.mV[VX], 1.f - border_uv_scale.mV[VY]); | 1166 | gGL.texCoord2f(1.f - border_uv_scale.mV[VX], 1.f - border_uv_scale.mV[VY]); |
1162 | glVertex2fv((width_vec - border_width_right + height_vec - border_height_top).mV); | 1167 | gGL.vertex2fv((width_vec - border_width_right + height_vec - border_height_top).mV); |
1163 | 1168 | ||
1164 | glTexCoord2f(border_uv_scale.mV[VX], 1.f - border_uv_scale.mV[VY]); | 1169 | gGL.texCoord2f(border_uv_scale.mV[VX], 1.f - border_uv_scale.mV[VY]); |
1165 | glVertex2fv((border_width_left + height_vec - border_height_top).mV); | 1170 | gGL.vertex2fv((border_width_left + height_vec - border_height_top).mV); |
1166 | 1171 | ||
1167 | // draw right | 1172 | // draw right |
1168 | glTexCoord2f(1.f - border_uv_scale.mV[VX], border_uv_scale.mV[VY]); | 1173 | gGL.texCoord2f(1.f - border_uv_scale.mV[VX], border_uv_scale.mV[VY]); |
1169 | glVertex2fv((width_vec - border_width_right + border_height_bottom).mV); | 1174 | gGL.vertex2fv((width_vec - border_width_right + border_height_bottom).mV); |
1170 | 1175 | ||
1171 | glTexCoord2f(1.f, border_uv_scale.mV[VY]); | 1176 | gGL.texCoord2f(1.f, border_uv_scale.mV[VY]); |
1172 | glVertex2fv((width_vec + border_height_bottom).mV); | 1177 | gGL.vertex2fv((width_vec + border_height_bottom).mV); |
1173 | 1178 | ||
1174 | glTexCoord2f(1.f, 1.f - border_uv_scale.mV[VY]); | 1179 | gGL.texCoord2f(1.f, 1.f - border_uv_scale.mV[VY]); |
1175 | glVertex2fv((width_vec + height_vec - border_height_top).mV); | 1180 | gGL.vertex2fv((width_vec + height_vec - border_height_top).mV); |
1176 | 1181 | ||
1177 | glTexCoord2f(1.f - border_uv_scale.mV[VX], 1.f - border_uv_scale.mV[VY]); | 1182 | gGL.texCoord2f(1.f - border_uv_scale.mV[VX], 1.f - border_uv_scale.mV[VY]); |
1178 | glVertex2fv((width_vec - border_width_right + height_vec - border_height_top).mV); | 1183 | gGL.vertex2fv((width_vec - border_width_right + height_vec - border_height_top).mV); |
1179 | 1184 | ||
1180 | // draw top left | 1185 | // draw top left |
1181 | glTexCoord2f(0.f, 1.f - border_uv_scale.mV[VY]); | 1186 | gGL.texCoord2f(0.f, 1.f - border_uv_scale.mV[VY]); |
1182 | glVertex2fv((height_vec - border_height_top).mV); | 1187 | gGL.vertex2fv((height_vec - border_height_top).mV); |
1183 | 1188 | ||
1184 | glTexCoord2f(border_uv_scale.mV[VX], 1.f - border_uv_scale.mV[VY]); | 1189 | gGL.texCoord2f(border_uv_scale.mV[VX], 1.f - border_uv_scale.mV[VY]); |
1185 | glVertex2fv((border_width_left + height_vec - border_height_top).mV); | 1190 | gGL.vertex2fv((border_width_left + height_vec - border_height_top).mV); |
1186 | 1191 | ||
1187 | glTexCoord2f(border_uv_scale.mV[VX], 1.f); | 1192 | gGL.texCoord2f(border_uv_scale.mV[VX], 1.f); |
1188 | glVertex2fv((border_width_left + height_vec).mV); | 1193 | gGL.vertex2fv((border_width_left + height_vec).mV); |
1189 | 1194 | ||
1190 | glTexCoord2f(0.f, 1.f); | 1195 | gGL.texCoord2f(0.f, 1.f); |
1191 | glVertex2fv((height_vec).mV); | 1196 | gGL.vertex2fv((height_vec).mV); |
1192 | 1197 | ||
1193 | // draw top middle | 1198 | // draw top middle |
1194 | glTexCoord2f(border_uv_scale.mV[VX], 1.f - border_uv_scale.mV[VY]); | 1199 | gGL.texCoord2f(border_uv_scale.mV[VX], 1.f - border_uv_scale.mV[VY]); |
1195 | glVertex2fv((border_width_left + height_vec - border_height_top).mV); | 1200 | gGL.vertex2fv((border_width_left + height_vec - border_height_top).mV); |
1196 | 1201 | ||
1197 | glTexCoord2f(1.f - border_uv_scale.mV[VX], 1.f - border_uv_scale.mV[VY]); | 1202 | gGL.texCoord2f(1.f - border_uv_scale.mV[VX], 1.f - border_uv_scale.mV[VY]); |
1198 | glVertex2fv((width_vec - border_width_right + height_vec - border_height_top).mV); | 1203 | gGL.vertex2fv((width_vec - border_width_right + height_vec - border_height_top).mV); |
1199 | 1204 | ||
1200 | glTexCoord2f(1.f - border_uv_scale.mV[VX], 1.f); | 1205 | gGL.texCoord2f(1.f - border_uv_scale.mV[VX], 1.f); |
1201 | glVertex2fv((width_vec - border_width_right + height_vec).mV); | 1206 | gGL.vertex2fv((width_vec - border_width_right + height_vec).mV); |
1202 | 1207 | ||
1203 | glTexCoord2f(border_uv_scale.mV[VX], 1.f); | 1208 | gGL.texCoord2f(border_uv_scale.mV[VX], 1.f); |
1204 | glVertex2fv((border_width_left + height_vec).mV); | 1209 | gGL.vertex2fv((border_width_left + height_vec).mV); |
1205 | 1210 | ||
1206 | // draw top right | 1211 | // draw top right |
1207 | glTexCoord2f(1.f - border_uv_scale.mV[VX], 1.f - border_uv_scale.mV[VY]); | 1212 | gGL.texCoord2f(1.f - border_uv_scale.mV[VX], 1.f - border_uv_scale.mV[VY]); |
1208 | glVertex2fv((width_vec - border_width_right + height_vec - border_height_top).mV); | 1213 | gGL.vertex2fv((width_vec - border_width_right + height_vec - border_height_top).mV); |
1209 | 1214 | ||
1210 | glTexCoord2f(1.f, 1.f - border_uv_scale.mV[VY]); | 1215 | gGL.texCoord2f(1.f, 1.f - border_uv_scale.mV[VY]); |
1211 | glVertex2fv((width_vec + height_vec - border_height_top).mV); | 1216 | gGL.vertex2fv((width_vec + height_vec - border_height_top).mV); |
1212 | 1217 | ||
1213 | glTexCoord2f(1.f, 1.f); | 1218 | gGL.texCoord2f(1.f, 1.f); |
1214 | glVertex2fv((width_vec + height_vec).mV); | 1219 | gGL.vertex2fv((width_vec + height_vec).mV); |
1215 | 1220 | ||
1216 | glTexCoord2f(1.f - border_uv_scale.mV[VX], 1.f); | 1221 | gGL.texCoord2f(1.f - border_uv_scale.mV[VX], 1.f); |
1217 | glVertex2fv((width_vec - border_width_right + height_vec).mV); | 1222 | gGL.vertex2fv((width_vec - border_width_right + height_vec).mV); |
1218 | } | 1223 | } |
1219 | glEnd(); | 1224 | gGL.end(); |
1220 | 1225 | ||
1221 | glPopMatrix(); | 1226 | gGL.popMatrix(); |
1222 | } | 1227 | } |
1223 | 1228 | ||
1224 | void gl_segmented_rect_2d_fragment_tex(const S32 left, | 1229 | void gl_segmented_rect_2d_fragment_tex(const S32 left, |
@@ -1235,9 +1240,9 @@ void gl_segmented_rect_2d_fragment_tex(const S32 left, | |||
1235 | S32 width = llabs(right - left); | 1240 | S32 width = llabs(right - left); |
1236 | S32 height = llabs(top - bottom); | 1241 | S32 height = llabs(top - bottom); |
1237 | 1242 | ||
1238 | glPushMatrix(); | 1243 | gGL.pushMatrix(); |
1239 | 1244 | ||
1240 | glTranslatef((F32)left, (F32)bottom, 0.f); | 1245 | gGL.translatef((F32)left, (F32)bottom, 0.f); |
1241 | LLVector2 border_uv_scale((F32)border_size / (F32)texture_width, (F32)border_size / (F32)texture_height); | 1246 | LLVector2 border_uv_scale((F32)border_size / (F32)texture_width, (F32)border_size / (F32)texture_height); |
1242 | 1247 | ||
1243 | if (border_uv_scale.mV[VX] > 0.5f) | 1248 | if (border_uv_scale.mV[VX] > 0.5f) |
@@ -1265,7 +1270,7 @@ void gl_segmented_rect_2d_fragment_tex(const S32 left, | |||
1265 | LLVector2 x_min; | 1270 | LLVector2 x_min; |
1266 | LLVector2 x_max; | 1271 | LLVector2 x_max; |
1267 | 1272 | ||
1268 | glBegin(GL_QUADS); | 1273 | gGL.begin(GL_QUADS); |
1269 | { | 1274 | { |
1270 | if (start_fragment < middle_start) | 1275 | if (start_fragment < middle_start) |
1271 | { | 1276 | { |
@@ -1275,43 +1280,43 @@ void gl_segmented_rect_2d_fragment_tex(const S32 left, | |||
1275 | x_max = llmin(end_fragment / middle_start, 1.f) * border_width_left; | 1280 | x_max = llmin(end_fragment / middle_start, 1.f) * border_width_left; |
1276 | 1281 | ||
1277 | // draw bottom left | 1282 | // draw bottom left |
1278 | glTexCoord2f(u_min, 0.f); | 1283 | gGL.texCoord2f(u_min, 0.f); |
1279 | glVertex2fv(x_min.mV); | 1284 | gGL.vertex2fv(x_min.mV); |
1280 | 1285 | ||
1281 | glTexCoord2f(border_uv_scale.mV[VX], 0.f); | 1286 | gGL.texCoord2f(border_uv_scale.mV[VX], 0.f); |
1282 | glVertex2fv(x_max.mV); | 1287 | gGL.vertex2fv(x_max.mV); |
1283 | 1288 | ||
1284 | glTexCoord2f(u_max, border_uv_scale.mV[VY]); | 1289 | gGL.texCoord2f(u_max, border_uv_scale.mV[VY]); |
1285 | glVertex2fv((x_max + border_height_bottom).mV); | 1290 | gGL.vertex2fv((x_max + border_height_bottom).mV); |
1286 | 1291 | ||
1287 | glTexCoord2f(u_min, border_uv_scale.mV[VY]); | 1292 | gGL.texCoord2f(u_min, border_uv_scale.mV[VY]); |
1288 | glVertex2fv((x_min + border_height_bottom).mV); | 1293 | gGL.vertex2fv((x_min + border_height_bottom).mV); |
1289 | 1294 | ||
1290 | // draw left | 1295 | // draw left |
1291 | glTexCoord2f(u_min, border_uv_scale.mV[VY]); | 1296 | gGL.texCoord2f(u_min, border_uv_scale.mV[VY]); |
1292 | glVertex2fv((x_min + border_height_bottom).mV); | 1297 | gGL.vertex2fv((x_min + border_height_bottom).mV); |
1293 | 1298 | ||
1294 | glTexCoord2f(u_max, border_uv_scale.mV[VY]); | 1299 | gGL.texCoord2f(u_max, border_uv_scale.mV[VY]); |
1295 | glVertex2fv((x_max + border_height_bottom).mV); | 1300 | gGL.vertex2fv((x_max + border_height_bottom).mV); |
1296 | 1301 | ||
1297 | glTexCoord2f(u_max, 1.f - border_uv_scale.mV[VY]); | 1302 | gGL.texCoord2f(u_max, 1.f - border_uv_scale.mV[VY]); |
1298 | glVertex2fv((x_max + height_vec - border_height_top).mV); | 1303 | gGL.vertex2fv((x_max + height_vec - border_height_top).mV); |
1299 | 1304 | ||
1300 | glTexCoord2f(u_min, 1.f - border_uv_scale.mV[VY]); | 1305 | gGL.texCoord2f(u_min, 1.f - border_uv_scale.mV[VY]); |
1301 | glVertex2fv((x_min + height_vec - border_height_top).mV); | 1306 | gGL.vertex2fv((x_min + height_vec - border_height_top).mV); |
1302 | 1307 | ||
1303 | // draw top left | 1308 | // draw top left |
1304 | glTexCoord2f(u_min, 1.f - border_uv_scale.mV[VY]); | 1309 | gGL.texCoord2f(u_min, 1.f - border_uv_scale.mV[VY]); |
1305 | glVertex2fv((x_min + height_vec - border_height_top).mV); | 1310 | gGL.vertex2fv((x_min + height_vec - border_height_top).mV); |
1306 | 1311 | ||
1307 | glTexCoord2f(u_max, 1.f - border_uv_scale.mV[VY]); | 1312 | gGL.texCoord2f(u_max, 1.f - border_uv_scale.mV[VY]); |
1308 | glVertex2fv((x_max + height_vec - border_height_top).mV); | 1313 | gGL.vertex2fv((x_max + height_vec - border_height_top).mV); |
1309 | 1314 | ||
1310 | glTexCoord2f(u_max, 1.f); | 1315 | gGL.texCoord2f(u_max, 1.f); |
1311 | glVertex2fv((x_max + height_vec).mV); | 1316 | gGL.vertex2fv((x_max + height_vec).mV); |
1312 | 1317 | ||
1313 | glTexCoord2f(u_min, 1.f); | 1318 | gGL.texCoord2f(u_min, 1.f); |
1314 | glVertex2fv((x_min + height_vec).mV); | 1319 | gGL.vertex2fv((x_min + height_vec).mV); |
1315 | } | 1320 | } |
1316 | 1321 | ||
1317 | if (end_fragment > middle_start || start_fragment < middle_end) | 1322 | if (end_fragment > middle_start || start_fragment < middle_end) |
@@ -1320,43 +1325,43 @@ void gl_segmented_rect_2d_fragment_tex(const S32 left, | |||
1320 | x_max = border_width_left + ((llclamp(end_fragment, middle_start, middle_end) - middle_start)) * width_vec; | 1325 | x_max = border_width_left + ((llclamp(end_fragment, middle_start, middle_end) - middle_start)) * width_vec; |
1321 | 1326 | ||
1322 | // draw bottom middle | 1327 | // draw bottom middle |
1323 | glTexCoord2f(border_uv_scale.mV[VX], 0.f); | 1328 | gGL.texCoord2f(border_uv_scale.mV[VX], 0.f); |
1324 | glVertex2fv(x_min.mV); | 1329 | gGL.vertex2fv(x_min.mV); |
1325 | 1330 | ||
1326 | glTexCoord2f(1.f - border_uv_scale.mV[VX], 0.f); | 1331 | gGL.texCoord2f(1.f - border_uv_scale.mV[VX], 0.f); |
1327 | glVertex2fv((x_max).mV); | 1332 | gGL.vertex2fv((x_max).mV); |
1328 | 1333 | ||
1329 | glTexCoord2f(1.f - border_uv_scale.mV[VX], border_uv_scale.mV[VY]); | 1334 | gGL.texCoord2f(1.f - border_uv_scale.mV[VX], border_uv_scale.mV[VY]); |
1330 | glVertex2fv((x_max + border_height_bottom).mV); | 1335 | gGL.vertex2fv((x_max + border_height_bottom).mV); |
1331 | 1336 | ||
1332 | glTexCoord2f(border_uv_scale.mV[VX], border_uv_scale.mV[VY]); | 1337 | gGL.texCoord2f(border_uv_scale.mV[VX], border_uv_scale.mV[VY]); |
1333 | glVertex2fv((x_min + border_height_bottom).mV); | 1338 | gGL.vertex2fv((x_min + border_height_bottom).mV); |
1334 | 1339 | ||
1335 | // draw middle | 1340 | // draw middle |
1336 | glTexCoord2f(border_uv_scale.mV[VX], border_uv_scale.mV[VY]); | 1341 | gGL.texCoord2f(border_uv_scale.mV[VX], border_uv_scale.mV[VY]); |
1337 | glVertex2fv((x_min + border_height_bottom).mV); | 1342 | gGL.vertex2fv((x_min + border_height_bottom).mV); |
1338 | 1343 | ||
1339 | glTexCoord2f(1.f - border_uv_scale.mV[VX], border_uv_scale.mV[VY]); | 1344 | gGL.texCoord2f(1.f - border_uv_scale.mV[VX], border_uv_scale.mV[VY]); |
1340 | glVertex2fv((x_max + border_height_bottom).mV); | 1345 | gGL.vertex2fv((x_max + border_height_bottom).mV); |
1341 | 1346 | ||
1342 | glTexCoord2f(1.f - border_uv_scale.mV[VX], 1.f - border_uv_scale.mV[VY]); | 1347 | gGL.texCoord2f(1.f - border_uv_scale.mV[VX], 1.f - border_uv_scale.mV[VY]); |
1343 | glVertex2fv((x_max + height_vec - border_height_top).mV); | 1348 | gGL.vertex2fv((x_max + height_vec - border_height_top).mV); |
1344 | 1349 | ||
1345 | glTexCoord2f(border_uv_scale.mV[VX], 1.f - border_uv_scale.mV[VY]); | 1350 | gGL.texCoord2f(border_uv_scale.mV[VX], 1.f - border_uv_scale.mV[VY]); |
1346 | glVertex2fv((x_min + height_vec - border_height_top).mV); | 1351 | gGL.vertex2fv((x_min + height_vec - border_height_top).mV); |
1347 | 1352 | ||
1348 | // draw top middle | 1353 | // draw top middle |
1349 | glTexCoord2f(border_uv_scale.mV[VX], 1.f - border_uv_scale.mV[VY]); | 1354 | gGL.texCoord2f(border_uv_scale.mV[VX], 1.f - border_uv_scale.mV[VY]); |
1350 | glVertex2fv((x_min + height_vec - border_height_top).mV); | 1355 | gGL.vertex2fv((x_min + height_vec - border_height_top).mV); |
1351 | 1356 | ||
1352 | glTexCoord2f(1.f - border_uv_scale.mV[VX], 1.f - border_uv_scale.mV[VY]); | 1357 | gGL.texCoord2f(1.f - border_uv_scale.mV[VX], 1.f - border_uv_scale.mV[VY]); |
1353 | glVertex2fv((x_max + height_vec - border_height_top).mV); | 1358 | gGL.vertex2fv((x_max + height_vec - border_height_top).mV); |
1354 | 1359 | ||
1355 | glTexCoord2f(1.f - border_uv_scale.mV[VX], 1.f); | 1360 | gGL.texCoord2f(1.f - border_uv_scale.mV[VX], 1.f); |
1356 | glVertex2fv((x_max + height_vec).mV); | 1361 | gGL.vertex2fv((x_max + height_vec).mV); |
1357 | 1362 | ||
1358 | glTexCoord2f(border_uv_scale.mV[VX], 1.f); | 1363 | gGL.texCoord2f(border_uv_scale.mV[VX], 1.f); |
1359 | glVertex2fv((x_min + height_vec).mV); | 1364 | gGL.vertex2fv((x_min + height_vec).mV); |
1360 | } | 1365 | } |
1361 | 1366 | ||
1362 | if (end_fragment > middle_end) | 1367 | if (end_fragment > middle_end) |
@@ -1367,48 +1372,48 @@ void gl_segmented_rect_2d_fragment_tex(const S32 left, | |||
1367 | x_max = width_vec - ((1.f - ((end_fragment - middle_end) / middle_start)) * border_width_right); | 1372 | x_max = width_vec - ((1.f - ((end_fragment - middle_end) / middle_start)) * border_width_right); |
1368 | 1373 | ||
1369 | // draw bottom right | 1374 | // draw bottom right |
1370 | glTexCoord2f(u_min, 0.f); | 1375 | gGL.texCoord2f(u_min, 0.f); |
1371 | glVertex2fv((x_min).mV); | 1376 | gGL.vertex2fv((x_min).mV); |
1372 | 1377 | ||
1373 | glTexCoord2f(u_max, 0.f); | 1378 | gGL.texCoord2f(u_max, 0.f); |
1374 | glVertex2fv(x_max.mV); | 1379 | gGL.vertex2fv(x_max.mV); |
1375 | 1380 | ||
1376 | glTexCoord2f(u_max, border_uv_scale.mV[VY]); | 1381 | gGL.texCoord2f(u_max, border_uv_scale.mV[VY]); |
1377 | glVertex2fv((x_max + border_height_bottom).mV); | 1382 | gGL.vertex2fv((x_max + border_height_bottom).mV); |
1378 | 1383 | ||
1379 | glTexCoord2f(u_min, border_uv_scale.mV[VY]); | 1384 | gGL.texCoord2f(u_min, border_uv_scale.mV[VY]); |
1380 | glVertex2fv((x_min + border_height_bottom).mV); | 1385 | gGL.vertex2fv((x_min + border_height_bottom).mV); |
1381 | 1386 | ||
1382 | // draw right | 1387 | // draw right |
1383 | glTexCoord2f(u_min, border_uv_scale.mV[VY]); | 1388 | gGL.texCoord2f(u_min, border_uv_scale.mV[VY]); |
1384 | glVertex2fv((x_min + border_height_bottom).mV); | 1389 | gGL.vertex2fv((x_min + border_height_bottom).mV); |
1385 | 1390 | ||
1386 | glTexCoord2f(u_max, border_uv_scale.mV[VY]); | 1391 | gGL.texCoord2f(u_max, border_uv_scale.mV[VY]); |
1387 | glVertex2fv((x_max + border_height_bottom).mV); | 1392 | gGL.vertex2fv((x_max + border_height_bottom).mV); |
1388 | 1393 | ||
1389 | glTexCoord2f(u_max, 1.f - border_uv_scale.mV[VY]); | 1394 | gGL.texCoord2f(u_max, 1.f - border_uv_scale.mV[VY]); |
1390 | glVertex2fv((x_max + height_vec - border_height_top).mV); | 1395 | gGL.vertex2fv((x_max + height_vec - border_height_top).mV); |
1391 | 1396 | ||
1392 | glTexCoord2f(u_min, 1.f - border_uv_scale.mV[VY]); | 1397 | gGL.texCoord2f(u_min, 1.f - border_uv_scale.mV[VY]); |
1393 | glVertex2fv((x_min + height_vec - border_height_top).mV); | 1398 | gGL.vertex2fv((x_min + height_vec - border_height_top).mV); |
1394 | 1399 | ||
1395 | // draw top right | 1400 | // draw top right |
1396 | glTexCoord2f(u_min, 1.f - border_uv_scale.mV[VY]); | 1401 | gGL.texCoord2f(u_min, 1.f - border_uv_scale.mV[VY]); |
1397 | glVertex2fv((x_min + height_vec - border_height_top).mV); | 1402 | gGL.vertex2fv((x_min + height_vec - border_height_top).mV); |
1398 | 1403 | ||
1399 | glTexCoord2f(u_max, 1.f - border_uv_scale.mV[VY]); | 1404 | gGL.texCoord2f(u_max, 1.f - border_uv_scale.mV[VY]); |
1400 | glVertex2fv((x_max + height_vec - border_height_top).mV); | 1405 | gGL.vertex2fv((x_max + height_vec - border_height_top).mV); |
1401 | 1406 | ||
1402 | glTexCoord2f(u_max, 1.f); | 1407 | gGL.texCoord2f(u_max, 1.f); |
1403 | glVertex2fv((x_max + height_vec).mV); | 1408 | gGL.vertex2fv((x_max + height_vec).mV); |
1404 | 1409 | ||
1405 | glTexCoord2f(u_min, 1.f); | 1410 | gGL.texCoord2f(u_min, 1.f); |
1406 | glVertex2fv((x_min + height_vec).mV); | 1411 | gGL.vertex2fv((x_min + height_vec).mV); |
1407 | } | 1412 | } |
1408 | } | 1413 | } |
1409 | glEnd(); | 1414 | gGL.end(); |
1410 | 1415 | ||
1411 | glPopMatrix(); | 1416 | gGL.popMatrix(); |
1412 | } | 1417 | } |
1413 | 1418 | ||
1414 | void gl_segmented_rect_3d_tex(const LLVector2& border_scale, const LLVector3& border_width, | 1419 | void gl_segmented_rect_3d_tex(const LLVector2& border_scale, const LLVector3& border_width, |
@@ -1421,126 +1426,128 @@ void gl_segmented_rect_3d_tex(const LLVector2& border_scale, const LLVector3& bo | |||
1421 | LLVector3 top_border_height = ((edges & (~(U32)ROUNDED_RECT_BOTTOM)) != 0) ? border_height : LLVector3::zero; | 1426 | LLVector3 top_border_height = ((edges & (~(U32)ROUNDED_RECT_BOTTOM)) != 0) ? border_height : LLVector3::zero; |
1422 | LLVector3 bottom_border_height = ((edges & (~(U32)ROUNDED_RECT_TOP)) != 0) ? border_height : LLVector3::zero; | 1427 | LLVector3 bottom_border_height = ((edges & (~(U32)ROUNDED_RECT_TOP)) != 0) ? border_height : LLVector3::zero; |
1423 | 1428 | ||
1424 | glBegin(GL_QUADS); | 1429 | |
1430 | gGL.begin(GL_QUADS); | ||
1425 | { | 1431 | { |
1426 | // draw bottom left | 1432 | // draw bottom left |
1427 | glTexCoord2f(0.f, 0.f); | 1433 | gGL.texCoord2f(0.f, 0.f); |
1428 | glVertex3f(0.f, 0.f, 0.f); | 1434 | gGL.vertex3f(0.f, 0.f, 0.f); |
1429 | 1435 | ||
1430 | glTexCoord2f(border_scale.mV[VX], 0.f); | 1436 | gGL.texCoord2f(border_scale.mV[VX], 0.f); |
1431 | glVertex3fv(left_border_width.mV); | 1437 | gGL.vertex3fv(left_border_width.mV); |
1432 | 1438 | ||
1433 | glTexCoord2f(border_scale.mV[VX], border_scale.mV[VY]); | 1439 | gGL.texCoord2f(border_scale.mV[VX], border_scale.mV[VY]); |
1434 | glVertex3fv((left_border_width + bottom_border_height).mV); | 1440 | gGL.vertex3fv((left_border_width + bottom_border_height).mV); |
1435 | 1441 | ||
1436 | glTexCoord2f(0.f, border_scale.mV[VY]); | 1442 | gGL.texCoord2f(0.f, border_scale.mV[VY]); |
1437 | glVertex3fv(bottom_border_height.mV); | 1443 | gGL.vertex3fv(bottom_border_height.mV); |
1438 | 1444 | ||
1439 | // draw bottom middle | 1445 | // draw bottom middle |
1440 | glTexCoord2f(border_scale.mV[VX], 0.f); | 1446 | gGL.texCoord2f(border_scale.mV[VX], 0.f); |
1441 | glVertex3fv(left_border_width.mV); | 1447 | gGL.vertex3fv(left_border_width.mV); |
1442 | 1448 | ||
1443 | glTexCoord2f(1.f - border_scale.mV[VX], 0.f); | 1449 | gGL.texCoord2f(1.f - border_scale.mV[VX], 0.f); |
1444 | glVertex3fv((width_vec - right_border_width).mV); | 1450 | gGL.vertex3fv((width_vec - right_border_width).mV); |
1445 | 1451 | ||
1446 | glTexCoord2f(1.f - border_scale.mV[VX], border_scale.mV[VY]); | 1452 | gGL.texCoord2f(1.f - border_scale.mV[VX], border_scale.mV[VY]); |
1447 | glVertex3fv((width_vec - right_border_width + bottom_border_height).mV); | 1453 | gGL.vertex3fv((width_vec - right_border_width + bottom_border_height).mV); |
1448 | 1454 | ||
1449 | glTexCoord2f(border_scale.mV[VX], border_scale.mV[VY]); | 1455 | gGL.texCoord2f(border_scale.mV[VX], border_scale.mV[VY]); |
1450 | glVertex3fv((left_border_width + bottom_border_height).mV); | 1456 | gGL.vertex3fv((left_border_width + bottom_border_height).mV); |
1451 | 1457 | ||
1452 | // draw bottom right | 1458 | // draw bottom right |
1453 | glTexCoord2f(1.f - border_scale.mV[VX], 0.f); | 1459 | gGL.texCoord2f(1.f - border_scale.mV[VX], 0.f); |
1454 | glVertex3fv((width_vec - right_border_width).mV); | 1460 | gGL.vertex3fv((width_vec - right_border_width).mV); |
1455 | 1461 | ||
1456 | glTexCoord2f(1.f, 0.f); | 1462 | gGL.texCoord2f(1.f, 0.f); |
1457 | glVertex3fv(width_vec.mV); | 1463 | gGL.vertex3fv(width_vec.mV); |
1458 | 1464 | ||
1459 | glTexCoord2f(1.f, border_scale.mV[VY]); | 1465 | gGL.texCoord2f(1.f, border_scale.mV[VY]); |
1460 | glVertex3fv((width_vec + bottom_border_height).mV); | 1466 | gGL.vertex3fv((width_vec + bottom_border_height).mV); |
1461 | 1467 | ||
1462 | glTexCoord2f(1.f - border_scale.mV[VX], border_scale.mV[VY]); | 1468 | gGL.texCoord2f(1.f - border_scale.mV[VX], border_scale.mV[VY]); |
1463 | glVertex3fv((width_vec - right_border_width + bottom_border_height).mV); | 1469 | gGL.vertex3fv((width_vec - right_border_width + bottom_border_height).mV); |
1464 | 1470 | ||
1465 | // draw left | 1471 | // draw left |
1466 | glTexCoord2f(0.f, border_scale.mV[VY]); | 1472 | gGL.texCoord2f(0.f, border_scale.mV[VY]); |
1467 | glVertex3fv(bottom_border_height.mV); | 1473 | gGL.vertex3fv(bottom_border_height.mV); |
1468 | 1474 | ||
1469 | glTexCoord2f(border_scale.mV[VX], border_scale.mV[VY]); | 1475 | gGL.texCoord2f(border_scale.mV[VX], border_scale.mV[VY]); |
1470 | glVertex3fv((left_border_width + bottom_border_height).mV); | 1476 | gGL.vertex3fv((left_border_width + bottom_border_height).mV); |
1471 | 1477 | ||
1472 | glTexCoord2f(border_scale.mV[VX], 1.f - border_scale.mV[VY]); | 1478 | gGL.texCoord2f(border_scale.mV[VX], 1.f - border_scale.mV[VY]); |
1473 | glVertex3fv((left_border_width + height_vec - top_border_height).mV); | 1479 | gGL.vertex3fv((left_border_width + height_vec - top_border_height).mV); |
1474 | 1480 | ||
1475 | glTexCoord2f(0.f, 1.f - border_scale.mV[VY]); | 1481 | gGL.texCoord2f(0.f, 1.f - border_scale.mV[VY]); |
1476 | glVertex3fv((height_vec - top_border_height).mV); | 1482 | gGL.vertex3fv((height_vec - top_border_height).mV); |
1477 | 1483 | ||
1478 | // draw middle | 1484 | // draw middle |
1479 | glTexCoord2f(border_scale.mV[VX], border_scale.mV[VY]); | 1485 | gGL.texCoord2f(border_scale.mV[VX], border_scale.mV[VY]); |
1480 | glVertex3fv((left_border_width + bottom_border_height).mV); | 1486 | gGL.vertex3fv((left_border_width + bottom_border_height).mV); |
1481 | 1487 | ||
1482 | glTexCoord2f(1.f - border_scale.mV[VX], border_scale.mV[VY]); | 1488 | gGL.texCoord2f(1.f - border_scale.mV[VX], border_scale.mV[VY]); |
1483 | glVertex3fv((width_vec - right_border_width + bottom_border_height).mV); | 1489 | gGL.vertex3fv((width_vec - right_border_width + bottom_border_height).mV); |
1484 | 1490 | ||
1485 | glTexCoord2f(1.f - border_scale.mV[VX], 1.f - border_scale.mV[VY]); | 1491 | gGL.texCoord2f(1.f - border_scale.mV[VX], 1.f - border_scale.mV[VY]); |
1486 | glVertex3fv((width_vec - right_border_width + height_vec - top_border_height).mV); | 1492 | gGL.vertex3fv((width_vec - right_border_width + height_vec - top_border_height).mV); |
1487 | 1493 | ||
1488 | glTexCoord2f(border_scale.mV[VX], 1.f - border_scale.mV[VY]); | 1494 | gGL.texCoord2f(border_scale.mV[VX], 1.f - border_scale.mV[VY]); |
1489 | glVertex3fv((left_border_width + height_vec - top_border_height).mV); | 1495 | gGL.vertex3fv((left_border_width + height_vec - top_border_height).mV); |
1490 | 1496 | ||
1491 | // draw right | 1497 | // draw right |
1492 | glTexCoord2f(1.f - border_scale.mV[VX], border_scale.mV[VY]); | 1498 | gGL.texCoord2f(1.f - border_scale.mV[VX], border_scale.mV[VY]); |
1493 | glVertex3fv((width_vec - right_border_width + bottom_border_height).mV); | 1499 | gGL.vertex3fv((width_vec - right_border_width + bottom_border_height).mV); |
1494 | 1500 | ||
1495 | glTexCoord2f(1.f, border_scale.mV[VY]); | 1501 | gGL.texCoord2f(1.f, border_scale.mV[VY]); |
1496 | glVertex3fv((width_vec + bottom_border_height).mV); | 1502 | gGL.vertex3fv((width_vec + bottom_border_height).mV); |
1497 | 1503 | ||
1498 | glTexCoord2f(1.f, 1.f - border_scale.mV[VY]); | 1504 | gGL.texCoord2f(1.f, 1.f - border_scale.mV[VY]); |
1499 | glVertex3fv((width_vec + height_vec - top_border_height).mV); | 1505 | gGL.vertex3fv((width_vec + height_vec - top_border_height).mV); |
1500 | 1506 | ||
1501 | glTexCoord2f(1.f - border_scale.mV[VX], 1.f - border_scale.mV[VY]); | 1507 | gGL.texCoord2f(1.f - border_scale.mV[VX], 1.f - border_scale.mV[VY]); |
1502 | glVertex3fv((width_vec - right_border_width + height_vec - top_border_height).mV); | 1508 | gGL.vertex3fv((width_vec - right_border_width + height_vec - top_border_height).mV); |
1503 | 1509 | ||
1504 | // draw top left | 1510 | // draw top left |
1505 | glTexCoord2f(0.f, 1.f - border_scale.mV[VY]); | 1511 | gGL.texCoord2f(0.f, 1.f - border_scale.mV[VY]); |
1506 | glVertex3fv((height_vec - top_border_height).mV); | 1512 | gGL.vertex3fv((height_vec - top_border_height).mV); |
1507 | 1513 | ||
1508 | glTexCoord2f(border_scale.mV[VX], 1.f - border_scale.mV[VY]); | 1514 | gGL.texCoord2f(border_scale.mV[VX], 1.f - border_scale.mV[VY]); |
1509 | glVertex3fv((left_border_width + height_vec - top_border_height).mV); | 1515 | gGL.vertex3fv((left_border_width + height_vec - top_border_height).mV); |
1510 | 1516 | ||
1511 | glTexCoord2f(border_scale.mV[VX], 1.f); | 1517 | gGL.texCoord2f(border_scale.mV[VX], 1.f); |
1512 | glVertex3fv((left_border_width + height_vec).mV); | 1518 | gGL.vertex3fv((left_border_width + height_vec).mV); |
1513 | 1519 | ||
1514 | glTexCoord2f(0.f, 1.f); | 1520 | gGL.texCoord2f(0.f, 1.f); |
1515 | glVertex3fv((height_vec).mV); | 1521 | gGL.vertex3fv((height_vec).mV); |
1516 | 1522 | ||
1517 | // draw top middle | 1523 | // draw top middle |
1518 | glTexCoord2f(border_scale.mV[VX], 1.f - border_scale.mV[VY]); | 1524 | gGL.texCoord2f(border_scale.mV[VX], 1.f - border_scale.mV[VY]); |
1519 | glVertex3fv((left_border_width + height_vec - top_border_height).mV); | 1525 | gGL.vertex3fv((left_border_width + height_vec - top_border_height).mV); |
1520 | 1526 | ||
1521 | glTexCoord2f(1.f - border_scale.mV[VX], 1.f - border_scale.mV[VY]); | 1527 | gGL.texCoord2f(1.f - border_scale.mV[VX], 1.f - border_scale.mV[VY]); |
1522 | glVertex3fv((width_vec - right_border_width + height_vec - top_border_height).mV); | 1528 | gGL.vertex3fv((width_vec - right_border_width + height_vec - top_border_height).mV); |
1523 | 1529 | ||
1524 | glTexCoord2f(1.f - border_scale.mV[VX], 1.f); | 1530 | gGL.texCoord2f(1.f - border_scale.mV[VX], 1.f); |
1525 | glVertex3fv((width_vec - right_border_width + height_vec).mV); | 1531 | gGL.vertex3fv((width_vec - right_border_width + height_vec).mV); |
1526 | 1532 | ||
1527 | glTexCoord2f(border_scale.mV[VX], 1.f); | 1533 | gGL.texCoord2f(border_scale.mV[VX], 1.f); |
1528 | glVertex3fv((left_border_width + height_vec).mV); | 1534 | gGL.vertex3fv((left_border_width + height_vec).mV); |
1529 | 1535 | ||
1530 | // draw top right | 1536 | // draw top right |
1531 | glTexCoord2f(1.f - border_scale.mV[VX], 1.f - border_scale.mV[VY]); | 1537 | gGL.texCoord2f(1.f - border_scale.mV[VX], 1.f - border_scale.mV[VY]); |
1532 | glVertex3fv((width_vec - right_border_width + height_vec - top_border_height).mV); | 1538 | gGL.vertex3fv((width_vec - right_border_width + height_vec - top_border_height).mV); |
1533 | 1539 | ||
1534 | glTexCoord2f(1.f, 1.f - border_scale.mV[VY]); | 1540 | gGL.texCoord2f(1.f, 1.f - border_scale.mV[VY]); |
1535 | glVertex3fv((width_vec + height_vec - top_border_height).mV); | 1541 | gGL.vertex3fv((width_vec + height_vec - top_border_height).mV); |
1536 | 1542 | ||
1537 | glTexCoord2f(1.f, 1.f); | 1543 | gGL.texCoord2f(1.f, 1.f); |
1538 | glVertex3fv((width_vec + height_vec).mV); | 1544 | gGL.vertex3fv((width_vec + height_vec).mV); |
1539 | 1545 | ||
1540 | glTexCoord2f(1.f - border_scale.mV[VX], 1.f); | 1546 | gGL.texCoord2f(1.f - border_scale.mV[VX], 1.f); |
1541 | glVertex3fv((width_vec - right_border_width + height_vec).mV); | 1547 | gGL.vertex3fv((width_vec - right_border_width + height_vec).mV); |
1542 | } | 1548 | } |
1543 | glEnd(); | 1549 | gGL.end(); |
1550 | |||
1544 | } | 1551 | } |
1545 | 1552 | ||
1546 | void gl_segmented_rect_3d_tex_top(const LLVector2& border_scale, const LLVector3& border_width, const LLVector3& border_height, const LLVector3& width_vec, const LLVector3& height_vec) | 1553 | void gl_segmented_rect_3d_tex_top(const LLVector2& border_scale, const LLVector3& border_width, const LLVector3& border_height, const LLVector3& width_vec, const LLVector3& height_vec) |
@@ -1588,7 +1595,7 @@ void LLUI::cleanupClass() | |||
1588 | //static | 1595 | //static |
1589 | void LLUI::translate(F32 x, F32 y, F32 z) | 1596 | void LLUI::translate(F32 x, F32 y, F32 z) |
1590 | { | 1597 | { |
1591 | glTranslatef(x,y,z); | 1598 | gGL.translatef(x,y,z); |
1592 | LLFontGL::sCurOrigin.mX += (S32) x; | 1599 | LLFontGL::sCurOrigin.mX += (S32) x; |
1593 | LLFontGL::sCurOrigin.mY += (S32) y; | 1600 | LLFontGL::sCurOrigin.mY += (S32) y; |
1594 | LLFontGL::sCurOrigin.mZ += z; | 1601 | LLFontGL::sCurOrigin.mZ += z; |
@@ -1597,14 +1604,14 @@ void LLUI::translate(F32 x, F32 y, F32 z) | |||
1597 | //static | 1604 | //static |
1598 | void LLUI::pushMatrix() | 1605 | void LLUI::pushMatrix() |
1599 | { | 1606 | { |
1600 | glPushMatrix(); | 1607 | gGL.pushMatrix(); |
1601 | LLFontGL::sOriginStack.push_back(LLFontGL::sCurOrigin); | 1608 | LLFontGL::sOriginStack.push_back(LLFontGL::sCurOrigin); |
1602 | } | 1609 | } |
1603 | 1610 | ||
1604 | //static | 1611 | //static |
1605 | void LLUI::popMatrix() | 1612 | void LLUI::popMatrix() |
1606 | { | 1613 | { |
1607 | glPopMatrix(); | 1614 | gGL.popMatrix(); |
1608 | LLFontGL::sCurOrigin = *LLFontGL::sOriginStack.rbegin(); | 1615 | LLFontGL::sCurOrigin = *LLFontGL::sOriginStack.rbegin(); |
1609 | LLFontGL::sOriginStack.pop_back(); | 1616 | LLFontGL::sOriginStack.pop_back(); |
1610 | } | 1617 | } |
@@ -1627,6 +1634,7 @@ void LLUI::setScaleFactor(const LLVector2 &scale_factor) | |||
1627 | //static | 1634 | //static |
1628 | void LLUI::setLineWidth(F32 width) | 1635 | void LLUI::setLineWidth(F32 width) |
1629 | { | 1636 | { |
1637 | gGL.flush(); | ||
1630 | glLineWidth(width * lerp(sGLScaleFactor.mV[VX], sGLScaleFactor.mV[VY], 0.5f)); | 1638 | glLineWidth(width * lerp(sGLScaleFactor.mV[VX], sGLScaleFactor.mV[VY], 0.5f)); |
1631 | } | 1639 | } |
1632 | 1640 | ||
@@ -1644,7 +1652,7 @@ void LLUI::setCursorPositionScreen(S32 x, S32 y) | |||
1644 | } | 1652 | } |
1645 | 1653 | ||
1646 | //static | 1654 | //static |
1647 | void LLUI::setCursorPositionLocal(LLView* viewp, S32 x, S32 y) | 1655 | void LLUI::setCursorPositionLocal(const LLView* viewp, S32 x, S32 y) |
1648 | { | 1656 | { |
1649 | S32 screen_x, screen_y; | 1657 | S32 screen_x, screen_y; |
1650 | viewp->localPointToScreen(x, y, &screen_x, &screen_y); | 1658 | viewp->localPointToScreen(x, y, &screen_x, &screen_y); |
@@ -1847,12 +1855,12 @@ void LLUIImage::setScaleRegion(const LLRectf& region) | |||
1847 | } | 1855 | } |
1848 | 1856 | ||
1849 | //TODO: move drawing implementation inside class | 1857 | //TODO: move drawing implementation inside class |
1850 | void LLUIImage::draw(S32 x, S32 y, const LLColor4& color) | 1858 | void LLUIImage::draw(S32 x, S32 y, const LLColor4& color) const |
1851 | { | 1859 | { |
1852 | gl_draw_image(x, y, mImage, color, mClipRegion); | 1860 | gl_draw_image(x, y, mImage, color, mClipRegion); |
1853 | } | 1861 | } |
1854 | 1862 | ||
1855 | void LLUIImage::draw(S32 x, S32 y, S32 width, S32 height, const LLColor4& color) | 1863 | void LLUIImage::draw(S32 x, S32 y, S32 width, S32 height, const LLColor4& color) const |
1856 | { | 1864 | { |
1857 | if (mUniformScaling) | 1865 | if (mUniformScaling) |
1858 | { | 1866 | { |
@@ -1871,7 +1879,7 @@ void LLUIImage::draw(S32 x, S32 y, S32 width, S32 height, const LLColor4& color) | |||
1871 | } | 1879 | } |
1872 | } | 1880 | } |
1873 | 1881 | ||
1874 | void LLUIImage::drawSolid(S32 x, S32 y, S32 width, S32 height, const LLColor4& color) | 1882 | void LLUIImage::drawSolid(S32 x, S32 y, S32 width, S32 height, const LLColor4& color) const |
1875 | { | 1883 | { |
1876 | gl_draw_scaled_image_with_border( | 1884 | gl_draw_scaled_image_with_border( |
1877 | x, y, | 1885 | x, y, |
@@ -1883,7 +1891,7 @@ void LLUIImage::drawSolid(S32 x, S32 y, S32 width, S32 height, const LLColor4& c | |||
1883 | mScaleRegion); | 1891 | mScaleRegion); |
1884 | } | 1892 | } |
1885 | 1893 | ||
1886 | void LLUIImage::drawSolid(S32 x, S32 y, const LLColor4& color) | 1894 | void LLUIImage::drawSolid(S32 x, S32 y, const LLColor4& color) const |
1887 | { | 1895 | { |
1888 | gl_draw_scaled_image_with_border( | 1896 | gl_draw_scaled_image_with_border( |
1889 | x, y, | 1897 | x, y, |
@@ -1895,12 +1903,12 @@ void LLUIImage::drawSolid(S32 x, S32 y, const LLColor4& color) | |||
1895 | mScaleRegion); | 1903 | mScaleRegion); |
1896 | } | 1904 | } |
1897 | 1905 | ||
1898 | S32 LLUIImage::getWidth() | 1906 | S32 LLUIImage::getWidth() const |
1899 | { | 1907 | { |
1900 | return mImage->getWidth(0); | 1908 | return mImage->getWidth(0); |
1901 | } | 1909 | } |
1902 | 1910 | ||
1903 | S32 LLUIImage::getHeight() | 1911 | S32 LLUIImage::getHeight() const |
1904 | { | 1912 | { |
1905 | return mImage->getHeight(0); | 1913 | return mImage->getHeight(0); |
1906 | } | 1914 | } |