I am developing an algorithm for 3d modelling from 2d images. One of the approaches I thought would be to load textures into texture memory and subsequently query appropriate pixel data from the texture.
However, I do not know of a way to do so… and would be glad if somebody could help me on how to get pixel data from textures?
I am aiming to make my application fast and hence want to limit my use of glReadPixels(). Is there any quick alternative whereby I could get the color information of the pixel in question from texture itself…?
I know I am repeating myself, but its just that iam stuck…!
It’s in a fragment program (pixel shader) that you can fetch texels. You should read about it in the documents at ati and nvidia and read the registry http://oss.sgi.com/projects/ogl-sample/registry/
You can learn Cg if you wish. It’s possible there too.
You’ve been a great help. Hopefully this should solve the problem… I have the Cg book with me and may start it soon… in the mean time would go through the docs at nVidia…
I can add that the next programmable hw will be able to access textures in VP. I saw that in some document about the next generation of D3D.
Because texture accesses are exactly the kind of thing you want to do in a vertex program.
They should be working on getting us memory buffer that can be accessed (in a strictly non-texture-like fashion) from the vertex programs. The memory buffer API could actually be fast to upload new data to, rather than the texture API which is very slow. I want to be able to upload a sequence of matrices to the graphics hardware every frame for multiple characters. A VBO-esque buffer is more what is needed than a texture.
I think their choice for a texture buffer instead of a general one is that it somehow involves the need for the texture hw for doing filtering for LOD.