Jump to content
  • Advertisement
Sign in to follow this  

OpenGL Updating a single point in a 3D texture

This topic is 3739 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, Is it possible to render 1 single point in a 3D texture? Basically I'll use a 3D texture as render target. But instead of rendering 1 entire slice, I only need to update 1 pixel. Maybe this is not nescesary to answer the question, but here is some code from an ATI realtime Global Illumination demo that renders SH coefficients into 3D textures with this DirectX(10) code. They also update single points in volume textures:
	D3D10_VIEWPORT shVP = { 0, 0, SIZE_X, SIZE_Y, 0, 1 };
	dev->RSSetViewports(1, &shVP);


	UINT stride = sizeof(ShVertex);
	UINT offset = 0;
	dev->IASetVertexBuffers(0, 1, &m_shCoeffVB, &stride, &offset);

	for (int i = 0; i < SH_COEFF_VECTORS; i++)
        // shCoeffsRTV is an array of "Render Target Views"
        // m_shTableSRV is an array of "
		ID3D10RenderTargetView *rt[] = { m_shCoeffsRTV[0], m_shCoeffsRTV[1], m_shCoeffsRTV[2]};
		dev->OMSetRenderTargets(3, rt, NULL);

		dev->PSSetShaderResources(0, 1, &m_shTableSRV);
		if (i == 0) dev->PSSetShaderResources(1, 1, &m_probesSRV);

		dev->Draw(PROBE_CUBES_PER_FRAME, m_currProbe);

I never use D3D, so its hard to read this code and find the OpenGL equivalent to do this. Probably most of the code above is not important for my question (and they also render multiple stuff at the same time with a geometry shader). Anyway, what is the best way to 'update' 1 pixel in a 3D texture? Greetings, Rick

Share this post

Link to post
Share on other sites
It depends if you are using a standard texture or render to texture.

If standard, use glTexSubImage3D.
If FBO, I don`t remember the call sequence.

Share this post

Link to post
Share on other sites
I render to a texture >> FBO

glFramebufferTexture3DEXT( GL_FRAMEBUFFER_EXT,
GL_TEXTURE_3D, targetTex.handle,
0, sliceIndex );

I guess one way to do it is by setting the viewport exactly to that one pixel:
glViewPort( pixelX, pixelY, 1,1 )
I'm not sure though, and maybe there are better ways?


[Edited by - spek on April 21, 2008 1:16:43 PM]

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!