@@ -531,13 +531,21 @@ void Tess_AddCubeWithNormals( const vec3_t position, const vec3_t minSize, const
531
531
void Tess_InstantScreenSpaceQuad () {
532
532
GLIMP_LOGCOMMENT ( " --- Tess_InstantScreenSpaceQuad ---" );
533
533
534
- tr.skipVBO = true ;
535
-
536
- Tess_Begin ( Tess_StageIteratorDummy, nullptr , true , -1 , 0 );
537
- rb_surfaceTable[Util::ordinal ( *( tr.genericTriangle ->surface ) )]( tr.genericTriangle ->surface );
538
- Tess_DrawElements ();
539
-
540
- tr.skipVBO = false ;
534
+ if ( glConfig2.gpuShader4Available )
535
+ {
536
+ tr.skipVBO = true ;
537
+ Tess_Begin ( Tess_StageIteratorDummy, nullptr , true , -1 , 0 );
538
+ rb_surfaceTable[Util::ordinal ( *( tr.genericTriangle ->surface ) )]( tr.genericTriangle ->surface );
539
+ Tess_DrawElements ();
540
+ tr.skipVBO = false ;
541
+ }
542
+ else
543
+ {
544
+ Tess_Begin ( Tess_StageIteratorDummy, nullptr , true , -1 , 0 );
545
+ rb_surfaceTable[Util::ordinal ( *( tr.genericQuad ->surface ) )]( tr.genericQuad ->surface );
546
+ GL_VertexAttribsState ( ATTR_POSITION );
547
+ Tess_DrawElements ();
548
+ }
541
549
542
550
GL_CheckErrors ();
543
551
@@ -550,12 +558,15 @@ void Tess_InstantQuad( u_ModelViewProjectionMatrix &shader, const float x, const
550
558
551
559
Tess_Begin ( Tess_StageIteratorDummy, nullptr , true , -1 , 0 );
552
560
561
+ /* These values make possible to use either the legacy quad rendering
562
+ or the triangle one when the related GLSL code is supported.
563
+ See: https://github.com/DaemonEngine/Daemon/pull/1739 */
553
564
matrix_t modelViewMatrix;
554
565
MatrixCopy ( matrixIdentity, modelViewMatrix );
555
- modelViewMatrix[12 ] = x;
556
- modelViewMatrix[13 ] = y;
557
- modelViewMatrix[0 ] = width;
558
- modelViewMatrix[5 ] = height;
566
+ modelViewMatrix[12 ] = 0 . 5f * width + x;
567
+ modelViewMatrix[13 ] = 0 . 5f * height + y;
568
+ modelViewMatrix[0 ] = 0 . 5f * width;
569
+ modelViewMatrix[5 ] = 0 . 5f * height;
559
570
GL_LoadModelViewMatrix ( modelViewMatrix );
560
571
shader.SetUniform_ModelViewProjectionMatrix (
561
572
glState.modelViewProjectionMatrix [ glState.stackIndex ] );
0 commit comments