0

I have an image from an external source (say a software ray tracer) that also has a depth buffer. I want to render that image in an OpenGL scene (which contains several other 3D objects) such that the OpenGL depth buffer is correctly updated, i.e. the image and the other 3D objects should be combined using correct depth testing. Any ideas? A solution without shaders would be nice.

genpfault
  • 51,148
  • 11
  • 85
  • 139
porst17
  • 377
  • 3
  • 16

2 Answers2

0

Load your depth map via glDrawPixels(..., ..., GL_DEPTH_COMPONENT, ..., ...) and render as usual.

genpfault
  • 51,148
  • 11
  • 85
  • 139
0

Using OpenGL pixel_buffer_object, you can bind depth textures. So the process would be as follows:

  1. Load external texture
  2. Load external depth texture
  3. Create pixel_buffer_object with the two textures
  4. Set PBO as render target and render the rest of your geometry (don't glClear before rendering).
Wilbert
  • 7,251
  • 6
  • 51
  • 91