mirror of
https://github.com/recastnavigation/recastnavigation.git
synced 2026-08-13 08:59:25 +00:00
Added mipmaps to the grid texture. Removed obsolete SoloMeshTiled sample.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user