98
104
if (backgroundTextures.empty ())
100
data.reset (new GLfloat [nBox * 8]);
106
streamingBuffer->begin (GL_TRIANGLES);
111
vertexData[0] = pBox->x1;
112
vertexData[1] = pBox->y1;
113
vertexData[2] = 0.0f;
114
vertexData[3] = pBox->x1;
115
vertexData[4] = pBox->y2;
116
vertexData[5] = 0.0f;
117
vertexData[6] = pBox->x2;
118
vertexData[7] = pBox->y1;
119
vertexData[8] = 0.0f;
120
vertexData[9] = pBox->x1;
121
vertexData[10] = pBox->y2;
122
vertexData[11] = 0.0f;
123
vertexData[12] = pBox->x2;
124
vertexData[13] = pBox->y2;
125
vertexData[14] = 0.0f;
127
vertexData[15] = pBox->x2;
128
vertexData[16] = pBox->y1;
129
vertexData[17] = 0.0f;
131
streamingBuffer->addVertices (6, vertexData);
122
glDisableClientState (GL_TEXTURE_COORD_ARRAY);
124
glVertexPointer (2, GL_FLOAT, sizeof (GLfloat) * 2, &data[0]);
126
glColor4us (0, 0, 0, std::numeric_limits<unsigned short>::max ());
127
glDrawArrays (GL_QUADS, 0, nBox * 4);
128
glColor4usv (defaultColor);
130
glEnableClientState (GL_TEXTURE_COORD_ARRAY);
136
colorData[0] = colorData[1] = colorData[2] = 0;
137
colorData[3] = std::numeric_limits <unsigned short>::max ();
138
streamingBuffer->addColors (1, colorData);
140
streamingBuffer->end ();
141
streamingBuffer->render (transform);
134
data.reset (new GLfloat [nBox * 16]);
139
147
for (unsigned int i = 0; i < backgroundTextures.size (); i++)
149
GLfloat textureData[12];
141
150
GLTexture *bg = backgroundTextures[i];
142
151
CompRegion r = region & *bg;
144
153
pBox = const_cast <Region> (r.handle ())->rects;
145
154
nBox = const_cast <Region> (r.handle ())->numRects;
157
streamingBuffer->begin (GL_TRIANGLES);
151
*d++ = COMP_TEX_COORD_X (bg->matrix (), pBox->x1);
152
*d++ = COMP_TEX_COORD_Y (bg->matrix (), pBox->y2);
157
*d++ = COMP_TEX_COORD_X (bg->matrix (), pBox->x2);
158
*d++ = COMP_TEX_COORD_Y (bg->matrix (), pBox->y2);
163
*d++ = COMP_TEX_COORD_X (bg->matrix (), pBox->x2);
164
*d++ = COMP_TEX_COORD_Y (bg->matrix (), pBox->y1);
169
*d++ = COMP_TEX_COORD_X (bg->matrix (), pBox->x1);
170
*d++ = COMP_TEX_COORD_Y (bg->matrix (), pBox->y1);
161
GLfloat tx1 = COMP_TEX_COORD_X (bg->matrix (), pBox->x1);
162
GLfloat tx2 = COMP_TEX_COORD_X (bg->matrix (), pBox->x2);
163
GLfloat ty1 = COMP_TEX_COORD_Y (bg->matrix (), pBox->y1);
164
GLfloat ty2 = COMP_TEX_COORD_Y (bg->matrix (), pBox->y2);
166
vertexData[0] = pBox->x1;
167
vertexData[1] = pBox->y1;
168
vertexData[2] = 0.0f;
169
vertexData[3] = pBox->x1;
170
vertexData[4] = pBox->y2;
171
vertexData[5] = 0.0f;
172
vertexData[6] = pBox->x2;
173
vertexData[7] = pBox->y1;
174
vertexData[8] = 0.0f;
175
vertexData[9] = pBox->x1;
176
vertexData[10] = pBox->y2;
177
vertexData[11] = 0.0f;
178
vertexData[12] = pBox->x2;
179
vertexData[13] = pBox->y2;
180
vertexData[14] = 0.0f;
182
vertexData[15] = pBox->x2;
183
vertexData[16] = pBox->y1;
184
vertexData[17] = 0.0f;
186
textureData[0] = tx1;
187
textureData[1] = ty1;
189
textureData[2] = tx1;
190
textureData[3] = ty2;
192
textureData[4] = tx2;
193
textureData[5] = ty1;
195
textureData[6] = tx1;
196
textureData[7] = ty2;
198
textureData[8] = tx2;
199
textureData[9] = ty2;
201
textureData[10] = tx2;
202
textureData[11] = ty1;
204
streamingBuffer->addVertices (6, vertexData);
205
streamingBuffer->addTexCoords (0, 6, textureData);
178
glTexCoordPointer (2, GL_FLOAT, sizeof (GLfloat) * 4, &data[0]);
179
glVertexPointer (2, GL_FLOAT, sizeof (GLfloat) * 4, &data[2]);
210
streamingBuffer->end ();
378
432
WRAPABLE_HND_FUNCTN (glEnableOutputClipping, transform, region, output)
380
GLdouble h = screen->height ();
382
GLdouble p1[2] = { static_cast<GLdouble> (region.handle ()->extents.x1),
383
static_cast<GLdouble> (h - region.handle ()->extents.y2) };
384
GLdouble p2[2] = { static_cast<GLdouble> (region.handle ()->extents.x2),
385
static_cast<GLdouble> (h - region.handle ()->extents.y1) };
387
GLdouble halfW = output->width () / 2.0;
388
GLdouble halfH = output->height () / 2.0;
390
GLdouble cx = output->x1 () + halfW;
391
GLdouble cy = (h - output->y2 ()) + halfH;
393
GLdouble top[4] = { 0.0, halfH / (cy - p1[1]), 0.0, 0.5 };
394
GLdouble bottom[4] = { 0.0, halfH / (cy - p2[1]), 0.0, 0.5 };
395
GLdouble left[4] = { halfW / (cx - p1[0]), 0.0, 0.0, 0.5 };
396
GLdouble right[4] = { halfW / (cx - p2[0]), 0.0, 0.0, 0.5 };
399
glLoadMatrixf (transform.getMatrix ());
401
glClipPlane (GL_CLIP_PLANE0, top);
402
glClipPlane (GL_CLIP_PLANE1, bottom);
403
glClipPlane (GL_CLIP_PLANE2, left);
404
glClipPlane (GL_CLIP_PLANE3, right);
406
glEnable (GL_CLIP_PLANE0);
407
glEnable (GL_CLIP_PLANE1);
408
glEnable (GL_CLIP_PLANE2);
409
glEnable (GL_CLIP_PLANE3);
434
// Bottom-left corner of the output:
435
const GLint x = output->x1 ();
436
const GLint y = screen->height () - output->y2 ();
437
const GLsizei w = output->width ();
438
const GLsizei h = output->height ();
440
// Transformed (only scale and translation is supported!)
441
const float *t = transform.getMatrix ();
442
const GLfloat scalex = t[0], scaley = t[5], transx = t[12], transy = t[13];
443
const GLfloat centrex = x + w / 2.0f;
444
const GLfloat centrey = y + h / 2.0f;
445
GLfloat scaledw = fabs (w * scalex);
446
GLfloat scaledh = fabs (h * scaley);
447
GLfloat tx = centrex - (scaledw / 2.0f) + transx * w;
448
GLfloat ty = centrey - (scaledh / 2.0f) + transy * h;
450
glScissor (tx, ty, roundf (scaledw), roundf (scaledh));
451
glEnable (GL_SCISSOR_TEST);
447
514
if ((mask & CLIP_PLANE_MASK) == CLIP_PLANE_MASK)
449
glEnableOutputClipping (sTransform, region, output);
451
sTransform.toScreenSpace (output, -sAttrib.zTranslate);
454
glLoadMatrixf (sTransform.getMatrix ());
456
priv->paintOutputRegion (sTransform, region, output, mask);
460
glDisableOutputClipping ();
516
if (transformIsSimple (sTransform))
518
glEnableOutputClipping (sTransform, region, output);
519
sTransform.toScreenSpace (output, -sAttrib.zTranslate);
520
priv->paintOutputRegion (sTransform, region, output, mask);
521
glDisableOutputClipping ();
523
else if ( (GL::fboEnabled && GL::fboStencilSupported) ||
526
sTransform.toScreenSpace (output, -sAttrib.zTranslate);
529
glClear (GL_STENCIL_BUFFER_BIT);
530
glEnable (GL_STENCIL_TEST);
531
glStencilFunc (GL_ALWAYS, 1, 1);
532
glStencilOp (GL_KEEP, GL_KEEP, GL_REPLACE);
535
vb.setAutoProgram (priv->autoProgram);
536
glBufferStencil (sTransform, vb, output);
537
glColorMask (GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
539
vb.render (sTransform);
540
glColorMask (GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
542
glStencilFunc (GL_EQUAL, 1, 1);
543
glStencilOp (GL_KEEP, GL_KEEP, GL_KEEP);
544
priv->paintOutputRegion (sTransform, region, output, mask);
545
glDisable (GL_STENCIL_TEST);
549
// This won't look quite right but should never happen.
551
sTransform.toScreenSpace (output, -sAttrib.zTranslate);
552
priv->paintOutputRegion (sTransform, region, output, mask);
464
557
sTransform.toScreenSpace (output, -sAttrib.zTranslate);
467
glLoadMatrixf (sTransform.getMatrix ());
469
558
priv->paintOutputRegion (sTransform, region, output, mask);
528
#define ADD_RECT(data, m, n, x1, y1, x2, y2) \
529
for (it = 0; it < n; it++) \
531
const GLTexture::Matrix &mat = m[it]; \
532
*(data)++ = COMP_TEX_COORD_X (mat, x1); \
533
*(data)++ = COMP_TEX_COORD_Y (mat, y1); \
538
for (it = 0; it < n; it++) \
540
const GLTexture::Matrix &mat = m[it]; \
541
*(data)++ = COMP_TEX_COORD_X (mat, x1); \
542
*(data)++ = COMP_TEX_COORD_Y (mat, y2); \
547
for (it = 0; it < n; it++) \
549
const GLTexture::Matrix &mat = m[it]; \
550
*(data)++ = COMP_TEX_COORD_X (mat, x2); \
551
*(data)++ = COMP_TEX_COORD_Y (mat, y2); \
556
for (it = 0; it < n; it++) \
558
const GLTexture::Matrix &mat = m[it]; \
559
*(data)++ = COMP_TEX_COORD_X (mat, x2); \
560
*(data)++ = COMP_TEX_COORD_Y (mat, y1); \
566
#define ADD_QUAD(data, m, n, x1, y1, x2, y2) \
567
for (it = 0; it < n; it++) \
569
const GLTexture::Matrix &mat = m[it]; \
570
*(data)++ = COMP_TEX_COORD_XY (mat, x1, y1); \
571
*(data)++ = COMP_TEX_COORD_YX (mat, x1, y1); \
576
for (it = 0; it < n; it++) \
578
const GLTexture::Matrix &mat = m[it]; \
579
*(data)++ = COMP_TEX_COORD_XY (mat, x1, y2); \
580
*(data)++ = COMP_TEX_COORD_YX (mat, x1, y2); \
585
for (it = 0; it < n; it++) \
587
const GLTexture::Matrix &mat = m[it]; \
588
*(data)++ = COMP_TEX_COORD_XY (mat, x2, y2); \
589
*(data)++ = COMP_TEX_COORD_YX (mat, x2, y2); \
594
for (it = 0; it < n; it++) \
596
const GLTexture::Matrix &mat = m[it]; \
597
*(data)++ = COMP_TEX_COORD_XY (mat, x2, y1); \
598
*(data)++ = COMP_TEX_COORD_YX (mat, x2, y1); \
605
GLWindow::glDrawGeometry ()
611
GLScreen::glPaintCompositedOutput (const CompRegion ®ion,
612
GLFramebufferObject *fbo,
607
WRAPABLE_HND_FUNCTN (glDrawGeometry)
609
int texUnit = priv->geometry.texUnits;
610
int currentTexUnit = 0;
611
int stride = priv->geometry.vertexStride;
612
GLfloat *vertices = priv->geometry.vertices + (stride - 3);
614
stride *= sizeof (GLfloat);
616
glVertexPointer (3, GL_FLOAT, stride, vertices);
620
if (texUnit != currentTexUnit)
622
(*GL::clientActiveTexture) (GL_TEXTURE0_ARB + texUnit);
623
glEnableClientState (GL_TEXTURE_COORD_ARRAY);
624
currentTexUnit = texUnit;
626
vertices -= priv->geometry.texCoordSize;
627
glTexCoordPointer (priv->geometry.texCoordSize,
628
GL_FLOAT, stride, vertices);
631
glDrawArrays (GL_QUADS, 0, priv->geometry.vCount);
633
/* disable all texture coordinate arrays except 0 */
634
texUnit = priv->geometry.texUnits;
639
(*GL::clientActiveTexture) (GL_TEXTURE0_ARB + texUnit);
640
glDisableClientState (GL_TEXTURE_COORD_ARRAY);
643
(*GL::clientActiveTexture) (GL_TEXTURE0_ARB);
615
WRAPABLE_HND_FUNCTN (glPaintCompositedOutput, region, fbo, mask)
618
std::vector<GLfloat> vertexData;
619
std::vector<GLfloat> textureData;
620
const GLTexture::Matrix & texmatrix = fbo->tex ()->matrix ();
621
GLVertexBuffer *streamingBuffer = GLVertexBuffer::streamingBuffer ();
623
streamingBuffer->begin (GL_TRIANGLES);
625
if (mask & COMPOSITE_SCREEN_DAMAGE_ALL_MASK)
627
GLfloat tx1 = COMP_TEX_COORD_X (texmatrix, 0.0f);
628
GLfloat tx2 = COMP_TEX_COORD_X (texmatrix, screen->width ());
629
GLfloat ty1 = 1.0 - COMP_TEX_COORD_Y (texmatrix, 0.0f);
630
GLfloat ty2 = 1.0 - COMP_TEX_COORD_Y (texmatrix, screen->height ());
634
0.0f, (float)screen->height (), 0.0f,
635
(float)screen->width (), 0.0f, 0.0f,
637
0.0f, (float)screen->height (), 0.0f,
638
(float)screen->width (), (float)screen->height (), 0.0f,
639
(float)screen->width (), 0.0f, 0.0f,
651
streamingBuffer->addVertices (6, &vertexData[0]);
652
streamingBuffer->addTexCoords (0, 6, &textureData[0]);
656
BoxPtr pBox = const_cast <Region> (region.handle ())->rects;
657
int nBox = const_cast <Region> (region.handle ())->numRects;
661
GLfloat tx1 = COMP_TEX_COORD_X (texmatrix, pBox->x1);
662
GLfloat tx2 = COMP_TEX_COORD_X (texmatrix, pBox->x2);
663
GLfloat ty1 = 1.0 - COMP_TEX_COORD_Y (texmatrix, pBox->y1);
664
GLfloat ty2 = 1.0 - COMP_TEX_COORD_Y (texmatrix, pBox->y2);
667
(float)pBox->x1, (float)pBox->y1, 0.0f,
668
(float)pBox->x1, (float)pBox->y2, 0.0f,
669
(float)pBox->x2, (float)pBox->y1, 0.0f,
671
(float)pBox->x1, (float)pBox->y2, 0.0f,
672
(float)pBox->x2, (float)pBox->y2, 0.0f,
673
(float)pBox->x2, (float)pBox->y1, 0.0f,
685
streamingBuffer->addVertices (6, &vertexData[0]);
686
streamingBuffer->addTexCoords (0, 6, &textureData[0]);
691
streamingBuffer->end ();
692
fbo->tex ()->enable (GLTexture::Fast);
693
sTransform.toScreenSpace (&screen->fullscreenOutput (), -DEFAULT_Z_CAMERA);
694
streamingBuffer->render (sTransform);
695
fbo->tex ()->disable ();
648
addSingleQuad (GLfloat *&d,
699
addSingleQuad (GLVertexBuffer *vertexBuffer,
649
700
const GLTexture::MatrixList &matrix,
650
701
unsigned int nMatrix,
708
GLfloat vertexData[18] = {
709
(float)x1, (float)y1, 0.0,
710
(float)x1, (float)y2, 0.0,
711
(float)x2, (float)y1, 0.0,
712
(float)x2, (float)y1, 0.0,
713
(float)x1, (float)y2, 0.0,
714
(float)x2, (float)y2, 0.0
716
vertexBuffer->addVertices (6, vertexData);
662
ADD_RECT (d, matrix, nMatrix, x1, y1, x2, y2);
721
for (it = 0; it < nMatrix; it++)
724
const GLTexture::Matrix &mat = matrix[it];
725
data[0] = COMP_TEX_COORD_X (mat, x1);
726
data[1] = COMP_TEX_COORD_Y (mat, y1);
727
vertexBuffer->addTexCoords (it, 1, data);
729
for (it = 0; it < nMatrix; it++)
732
const GLTexture::Matrix &mat = matrix[it];
733
data[0] = COMP_TEX_COORD_X (mat, x1);
734
data[1] = COMP_TEX_COORD_Y (mat, y2);
735
vertexBuffer->addTexCoords (it, 1, data);
737
for (it = 0; it < nMatrix; it++)
740
const GLTexture::Matrix &mat = matrix[it];
741
data[0] = COMP_TEX_COORD_X (mat, x2);
742
data[1] = COMP_TEX_COORD_Y (mat, y1);
743
vertexBuffer->addTexCoords (it, 1, data);
745
for (it = 0; it < nMatrix; it++)
748
const GLTexture::Matrix &mat = matrix[it];
749
data[0] = COMP_TEX_COORD_X (mat, x2);
750
data[1] = COMP_TEX_COORD_Y (mat, y1);
751
vertexBuffer->addTexCoords (it, 1, data);
753
for (it = 0; it < nMatrix; it++)
756
const GLTexture::Matrix &mat = matrix[it];
757
data[0] = COMP_TEX_COORD_X (mat, x1);
758
data[1] = COMP_TEX_COORD_Y (mat, y2);
759
vertexBuffer->addTexCoords (it, 1, data);
761
for (it = 0; it < nMatrix; it++)
764
const GLTexture::Matrix &mat = matrix[it];
765
data[0] = COMP_TEX_COORD_X (mat, x2);
766
data[1] = COMP_TEX_COORD_Y (mat, y2);
767
vertexBuffer->addTexCoords (it, 1, data);
666
ADD_QUAD (d, matrix, nMatrix, x1, y1, x2, y2);
773
for (it = 0; it < nMatrix; it++)
776
const GLTexture::Matrix &mat = matrix[it];
777
data[0] = COMP_TEX_COORD_XY (mat, x1, y1);
778
data[1] = COMP_TEX_COORD_YX (mat, x1, y1);
779
vertexBuffer->addTexCoords (it, 1, data);
781
for (it = 0; it < nMatrix; it++)
784
const GLTexture::Matrix &mat = matrix[it];
785
data[0] = COMP_TEX_COORD_XY (mat, x1, y2);
786
data[1] = COMP_TEX_COORD_YX (mat, x1, y2);
787
vertexBuffer->addTexCoords (it, 1, data);
789
for (it = 0; it < nMatrix; it++)
792
const GLTexture::Matrix &mat = matrix[it];
793
data[0] = COMP_TEX_COORD_XY (mat, x2, y1);
794
data[1] = COMP_TEX_COORD_YX (mat, x2, y1);
795
vertexBuffer->addTexCoords (it, 1, data);
797
for (it = 0; it < nMatrix; it++)
800
const GLTexture::Matrix &mat = matrix[it];
801
data[0] = COMP_TEX_COORD_XY (mat, x2, y1);
802
data[1] = COMP_TEX_COORD_YX (mat, x2, y1);
803
vertexBuffer->addTexCoords (it, 1, data);
805
for (it = 0; it < nMatrix; it++)
808
const GLTexture::Matrix &mat = matrix[it];
809
data[0] = COMP_TEX_COORD_XY (mat, x1, y2);
810
data[1] = COMP_TEX_COORD_YX (mat, x1, y2);
811
vertexBuffer->addTexCoords (it, 1, data);
813
for (it = 0; it < nMatrix; it++)
816
const GLTexture::Matrix &mat = matrix[it];
817
data[0] = COMP_TEX_COORD_XY (mat, x2, y2);
818
data[1] = COMP_TEX_COORD_YX (mat, x2, y2);
819
vertexBuffer->addTexCoords (it, 1, data);
672
addQuads (GLfloat *&d,
825
addQuads (GLVertexBuffer *vertexBuffer,
673
826
const GLTexture::MatrixList &matrix,
674
827
unsigned int nMatrix,
682
GLWindow::Geometry &geometry,
683
833
unsigned int maxGridWidth,
684
834
unsigned int maxGridHeight)
842
958
if (cbox.x1 < cbox.x2 && cbox.y1 < cbox.y2)
844
addQuads (d, matrix, nMatrix,
960
addQuads (priv->vertexBuffer, matrix, nMatrix,
845
961
cbox.x1, cbox.y1, cbox.x2, cbox.y2,
846
n, vSize, rect, priv->geometry,
847
963
maxGridWidth, maxGridHeight);
854
priv->geometry.vCount = n * 4;
855
priv->geometry.vertexStride = vSize;
856
priv->geometry.texCoordSize = 2;
861
enableFragmentProgramAndDrawGeometry (GLScreen *gs,
864
GLFragment::Attrib &attrib,
865
GLTexture::Filter filter,
868
GLFragment::Attrib fa (attrib);
871
if (GL::canDoSaturated && attrib.getSaturation () != COLOR)
875
param = fa.allocParameters (1);
877
GLFragment::getSaturateFragmentFunction (texture, param);
879
fa.addFunction (function);
881
(*GL::programEnvParameter4f) (GL_FRAGMENT_PROGRAM_ARB, param,
882
RED_SATURATION_WEIGHT,
883
GREEN_SATURATION_WEIGHT,
884
BLUE_SATURATION_WEIGHT,
885
attrib.getSaturation () / 65535.0f);
888
if (!fa.enable (&blending))
891
texture->enable (filter);
893
if (mask & PAINT_WINDOW_BLEND_MASK)
898
if (attrib.getOpacity () != OPAQUE || attrib.getBrightness () != BRIGHT)
902
color = (attrib.getOpacity () * attrib.getBrightness ()) >> 16;
904
gs->setTexEnvMode (GL_MODULATE);
905
glColor4us (color, color, color, attrib.getOpacity ());
907
w->glDrawGeometry ();
909
glColor4usv (defaultColor);
910
gs->setTexEnvMode (GL_REPLACE);
914
w->glDrawGeometry ();
918
glDisable (GL_BLEND);
920
else if (attrib.getBrightness () != BRIGHT)
922
gs->setTexEnvMode (GL_MODULATE);
923
glColor4us (attrib.getBrightness (), attrib.getBrightness (),
924
attrib.getBrightness (), BRIGHT);
926
w->glDrawGeometry ();
928
glColor4usv (defaultColor);
929
gs->setTexEnvMode (GL_REPLACE);
933
w->glDrawGeometry ();
944
enableFragmentOperationsAndDrawGeometry (GLScreen *gs,
947
GLFragment::Attrib &attrib,
948
GLTexture::Filter filter,
974
enableLegacyOBSAndRender (GLScreen *gs,
977
const GLMatrix &transform,
978
const GLWindowPaintAttrib &attrib,
979
GLTexture::Filter filter,
951
if (GL::canDoSaturated && attrib.getSaturation () != COLOR)
982
// XXX: This codepath only works with !GL::vbo so that's the only case
983
// where you'll find it's called. At least for now.
985
if (GL::canDoSaturated && attrib.saturation != COLOR)
953
987
GLfloat constant[4];
955
if (mask & PAINT_WINDOW_BLEND_MASK)
958
989
texture->enable (filter);
960
991
glTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE);
1108
1136
if (mask & PAINT_WINDOW_BLEND_MASK)
1110
glEnable (GL_BLEND);
1111
if (attrib.getOpacity ()!= OPAQUE ||
1112
attrib.getBrightness () != BRIGHT)
1138
if (attrib.opacity != OPAQUE ||
1139
attrib.brightness != BRIGHT)
1114
1141
GLushort color;
1116
color = (attrib.getOpacity () * attrib.getBrightness ()) >> 16;
1143
color = (attrib.opacity * attrib.brightness) >> 16;
1118
1145
gs->setTexEnvMode (GL_MODULATE);
1119
glColor4us (color, color, color, attrib.getOpacity ());
1146
glColor4us (color, color, color, attrib.opacity);
1121
w->glDrawGeometry ();
1148
w->vertexBuffer ()->render (transform, attrib);
1123
1150
glColor4usv (defaultColor);
1124
1151
gs->setTexEnvMode (GL_REPLACE);
1128
w->glDrawGeometry ();
1155
w->vertexBuffer ()->render (transform, attrib);
1131
glDisable (GL_BLEND);
1133
else if (attrib.getBrightness () != BRIGHT)
1158
else if (attrib.brightness != BRIGHT)
1135
1160
gs->setTexEnvMode (GL_MODULATE);
1136
glColor4us (attrib.getBrightness (), attrib.getBrightness (),
1137
attrib.getBrightness (), BRIGHT);
1161
glColor4us (attrib.brightness, attrib.brightness,
1162
attrib.brightness, BRIGHT);
1139
w->glDrawGeometry ();
1164
w->vertexBuffer ()->render (transform, attrib);
1141
1166
glColor4usv (defaultColor);
1142
1167
gs->setTexEnvMode (GL_REPLACE);
1146
w->glDrawGeometry ();
1171
w->vertexBuffer ()->render (transform, attrib);
1149
1174
texture->disable ();
1154
1180
GLWindow::glDrawTexture (GLTexture *texture,
1155
GLFragment::Attrib &attrib,
1181
const GLMatrix &transform,
1182
const GLWindowPaintAttrib &attrib,
1156
1183
unsigned int mask)
1158
WRAPABLE_HND_FUNCTN (glDrawTexture, texture, attrib, mask)
1185
WRAPABLE_HND_FUNCTN (glDrawTexture, texture, transform, attrib, mask)
1160
1187
GLTexture::Filter filter;
1189
if (mask & PAINT_WINDOW_BLEND_MASK)
1190
glEnable (GL_BLEND);
1162
1192
if (mask & (PAINT_WINDOW_TRANSFORMED_MASK |
1163
1193
PAINT_WINDOW_ON_TRANSFORMED_SCREEN_MASK))
1164
1194
filter = priv->gScreen->filter (SCREEN_TRANS_FILTER);
1166
1196
filter = priv->gScreen->filter (NOTHING_TRANS_FILTER);
1168
if ((!attrib.hasFunctions () && (!priv->gScreen->lighting () ||
1169
attrib.getSaturation () == COLOR || attrib.getSaturation () == 0)) ||
1170
!enableFragmentProgramAndDrawGeometry (priv->gScreen, this, texture,
1171
attrib, filter, mask))
1173
enableFragmentOperationsAndDrawGeometry (priv->gScreen, this, texture,
1198
glActiveTexture(GL_TEXTURE0);
1199
texture->enable (filter);
1202
priv->vertexBuffer->render (transform, attrib);
1205
if (!GLVertexBuffer::enabled ())
1206
enableLegacyOBSAndRender (priv->gScreen, this, texture, transform,
1174
1207
attrib, filter, mask);
1209
priv->vertexBuffer->render (transform, attrib);
1212
priv->shaders.clear ();
1213
texture->disable ();
1215
if (mask & PAINT_WINDOW_BLEND_MASK)
1216
glDisable (GL_BLEND);
1179
1220
GLWindow::glDraw (const GLMatrix &transform,
1180
GLFragment::Attrib &fragment,
1221
const GLWindowPaintAttrib &attrib,
1181
1222
const CompRegion ®ion,
1182
1223
unsigned int mask)
1184
1225
WRAPABLE_HND_FUNCTN_RETURN (bool, glDraw, transform,
1185
fragment, region, mask)
1226
attrib, region, mask)
1187
1228
const CompRegion ® = (mask & PAINT_WINDOW_TRANSFORMED_MASK) ?
1188
1229
infiniteRegion : region;