OpenGL processing for procedural texturing

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

OpenGL processing for procedural texturing

David Faught
Here is my next set of OpenGL questions.  Any help or direction would
be appreciated!

Referring to the page at
http://croquetconsortium.org/index.php/Procedural_Texturing
and considering that it took me about 2 years to get this far
(calendar time, not working time :-),

1. would it be better to follow the procedure listed there, which runs
the shaders for every textured pixel of every render frame and
presumably would immediately reflect any changes in parameters from
the UI, or

2. render the shaders once into an FBO, copy that to a texture which
is mapped to the geometry in the normal manner, and redo this step
anytime there is a change in the parameters from the UI ( a. or would
this still be every frame?)?

B. What is the best way to get the texture or FBO back from the GPU
into a bitmap in order to be able to save it to a file, like a png?
In most of the examples I see, the point is to get things into the
GPU, not out.

Thanks again for any help.
Dave
Reply | Threaded
Open this post in threaded view
|

Re: OpenGL processing for procedural texturing

Joshua Gargus-2

On Jun 15, 2007, at 5:34 AM, David Faught wrote:

> Here is my next set of OpenGL questions.  Any help or direction would
> be appreciated!
>
> Referring to the page at
> http://croquetconsortium.org/index.php/Procedural_Texturing
> and considering that it took me about 2 years to get this far
> (calendar time, not working time :-),
>
> 1. would it be better to follow the procedure listed there, which runs
> the shaders for every textured pixel of every render frame and
> presumably would immediately reflect any changes in parameters from
> the UI, or
>
> 2. render the shaders once into an FBO, copy that to a texture which
> is mapped to the geometry in the normal manner, and redo this step
> anytime there is a change in the parameters from the UI ( a. or would
> this still be every frame?)?

I would do 1) first, just so that you get something running more  
quickly.  I don't think that it would take any longer to implement 1)  
then 2) rather than implementing 2) directly.

>
> B. What is the best way to get the texture or FBO back from the GPU
> into a bitmap in order to be able to save it to a file, like a png?
> In most of the examples I see, the point is to get things into the
> GPU, not out.

You should be able to use glReadPixels() with an FBO.  The best way  
is to use pixel-buffer objects (PBO) because you can invoke the read  
and have it complete asynchronously (whereas the glReadPixels() call  
does not return until it has finished reading the pixels).

Josh

>
> Thanks again for any help.
> Dave