[osg-users] render to a texure bound to an FBO and re-generate mipmaps every frame

Julius Ziegler ziegler at atlatec.de
Tue Apr 10 11:45:11 PDT 2018


Dear OSG-friends,

I currently have a scene graph set up where a pre-render camera renders 
content to a texture via an FBO, and the main camera uses this texture 
to texture a quad with it. This works, in principle.

However I need mipmapping for that texture, and all but the 0th mipmap 
level of the texture are empty.

With an apitracer, I found out that the glGenerateMipMap call happens

1. only in the first frame (but I want it to be called every frame).
2. before any draw calls towards the FBO (but I want it after the draw 
calls).

I tried to inject a glGenerateMipMap via a DrawCallback which I attached 
to the quad, and which just extends the original draw implementation 
(glGenerateMipMap immediately before the original draw implementation).

With the apitracer, I validated that, at the position where I injected 
the glGenerateMipMap

a. the correct texture is bound
b. the frame buffer is un-bound.

But glGenerateMipMap just seg'faults. Because of the seg'fault (I mean 
we are all used to GL_ERRORS, but seg'faults?) I suspected a driver 
issue, but I tried it on an alternative platform (one is Intel Graphics, 
one is Nvidia, both on Linux). Both to the same result.

Can you please help? Maybe I overlooked a simple osg-ish way to achieve 
this (maybe I just have to set something dirty()?)

Thanks!

Julius


More information about the osg-users mailing list