@@ -531,13 +531,21 @@ void Tess_AddCubeWithNormals( const vec3_t position, const vec3_t minSize, const
531531void Tess_InstantScreenSpaceQuad () {
532532 GLIMP_LOGCOMMENT ( " --- Tess_InstantScreenSpaceQuad ---" );
533533
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+ }
541549
542550 GL_CheckErrors ();
543551
@@ -550,12 +558,15 @@ void Tess_InstantQuad( u_ModelViewProjectionMatrix &shader, const float x, const
550558
551559 Tess_Begin ( Tess_StageIteratorDummy, nullptr , true , -1 , 0 );
552560
561+ /* We don't use x, y, width, height directly to make it compatible
562+ with R_InitGenericVBOs() in tr_vbo.cpp.
563+ See: https://github.com/DaemonEngine/Daemon/pull/1739 */
553564 matrix_t modelViewMatrix;
554565 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;
559570 GL_LoadModelViewMatrix ( modelViewMatrix );
560571 shader.SetUniform_ModelViewProjectionMatrix (
561572 glState.modelViewProjectionMatrix [ glState.stackIndex ] );
0 commit comments