Texture mipmaps

Texture mipmaps

Discuss Lua based Spring scripts (LuaUI widgets, mission scripts, gaia scripts, mod-rules scripts, scripted keybindings, etc...)

Moderator: Moderators

Post Reply
sprunk
Posts: 100
Joined: 29 Jun 2015, 07:36

Texture mipmaps

Post 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?
Kloot
Spring Developer
Posts: 1867
Joined: 08 Oct 2006, 16:58

Re: Texture mipmaps

Post by Kloot »

Code: Select all

Spring.Echo("read this carefully: " .. mapTex[sx][sz].cur)
sprunk
Posts: 100
Joined: 29 Jun 2015, 07:36

Re: Texture mipmaps

Post 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.
Kloot
Spring Developer
Posts: 1867
Joined: 08 Oct 2006, 16:58

Re: Texture mipmaps

Post by Kloot »

Look closely at https://springrts.com/wiki/Lua_ConstGL, then at what is (not) passed to glCreateTexture.
sprunk
Posts: 100
Joined: 29 Jun 2015, 07:36

Re: Texture mipmaps

Post by sprunk »

Code: Select all

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

Return to “Lua Scripts”