Pixel Buffers, Cocoa, and Mipmaps
I am working with PBuffers for the first time, and I have set one up in Cocoa and it seems to be working OK. Anyway, I was just wondering if it were possible to automatically generate mipmaps of the pbuffer?
I MUST have an automatically gen'd mipmap set for the texture, but I really don't know how to go about it.
I do...
pBuffer = [[NSOpenGLPixelBuffer alloc]
initWithTextureTarget:GL_TEXTURE_2D
textureInternalFormat:GL_RGBA
textureMaxMipMapLevel:4
pixelsWide:512
pixelsHigh:512];
so setting max mipmap levels to 4, but this doesn't seem to generate the mipmaps.
Cheers, Ben.
I MUST have an automatically gen'd mipmap set for the texture, but I really don't know how to go about it.
I do...
pBuffer = [[NSOpenGLPixelBuffer alloc]
initWithTextureTarget:GL_TEXTURE_2D
textureInternalFormat:GL_RGBA
textureMaxMipMapLevel:4
pixelsWide:512
pixelsHigh:512];
so setting max mipmap levels to 4, but this doesn't seem to generate the mipmaps.
Cheers, Ben.
this may have nothing to do with it, because of mipmaps, but shouldn't it be 256x256?
It's not magic, it's Ruby.
I am not sure how well it works with pbuffers, but look at the SGIS_generate_mipmap extension. It will generate all the mip levels above the level you update.
SGIS_generate_mipmap doesn't seem to work with CGLTexImagePBuffer and friends, but there is a hack to make it work -- if you share texture objects between the PBuffer context and the normal rendering context, you can use CopyTex(Sub)Image2D in the PBuffer context to write into a SGIS_generate_mipmap-enabled texture accessible from the main.
OK thanks, I'll do that. The problem is that I need to do this about 50 times per frame. So it's gonna be sloooow. So if anyone has any other ideas that doesn't involve moving the color buffer, then please say!
Thanks for the responses, I'll get to it!
Ben
Thanks for the responses, I'll get to it!
Ben
What on earth are you doing that you need to create 50 pbuffers every frame!?
If you need this to run at real-time speeds, you may need to rethink your design...
- Alex Diener
If you need this to run at real-time speeds, you may need to rethink your design...
- Alex Diener
That's not excessive at all. 50 pbuffers = 50 dynamic textures. Lots of games use more than 50 textures in a scene. Just animate them all (you could easily use 50 cloud types in just the sky part of the scene. Now add animated foliage... 100's of textures...)
bensta00, if you find that SGIS_generate_mipmap doesn't work automatically with pbuffers, please file a feature request so Apple knows it is important to you. It should work.
bensta00, if you find that SGIS_generate_mipmap doesn't work automatically with pbuffers, please file a feature request so Apple knows it is important to you. It should work.
ThemsAllTook, I am implementing a stereo vision algorithm.
Arekkusu, OK, I will do that right now. I can't get it working, and it's annoying! :-) I'm just about to use the pixel copying technique described earlier. Basically I wanted to eliminate buffer reads totally, as they slowed this algorithm down last time I implemented it, and I redesigned it a little not to use them atall. Ah well...
Thanks,
Ben
Arekkusu, OK, I will do that right now. I can't get it working, and it's annoying! :-) I'm just about to use the pixel copying technique described earlier. Basically I wanted to eliminate buffer reads totally, as they slowed this algorithm down last time I implemented it, and I redesigned it a little not to use them atall. Ah well...
Thanks,
Ben
I haven't experimented with this, but if it works the way I think OSC means, you can force the mipmaps to be generated by touching any one texel of the base mip level. You don't have to actually copy the entire content-- try just updating one pixel from a const int.
Of course, that might fail if the drivers are smart enough to regenerate mip levels based on the subportion of the texture that changed...
Of course, that might fail if the drivers are smart enough to regenerate mip levels based on the subportion of the texture that changed...
Hello again everyone, could someone please post a request for this feature to Apple for me? The website says I need a developer's username & password, and I ain't got one of those!
Supposedly this feature is available under the evil Windows, so it should be featured on OS X too!
Let me know if you can,
Thanks!
Supposedly this feature is available under the evil Windows, so it should be featured on OS X too!
Let me know if you can,
Thanks!
An ADC Online membership is free. You just have to agree to the NDA.
Possibly Related Threads...
| Thread: | Author | Replies: | Views: | Last Post | |
| MipMaps | OptimisticMonkey | 4 | 4,603 |
Feb 17, 2011 07:17 PM Last Post: Holmes |
|
| [CoreGraphics] Image manipulation - pixel by pixel | g00se | 5 | 7,079 |
Jul 28, 2010 08:27 AM Last Post: ThemsAllTook |
|
| Frame buffers, vertex programs and more. 8600m GT | m3the01 | 18 | 7,277 |
Nov 18, 2007 07:34 PM Last Post: m3the01 |
|
| Stencil buffers in an FBO... trouble | TomorrowPlusX | 17 | 6,773 |
Mar 23, 2006 08:19 PM Last Post: kberg |
|
| mipmaps LOD bias | bensta00 | 2 | 3,535 |
Feb 2, 2005 10:04 AM Last Post: bensta00 |
|

