Added mipmaps to the grid texture. Removed obsolete SoloMeshTiled sample.

This commit is contained in:
Mikko Mononen
2011-03-06 16:00:04 +00:00
parent e84d563bfe
commit 9f2390e196
8 changed files with 45 additions and 1313 deletions

View File

@@ -159,15 +159,25 @@ public:
// Create checker pattern.
const unsigned int col0 = duRGBA(215,215,215,255);
const unsigned int col1 = duRGBA(255,255,255,255);
static const int TSIZE = 32;
static const int TSIZE = 64;
unsigned int data[TSIZE*TSIZE];
for (int y = 0; y < TSIZE; ++y)
for (int x = 0; x < TSIZE; ++x)
data[x+y*TSIZE] = (x==0 || y==0) ? col0 : col1;
glGenTextures(1, &m_texId);
glBindTexture(GL_TEXTURE_2D, m_texId);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, TSIZE,TSIZE, 0, GL_RGBA, GL_UNSIGNED_BYTE, data);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
int level = 0;
int size = TSIZE;
while (size > 0)
{
for (int y = 0; y < size; ++y)
for (int x = 0; x < size; ++x)
data[x+y*size] = (x==0 || y==0) ? col0 : col1;
glTexImage2D(GL_TEXTURE_2D, level, GL_RGBA, size,size, 0, GL_RGBA, GL_UNSIGNED_BYTE, data);
size /= 2;
level++;
}
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
}
else