Fix texture filtering (should all be nearest)
This commit is contained in:
parent
70a2e0352a
commit
78370a2ffd
@ -22,9 +22,9 @@ Texture Texture::FromFile(const char *filename) {
|
|||||||
glBindTexture(GL_TEXTURE_2D, tex.id);
|
glBindTexture(GL_TEXTURE_2D, tex.id);
|
||||||
|
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
|
||||||
glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_T, GL_REPEAT);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
|
||||||
glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||||
glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||||
|
|
||||||
int nrChannels;
|
int nrChannels;
|
||||||
unsigned char* data = stbi_load(filename, &tex.width, &tex.height, &nrChannels, 0);
|
unsigned char* data = stbi_load(filename, &tex.width, &tex.height, &nrChannels, 0);
|
||||||
|
BIN
demo/cube.glb
BIN
demo/cube.glb
Binary file not shown.
@ -41,11 +41,12 @@ function init()
|
|||||||
|
|
||||||
ball1.transform:Translate(0.0, 3.0, 0.0)
|
ball1.transform:Translate(0.0, 3.0, 0.0)
|
||||||
|
|
||||||
cube = couch.Mesh.FromFile("cube.glb")
|
trough = couch.Mesh.FromFile("trough.glb")
|
||||||
cube:SetupMesh();
|
trough:SetupMesh()
|
||||||
cube.material.tex = couch.Texture.FromFile("container.png")
|
trough.material.tex = couch.Texture.FromFile("wood_lowres.png")
|
||||||
cube.material.usesTex = true
|
trough.material.usesTex = true
|
||||||
couch.Node.GetRoot().children:Append(cube)
|
couch.Node.GetRoot().children:Append(trough)
|
||||||
|
trough.transform:Translate(10.0, 0.0, 0.0)
|
||||||
end
|
end
|
||||||
|
|
||||||
function update(delta)
|
function update(delta)
|
||||||
|
BIN
demo/trough.glb
Normal file
BIN
demo/trough.glb
Normal file
Binary file not shown.
BIN
demo/wood_lowres.png
Normal file
BIN
demo/wood_lowres.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 71 KiB |
Loading…
Reference in New Issue
Block a user