Page 1 of 1

Texture mipmaps

Posted: 31 Dec 2016, 15:17
by sprunk
ZK custom map texture is grainy and according to the comments this is caused by having no mipmap. So the solution is to generate a mipmap for the custom texture and there is a gl.GenerateMipmap callout which I wanted to use:

Code: Select all

gl.GenerateMipmap("!" .. textureID)
Spring.SetMapSquareTexture(x, z, textureID)
(actual code)

But this fails: the custom texture is applied but is still grainy. What could be wrong?

Re: Texture mipmaps

Posted: 31 Dec 2016, 17:37
by Kloot

Code: Select all

Spring.Echo("read this carefully: " .. mapTex[sx][sz].cur)

Re: Texture mipmaps

Posted: 12 Jan 2017, 17:36
by sprunk
Thanks! Looks like the '!' is already contained in gl.CreateTexture return value.

However after taking this into account the code still does not work.

Re: Texture mipmaps

Posted: 12 Jan 2017, 18:32
by Kloot
Look closely at https://springrts.com/wiki/Lua_ConstGL, then at what is (not) passed to glCreateTexture.

Re: Texture mipmaps

Posted: 13 Jan 2017, 18:08
by sprunk

Code: Select all

min_filter = GL.LINEAR_MIPMAP_NEAREST,
Passing this to glCreateTexture works. Thanks a lot!