Fix texture filtering (should all be nearest)

This commit is contained in:
Dane Johnson 2021-01-18 19:06:37 -06:00
parent 155b572aca
commit 22016f9d98
6 changed files with 10 additions and 9 deletions

View File

@ -22,9 +22,9 @@ Texture Texture::FromFile(const char *filename) {
glBindTexture(GL_TEXTURE_2D, tex.id);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
int nrChannels;
unsigned char* data = stbi_load(filename, &tex.width, &tex.height, &nrChannels, 0);

Binary file not shown.

View File

@ -41,11 +41,12 @@ function init()
ball1.transform:Translate(0.0, 3.0, 0.0)
cube = couch.Mesh.FromFile("cube.glb")
cube:SetupMesh();
cube.material.tex = couch.Texture.FromFile("container.png")
cube.material.usesTex = true
couch.Node.GetRoot().children:Append(cube)
trough = couch.Mesh.FromFile("trough.glb")
trough:SetupMesh()
trough.material.tex = couch.Texture.FromFile("wood_lowres.png")
trough.material.usesTex = true
couch.Node.GetRoot().children:Append(trough)
trough.transform:Translate(10.0, 0.0, 0.0)
end
function update(delta)

BIN
demo/trough.glb Normal file

Binary file not shown.

BIN
demo/wood_lowres.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 71 KiB

View File

@ -57,7 +57,7 @@ PROJECT( Assimp VERSION 5.0.0 )
OPTION( BUILD_SHARED_LIBS
"Build package with shared libraries."
ON
OFF
)
OPTION( BUILD_FRAMEWORK