-
Junior Member
Newbie
framebuffer object and textures
I have a texture attached to a framebuffer object, say to color attachment #0.
glActiveTextureARB( GL_TEXTURE2_ARB );
glBindTexture(GL_TEXTURE_RECTANGLE_NV, textureid[0]);
glTexImage2D(GL_TEXTURE_RECTANGLE_NV, 0, GL_FLOAT_RGBA32_NV, W, H, 0, GL_RGBA, GL_FLOAT, NULL);
gpuSortFbo = new FramebufferObject ();
gpuSortFbo->Bind();
gpuSortFbo->AttachTexture(GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_RECTANGLE_NV, textureid[0]);
gpuSortFbo->IsValid();
FramebufferObject:
isable();
One of my shaders puts the particle positions(x,y,z,w) into textureid[0]. Now I need to calculate for each position, the distance from the eye. But the distance calculated is a single value as opposed to the x,y,z,w of the particle position. Currently what I am doing is that I write the same value (distance calculated) for the x,y,z,w into another texture.
Is there a way I can reduce these 4 values to a single value on the gpu itself ?
-
Junior Member
Regular Contributor
Re: framebuffer object and textures
why don't you just output the distance to a texture?
-
Junior Member
Newbie
Re: framebuffer object and textures
I am outputting the distance to a texture. Say for a position (x,y,z,w), I am writing value (d,d,d,d) to another texture. I want to reduce this texture by 1/4th so that I can have a single value d for the corresponding x,y,z,w value in the first texture. The problem here is that, the textures attached to a framebuffer object have to be of the same size.
What I want, is to get a texture of size width*height from a texture of size width*height*4 using shaders.
-
Junior Member
Newbie
Re: framebuffer object and textures
Another way to interpret the problem.
I have a texture of size width*height in format GL_RGBA, which I use to store vertex data (x,y,z,w) for each vertex. I have width*height number of vertices. Now I want to create a buffer which will store the x value of each vertex from the texture.
I want this to be done on the gpu only.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules