Bit of cleanup and fixing of one issue that was noticeable in SMS with Mario's shadow.

This commit is contained in:
Ryan Houdek 2012-10-27 22:50:06 -05:00
parent dfb3c44d1a
commit fb92c338af
5 changed files with 46 additions and 46 deletions

View File

@ -306,10 +306,10 @@ void XFBSource::Draw(const MathUtil::Rectangle<float> &sourcerc,
glBindTexture(GL_TEXTURE_RECTANGLE_ARB, texture);
GLfloat vtx1[] = {
drawrc.left, drawrc.bottom, 1,
drawrc.left, drawrc.top, 1,
drawrc.right, drawrc.top, 1,
drawrc.right, drawrc.bottom, 1
drawrc.left, drawrc.bottom,
drawrc.left, drawrc.top,
drawrc.right, drawrc.top,
drawrc.right, drawrc.bottom,
};
GLfloat tex1[] = { // For TEXTURE0
sourcerc.left, sourcerc.bottom,
@ -319,17 +319,17 @@ void XFBSource::Draw(const MathUtil::Rectangle<float> &sourcerc,
};
glClientActiveTexture(GL_TEXTURE0);
glMultiTexCoord2f(GL_TEXTURE1, 0, 0);
glMultiTexCoord2f(GL_TEXTURE1, 0, 1);
glMultiTexCoord2f(GL_TEXTURE1, 1, 1);
glMultiTexCoord2f(GL_TEXTURE1, 1, 0);
glVertexPointer(2, GL_FLOAT, 0, vtx1);
glTexCoordPointer(2, GL_FLOAT, 0, tex1);
// Is this correct?
glMultiTexCoord2fARB(GL_TEXTURE1, 0, 0);
glMultiTexCoord2fARB(GL_TEXTURE1, 0, 1);
glMultiTexCoord2fARB(GL_TEXTURE1, 1, 1);
glMultiTexCoord2fARB(GL_TEXTURE1, 1, 0);
glVertexPointer(3, GL_FLOAT, 0, vtx1);
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
GL_REPORT_ERRORD();
}

View File

@ -274,10 +274,6 @@ void GLVertexFormat::EnableComponents(u32 components)
if ((components & (VB_HAS_UV0 << i)) != (s_prevcomponents & (VB_HAS_UV0 << i)))
{
glClientActiveTexture(GL_TEXTURE0 + i);
if (components & (VB_HAS_UV0 << i))
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
else
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
}
}

View File

@ -474,6 +474,7 @@ Renderer::Renderer()
glBlendColorEXT(0, 0, 0, 0.5f);
glClearDepth(1.0f);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
// legacy multitexturing: select texture channel only.
glActiveTexture(GL_TEXTURE0);
glClientActiveTexture(GL_TEXTURE0);
@ -1154,18 +1155,19 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight,cons
};
glClientActiveTexture(GL_TEXTURE0);
glTexCoordPointer(2, GL_FLOAT, 0, tex1);
if (applyShader)
{
glMultiTexCoord2fARB(GL_TEXTURE1, 0, 0);
glMultiTexCoord2fARB(GL_TEXTURE1, 0, 1);
glMultiTexCoord2fARB(GL_TEXTURE1, 1, 1);
glMultiTexCoord2fARB(GL_TEXTURE1, 1, 0);
glMultiTexCoord2f(GL_TEXTURE1, 0, 0);
glMultiTexCoord2f(GL_TEXTURE1, 0, 1);
glMultiTexCoord2f(GL_TEXTURE1, 1, 1);
glMultiTexCoord2f(GL_TEXTURE1, 1, 0);
}
glVertexPointer(3, GL_FLOAT, 0, vtx1);
glTexCoordPointer(2, GL_FLOAT, 0, tex1);
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
if(applyShader)
PixelShaderCache::DisableShader();
}

View File

@ -306,7 +306,6 @@ void TextureCache::TCacheEntry::FromRenderTarget(u32 dstAddr, unsigned int dstFo
TargetRectangle targetSource = g_renderer->ConvertEFBRectangle(srcRect);
GL_REPORT_ERRORD();
GLfloat tex1[] = {
(GLfloat)targetSource.left, (GLfloat)targetSource.bottom,
(GLfloat)targetSource.left, (GLfloat)targetSource.top,
@ -314,15 +313,15 @@ void TextureCache::TCacheEntry::FromRenderTarget(u32 dstAddr, unsigned int dstFo
(GLfloat)targetSource.right, (GLfloat)targetSource.bottom
};
GLfloat vtx1[] = {
-1, 1, 1,
-1, -1, 1,
1, -1, 1,
1, 1, 1
-1.f, 1.f,
-1.f, -1.f,
1.f, -1.f,
1.f, 1.f
};
glTexCoordPointer(2, GL_FLOAT, 0, tex1);
glVertexPointer(3, GL_FLOAT, 0, vtx1);
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
glTexCoordPointer(2, GL_FLOAT, 0, tex1);
glVertexPointer(2, GL_FLOAT, 0, vtx1);
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
GL_REPORT_ERRORD();

View File

@ -222,13 +222,14 @@ void EncodeToRamUsingShader(FRAGMENTSHADER& shader, GLuint srcTexture, const Tar
(float)sourceRc.right, (float)sourceRc.top
};
GLfloat vtx1[] = {
-1, -1, 1,
-1, 1, 1,
1, 1, 1,
1, -1, 1
-1.f, -1.f,
-1.f, 1.f,
1.f, 1.f,
1.f, -1.f
};
glTexCoordPointer(2, GL_FLOAT, 0, tex1);
glVertexPointer(3, GL_FLOAT, 0, vtx1);
glVertexPointer(2, GL_FLOAT, 0, vtx1);
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
GL_REPORT_ERRORD();
@ -389,20 +390,22 @@ void DecodeToTexture(u32 xfbAddr, int srcWidth, int srcHeight, GLuint destTextur
GLfloat tex1[] = {
(float)srcFmtWidth, (float)srcHeight,
(float)srcFmtWidth, 0,
0, 0,
0, (float)srcHeight
(float)srcFmtWidth, 0.f,
0.f, 0.f,
0.f, (float)srcHeight
};
GLfloat vtx1[] = {
1, -1, 1,
1, 1, 1,
-1, 1, 1,
-1, -1, 1
1.f, -1.f,
1.f, 1.f,
-1.f, 1.f,
-1.f, -1.f
};
glTexCoordPointer(2, GL_FLOAT, 0, tex1);
glVertexPointer(3, GL_FLOAT, 0, vtx1);
glVertexPointer(2, GL_FLOAT, 0, vtx1);
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
GL_REPORT_ERRORD();
// reset state