Use proper texture wrapping mode for 2d. Stops garbage down the top and left sides. Should really use NPOT texture.

This commit is contained in:
Ian Curtis 2016-04-02 12:23:46 +00:00
parent 736f5ab958
commit c7412828d4
2 changed files with 3 additions and 3 deletions

View file

@ -62,7 +62,7 @@ x------- -------- -------- -------- Alpha testing / contour
-------- -------- -----x-- -------- Texture enable -------- -------- -----x-- -------- Texture enable
-------- -------- ------xx x------- Texture format -------- -------- ------xx x------- Texture format
-------- -------- -------- -------x Alpha enable ? -------- -------- -------- -------x Alpha enable ?
-------- ------x - ------- -------- Never seen set ? -------- ------x- -------- -------- Never seen set ?
-------- -------- -------- -----xx- Always set ? -------- -------- -------- -----xx- Always set ?
-------- -------- -------- -xxxx--- ? -------- -------- -------- -xxxx--- ?
*/ */

View file

@ -797,8 +797,8 @@ bool CRender2D::Init(unsigned xOffset, unsigned yOffset, unsigned xRes, unsigned
{ {
glActiveTexture(GL_TEXTURE0); // texture unit 0 glActiveTexture(GL_TEXTURE0); // texture unit 0
glBindTexture(GL_TEXTURE_2D, texID[i]); glBindTexture(GL_TEXTURE_2D, texID[i]);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, 512, 512, 0, GL_RGBA, GL_UNSIGNED_BYTE, surfTop); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, 512, 512, 0, GL_RGBA, GL_UNSIGNED_BYTE, surfTop);