glCopyTexImage

I render a scene to my viewport and create a rectangular texture. I want to render the viewport to that rectangular texture which works just fine if i define the texture’s format to be rgba, however, if the format is rgba32f_ so a 32bit floating point texture the rendering speed drops amazingly.

can someone tell me please what i did wrong or how to do it better (with respect to glCopyTexImage)

here is some code

//set up texture
			Gl.glGenTextures(1, out this.iTexture);

			Gl.glBindTexture(Gl.GL_TEXTURE_RECTANGLE_ARB, this.iTexture);

			Gl.glTexEnvi(Gl.GL_TEXTURE_ENV, Gl.GL_TEXTURE_ENV_MODE, Gl.GL_MODULATE);
			Gl.glTexParameteri(Gl.GL_TEXTURE_RECTANGLE_ARB, Gl.GL_TEXTURE_MIN_FILTER, Gl.GL_LINEAR);
			Gl.glTexParameteri(Gl.GL_TEXTURE_RECTANGLE_ARB, Gl.GL_TEXTURE_MAG_FILTER, Gl.GL_LINEAR);
			Gl.glTexParameteri(Gl.GL_TEXTURE_RECTANGLE_ARB, Gl.GL_TEXTURE_WRAP_S, Gl.GL_CLAMP_TO_EDGE);
			Gl.glTexParameteri(Gl.GL_TEXTURE_RECTANGLE_ARB, Gl.GL_TEXTURE_WRAP_T, Gl.GL_CLAMP_TO_EDGE);

			Gl.glEnable(Gl.GL_TEXTURE_RECTANGLE_ARB);	
//rendering stuff			Gl.glBindTexture(Gl.GL_TEXTURE_RECTANGLE_ARB, this.iTexture);
//render scene			Gl.glCopyTexImage2D(Gl.GL_TEXTURE_RECTANGLE_ARB, 0, Gl.GL_RGB32F_ARB, 0, 0, 640, 480, 0);

Just use RGB and not RGBA. There’s absolutely no need for the alpha channel that consumes memory but is not used at all.

Hope that helps.

it still runs slow (if one could call that running)

try using glCopyTexSubImage(…);
it’s much much quicker!

the RGBA32 format uses 32 bits per channel, so that’s 4x the memory access of a standard RGBA format. it should take longer.

Is your framebuffer RGBA8 or RGBA32 ?

I setup the framebuffer with the normal pixel format like PFD_TYPE_RGBA (I hope that this is what you mean) or so … should I use something different?

I think they are referring to the format and internal_format parameters of all of the glTexImage calls.

well the glcopyteximage() call is visible in my first post

No. The question was what pixel format does your framebuffer have?

Because if the framebuffer has RGB(A)8 fixed point format, the glCopyTex(Sub)Image call with internal format RGBA32F has to do a format conversion (in the worst case this has to be done on the CPU), while with internal format RGBA8 it can simply copy the data…

How I can I set this up or query for the framebuffer format?

The question is: Why do you want to copy RGBA8 data from your framebuffer into a RGBA32 texture? You don’t gain anything from that.

However, if you want to render 32 Bit data to your texture, you should check out the “Framebuffer Object” (FBO) extension.

Jan.

I want to implement some algorithm that is described in a paper. Therein geometry is processed by a pair of shaders (that forwards the x,y,z coordinate of a vertex to the fragment shader - the fragment shader writes x,y,z to r,g,b color values - this I figured I need a floating point texture).