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
Contact:

v1-10 GL3+ cubemap mipmap generation

Post by sparkprime » Sat Aug 20, 2016 5:25 pm

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
0 x

User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 4116
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 243
Contact:

Re: v1-10 GL3+ cubemap mipmap generation

Post by dark_sylinc » Sat Aug 20, 2016 6:35 pm

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.
0 x

User avatar
sparkprime
Ogre Magi
Posts: 1137
Joined: Mon May 07, 2007 3:43 am
Location: Ossining, New York
Contact:

Re: v1-10 GL3+ cubemap mipmap generation

Post by sparkprime » Sat Aug 20, 2016 7:03 pm

Lol yes, it has been 5 years since my last post ;)
0 x

paroj
OGRE Team Member
OGRE Team Member
Posts: 872
Joined: Sun Mar 30, 2014 2:51 pm
x 176
Contact:

Re: v1-10 GL3+ cubemap mipmap generation

Post by paroj » Sun Aug 21, 2016 1:54 pm

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
0 x

User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 4116
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 243
Contact:

Re: v1-10 GL3+ cubemap mipmap generation

Post by dark_sylinc » Sun Aug 21, 2016 7:12 pm

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.
0 x

User avatar
sparkprime
Ogre Magi
Posts: 1137
Joined: Mon May 07, 2007 3:43 am
Location: Ossining, New York
Contact:

Re: v1-10 GL3+ cubemap mipmap generation

Post by sparkprime » Mon Aug 22, 2016 2:27 am

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?
0 x

paroj
OGRE Team Member
OGRE Team Member
Posts: 872
Joined: Sun Mar 30, 2014 2:51 pm
x 176
Contact:

Re: v1-10 GL3+ cubemap mipmap generation

Post by paroj » Tue Aug 23, 2016 1:42 pm

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.
0 x

User avatar
sparkprime
Ogre Magi
Posts: 1137
Joined: Mon May 07, 2007 3:43 am
Location: Ossining, New York
Contact:

Re: v1-10 GL3+ cubemap mipmap generation

Post by sparkprime » Wed Aug 24, 2016 10:09 pm

Interesting how the condition in that other code path is exactly the opposite... :)
0 x

Post Reply