DXGL r105 - Code Review

Jump to navigation Jump to search
Repository:DXGL
Revision:r104‎ | r105 | r106 >
Date:01:22, 20 February 2012
Author:admin
Status:new
Tags:
Comment:
Fix ATI compatibility
Modified paths:
  • /ddraw/glRenderer.cpp (modified) (history)

Diff [purge]

Index: ddraw/glRenderer.cpp
@@ -688,7 +688,6 @@
689689 {
690690 glEnable(GL_TEXTURE_2D);
691691 }
692 - if(src) glBindTexture(GL_TEXTURE_2D,src->GetTexture());
693692 if((dwFlags & DDBLT_KEYSRC) && (src && src->colorkey[0].enabled) && !(dwFlags & DDBLT_COLORFILL))
694693 {
695694 SetShader(PROG_CKEY,NULL,true);
@@ -726,6 +725,8 @@
727726 GLint texloc = glGetUniformLocation(shaders[PROG_TEXTURE].prog,"Texture");
728727 glUniform1i(texloc,0);
729728 }
 729+ glActiveTexture(GL_TEXTURE0);
 730+ if(src) glBindTexture(GL_TEXTURE_2D,src->GetTexture());
730731 GLuint prog = GetProgram()&0xffffffff;
731732 GLint viewloc = glGetUniformLocation(prog,"view");
732733 glUniform4f(viewloc,0,(GLfloat)dest->fakex,0,(GLfloat)dest->fakey);
@@ -733,14 +734,11 @@
734735 GLint xyloc = glGetAttribLocation(prog,"xy");
735736 glEnableVertexAttribArray(xyloc);
736737 glVertexAttribPointer(xyloc,2,GL_FLOAT,false,sizeof(BltVertex),&bltvertices[0].x);
737 - if(dwFlags & DDBLT_COLORFILL)
 738+ GLint rgbloc = glGetAttribLocation(prog,"rgb");
 739+ glEnableVertexAttribArray(rgbloc);
 740+ glVertexAttribPointer(rgbloc,3,GL_UNSIGNED_BYTE,true,sizeof(BltVertex),&bltvertices[0].r);
 741+ if(!(dwFlags & DDBLT_COLORFILL))
738742 {
739 - GLint rgbloc = glGetAttribLocation(prog,"rgb");
740 - glEnableVertexAttribArray(rgbloc);
741 - glVertexAttribPointer(rgbloc,3,GL_UNSIGNED_BYTE,true,sizeof(BltVertex),&bltvertices[0].r);
742 - }
743 - else
744 - {
745743 GLint stloc = glGetAttribLocation(prog,"st");
746744 glEnableVertexAttribArray(stloc);
747745 glVertexAttribPointer(stloc,2,GL_FLOAT,false,sizeof(BltVertex),&bltvertices[0].s);
@@ -929,6 +927,9 @@
930928 GLint stloc = glGetAttribLocation(prog,"st");
931929 glEnableVertexAttribArray(stloc);
932930 glVertexAttribPointer(stloc,2,GL_FLOAT,false,sizeof(BltVertex),&bltvertices[0].s);
 931+ GLint rgbloc = glGetAttribLocation(prog,"rgb");
 932+ glEnableVertexAttribArray(rgbloc);
 933+ glVertexAttribPointer(rgbloc,3,GL_UNSIGNED_BYTE,true,sizeof(BltVertex),&bltvertices[0].r);
933934 glDrawRangeElements(GL_TRIANGLE_STRIP,0,3,4,GL_UNSIGNED_SHORT,bltindices);
934935 glDisable(GL_TEXTURE_2D);
935936 glFlush();