v1-10 GL3+ cubemap mipmap generation

Discussion area about developing or extending OGRE, adding plugins for it or building applications on it. No newbie questions please, use the Help forum for that.
Post Reply
User avatar
sparkprime
Ogre Magi
Posts: 1137
Joined: Mon May 07, 2007 3:43 am
Location: Ossining, New York
x 13
Contact:

v1-10 GL3+ cubemap mipmap generation

Post 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
User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5296
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1278
Contact:

Re: v1-10 GL3+ cubemap mipmap generation

Post 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.
User avatar
sparkprime
Ogre Magi
Posts: 1137
Joined: Mon May 07, 2007 3:43 am
Location: Ossining, New York
x 13
Contact:

Re: v1-10 GL3+ cubemap mipmap generation

Post by sparkprime »

Lol yes, it has been 5 years since my last post ;)
paroj
OGRE Team Member
OGRE Team Member
Posts: 1994
Joined: Sun Mar 30, 2014 2:51 pm
x 1074
Contact:

Re: v1-10 GL3+ cubemap mipmap generation

Post 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
User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5296
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1278
Contact:

Re: v1-10 GL3+ cubemap mipmap generation

Post 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.
User avatar
sparkprime
Ogre Magi
Posts: 1137
Joined: Mon May 07, 2007 3:43 am
Location: Ossining, New York
x 13
Contact:

Re: v1-10 GL3+ cubemap mipmap generation

Post 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?
paroj
OGRE Team Member
OGRE Team Member
Posts: 1994
Joined: Sun Mar 30, 2014 2:51 pm
x 1074
Contact:

Re: v1-10 GL3+ cubemap mipmap generation

Post 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.
User avatar
sparkprime
Ogre Magi
Posts: 1137
Joined: Mon May 07, 2007 3:43 am
Location: Ossining, New York
x 13
Contact:

Re: v1-10 GL3+ cubemap mipmap generation

Post by sparkprime »

Interesting how the condition in that other code path is exactly the opposite... :)
Post Reply