v1-10 GL3+ cubemap mipmap generation
-
- Ogre Magi
- Posts: 1137
- Joined: Mon May 07, 2007 3:43 am
- Location: Ossining, New York
- x 13
v1-10 GL3+ cubemap mipmap generation
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
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
-
- OGRE Team Member
- Posts: 5433
- Joined: Sat Jul 21, 2007 4:55 pm
- Location: Buenos Aires, Argentina
- x 1341
Re: v1-10 GL3+ cubemap mipmap generation
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.
TBH I have no idea. I'm trying to contact the one who added that bit to see if he remembers.
-
- Ogre Magi
- Posts: 1137
- Joined: Mon May 07, 2007 3:43 am
- Location: Ossining, New York
- x 13
Re: v1-10 GL3+ cubemap mipmap generation
Lol yes, it has been 5 years since my last post
-
- OGRE Team Member
- Posts: 2106
- Joined: Sun Mar 30, 2014 2:51 pm
- x 1132
Re: v1-10 GL3+ cubemap mipmap generation
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
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
-
- OGRE Team Member
- Posts: 5433
- Joined: Sat Jul 21, 2007 4:55 pm
- Location: Buenos Aires, Argentina
- x 1341
Re: v1-10 GL3+ cubemap mipmap generation
TBH OpenGL is full of vendor-specific woes. At some point we added the workaround rules; this code obviously predates that.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
-
- Ogre Magi
- Posts: 1137
- Joined: Mon May 07, 2007 3:43 am
- Location: Ossining, New York
- x 13
Re: v1-10 GL3+ cubemap mipmap generation
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?
-
- OGRE Team Member
- Posts: 2106
- Joined: Sun Mar 30, 2014 2:51 pm
- x 1132
Re: v1-10 GL3+ cubemap mipmap generation
for ordinary 2d textures mipmaps are generated on loading: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?
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.
-
- Ogre Magi
- Posts: 1137
- Joined: Mon May 07, 2007 3:43 am
- Location: Ossining, New York
- x 13
Re: v1-10 GL3+ cubemap mipmap generation
Interesting how the condition in that other code path is exactly the opposite...