Page 1 of 1

v1-10 GL3+ cubemap mipmap generation

Posted: Sat Aug 20, 2016 5:25 pm
by sparkprime
I just ported some code from GL to GL3+ and found that the mipmaps for a cubemap I use for environmental lighting were not being generated.

My code loads a tiff into an Image, chops it up into the 6 faces by writing another Image, and then loads this 6-face image into a texture.

https://github.com/grit-engine/grit-eng ... e.cpp#L379

This worked in GL but not in GL3+. I had to make this change to GL3+ itself to cause the texture to have mipmaps:

https://github.com/sparkprime/grit-ogre ... 6fa8bb0509

Can anyone explain why that condition was there and whether this is the right solution?

thanks

Re: v1-10 GL3+ cubemap mipmap generation

Posted: Sat Aug 20, 2016 6:35 pm
by dark_sylinc
You're alive! Welcome back to the forums :)

TBH I have no idea. I'm trying to contact the one who added that bit to see if he remembers.

Re: v1-10 GL3+ cubemap mipmap generation

Posted: Sat Aug 20, 2016 7:03 pm
by sparkprime
Lol yes, it has been 5 years since my last post ;)

Re: v1-10 GL3+ cubemap mipmap generation

Posted: Sun Aug 21, 2016 1:54 pm
by paroj
as this is from a time before OGRE got any code review, this is probably just a random change for the authors machine of the time.
similar to this, but less documented: https://github.com/OGRECave/ogre/blame/ ... .cpp#L1516

it is the same author: https://github.com/OGRECave/ogre/commit ... 8c3acbR452

Re: v1-10 GL3+ cubemap mipmap generation

Posted: Sun Aug 21, 2016 7:12 pm
by dark_sylinc
paroj wrote:as this is from a time before OGRE got any code review, this is probably just a random change for the authors machine of the time.
similar to this, but less documented: https://github.com/OGRECave/ogre/blame/ ... .cpp#L1516

it is the same author: https://github.com/OGRECave/ogre/commit ... 8c3acbR452
TBH OpenGL is full of vendor-specific woes. At some point we added the workaround rules; this code obviously predates that.

Re: v1-10 GL3+ cubemap mipmap generation

Posted: Mon Aug 22, 2016 2:27 am
by sparkprime
What makes me a bit uncomfortable is that basic 2d textures were getting mipmaps. E.g. mostly we use dds with mipmaps in them, but sometimes someone is lazy and there's a png texture. In those cases, it was working. But this could seems to exclude everything that's not a texture array or volume?

Re: v1-10 GL3+ cubemap mipmap generation

Posted: Tue Aug 23, 2016 1:42 pm
by paroj
sparkprime wrote:What makes me a bit uncomfortable is that basic 2d textures were getting mipmaps. E.g. mostly we use dds with mipmaps in them, but sometimes someone is lazy and there's a png texture. In those cases, it was working. But this could seems to exclude everything that's not a texture array or volume?
for ordinary 2d textures mipmaps are generated on loading:
https://github.com/OGRECave/ogre/blob/m ... e.cpp#L472

it seems like you are using a different code path where you update the data of an existing texture.

Re: v1-10 GL3+ cubemap mipmap generation

Posted: Wed Aug 24, 2016 10:09 pm
by sparkprime
Interesting how the condition in that other code path is exactly the opposite... :)