Fixed the winding order of triangles in SpriteBatches and ParticleSystems.

This commit is contained in:
Alex Szpakowski
2015-03-04 16:03:01 -04:00
parent 4263de89ab
commit 4fa5ab4a07
5 changed files with 20 additions and 21 deletions
+2 -2
View File
@@ -373,8 +373,8 @@ void VertexIndex::fill()
indices[i*6+1] = T(i * 4 + 1);
indices[i*6+2] = T(i * 4 + 2);
indices[i*6+3] = T(i * 4 + 1);
indices[i*6+4] = T(i * 4 + 2);
indices[i*6+3] = T(i * 4 + 2);
indices[i*6+4] = T(i * 4 + 1);
indices[i*6+5] = T(i * 4 + 3);
}
}
+2 -2
View File
@@ -287,8 +287,8 @@ private:
* indices[i*6 + 1] = i*4 + 1;
* indices[i*6 + 2] = i*4 + 2;
*
* indices[i*6 + 3] = i*4 + 1;
* indices[i*6 + 4] = i*4 + 2;
* indices[i*6 + 3] = i*4 + 2;
* indices[i*6 + 4] = i*4 + 1;
* indices[i*6 + 5] = i*4 + 3;
*
* There will always be a large enough GLBuffer around until all
+12 -13
View File
@@ -153,21 +153,17 @@ void Image::loadDefaultTexture()
setFilter(filter);
// A nice friendly checkerboard to signify invalid textures...
GLubyte px[] = {0xFF,0xFF,0xFF,0xFF, 0xC0,0xC0,0xC0,0xFF,
0xC0,0xC0,0xC0,0xFF, 0xFF,0xFF,0xFF,0xFF};
GLubyte px[] = {0xFF,0xFF,0xFF,0xFF, 0xFF,0xC0,0xC0,0xFF,
0xFF,0xC0,0xC0,0xFF, 0xFF,0xFF,0xFF,0xFF};
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 2, 2, 0, GL_RGBA, GL_UNSIGNED_BYTE, px);
}
void Image::loadTextureFromCompressedData()
void Image::loadFromCompressedData()
{
GLenum iformat = getCompressedFormat(cdata->getFormat());
int count = flags.mipmaps ? cdata->getMipmapCount() : 1;
// We have to inform OpenGL if the image doesn't have all mipmap levels.
if (GLAD_ES_VERSION_3_0 || GLAD_VERSION_1_0)
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, count - 1);
for (int i = 0; i < count; i++)
{
glCompressedTexImage2D(GL_TEXTURE_2D, i, iformat,
@@ -176,7 +172,7 @@ void Image::loadTextureFromCompressedData()
}
}
void Image::loadTextureFromImageData()
void Image::loadFromImageData()
{
GLenum iformat = flags.sRGB ? GL_SRGB8_ALPHA8 : GL_RGBA8;
GLenum format = GL_RGBA;
@@ -248,8 +244,11 @@ bool Image::loadVolatile()
return true;
}
if (!flags.mipmaps && (GLAD_ES_VERSION_3_0 || GLAD_VERSION_1_0))
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0);
if ((isCompressed() || !flags.mipmaps) && (GLAD_ES_VERSION_3_0 || GLAD_VERSION_1_0))
{
int count = (flags.mipmaps && isCompressed()) ? cdata->getMipmapCount() : 1;
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, count - 1);
}
if (flags.mipmaps && !isCompressed() &&
!(GLAD_ES_VERSION_2_0 || GLAD_VERSION_3_0 || GLAD_ARB_framebuffer_object))
@@ -264,9 +263,9 @@ bool Image::loadVolatile()
try
{
if (isCompressed())
loadTextureFromCompressedData();
loadFromCompressedData();
else
loadTextureFromImageData();
loadFromImageData();
GLenum glerr = glGetError();
if (glerr != GL_NO_ERROR)
@@ -327,7 +326,7 @@ bool Image::refresh(int xoffset, int yoffset, int w, int h)
gl.bindTexture(texture);
if (isCompressed())
loadTextureFromCompressedData();
loadFromCompressedData();
else
{
const image::pixel *pdata = (const image::pixel *) data->getData();
+2 -2
View File
@@ -144,8 +144,8 @@ private:
void generateMipmaps();
void loadDefaultTexture();
void loadTextureFromCompressedData();
void loadTextureFromImageData();
void loadFromCompressedData();
void loadFromImageData();
GLenum getCompressedFormat(image::CompressedData::Format cformat) const;
+2 -2
View File
@@ -355,8 +355,8 @@ void Polyline::draw()
indices[i * 6 + 2] = GLushort(i * 4 + 2);
// Second triangle.
indices[i * 6 + 3] = GLushort(i * 4 + 1);
indices[i * 6 + 4] = GLushort(i * 4 + 2);
indices[i * 6 + 3] = GLushort(i * 4 + 2);
indices[i * 6 + 4] = GLushort(i * 4 + 1);
indices[i * 6 + 5] = GLushort(i * 4 + 3);
}
}