Hi Tobias,
Tobias Kipfelsberger wrote:
> Hi,
>
> I'm working on a markerless tracking project.
> Right now, I render into a FBO, calculate the edges on the resulting texture
> and compare those with another texture.
>
> As I need to sum the pixels in order to get a weight of the result, the
> texture must be transfered to the CPU again.
> Due to the use of floating point textures, I can't use "grabForeground".
*cringe* You're right, currently the GrabForeground only grabs ubytes. But
there
is not really a good reason for that except that the GrabForeground is older
than float buffers. It's a trivial fix:
glReadPixels(port->getPixelLeft(), port->getPixelBottom(),
w, h, i->getPixelFormat(),
- GL_UNSIGNED_BYTE, i->getData());
+ i->getDataType(), i->getData());
And it would make your code much simpler. So I consider this a bugfix and added
it to the current codebase. I tested the standard case, can you test the float
case to make sure it's working? All you need to do is create an Image with
datatype float, and you should get float results.
> In addition a proposal working entirely on GPU
> through Nvidia CUDA framework is considered.
Those are the big guns. You can probably do the same thing with normal GLSL
shaders.
> Therefore I need the OpenGL texture ID anyway.
>
> I'd appreciate it very much, if someone could point me to the right
> direction, as I'm a bloody beginner in OpenSG
> so far i tried following:
>
> void display (void)
> {
> // get the RenderAction from SimpleSceneManager
> RenderAction *rAct = static_cast<RenderAction*>( mgr->getAction() );
> // render fbo scene
> fboViewport->render(rAct);
> // render main scene
> mgr->redraw();
> // readback
> float* buf= new float ( imageWidth * imageHeight *4 );
> glBindTexture( GL_TEXTURE_RECTANGLE_ARB,
> fboViewport->getTextures(0)->getGLId() );
The id that's store in the TextureChunk is not th eactual GL id any more
(unless
you use an old version).
Hope it helps
Dirk
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users