Log in or register to post comments

Texturing 3D Objects with camera background

January 12, 2013 - 3:37pm #7

I was wondering how could be the easiest way to render a 3D object using the camera background to texture it. With vuforia-sdk-ios-2-0-30 and BackgroundTextureAccess-2-0-6 I have tried in EAGLView.mm to replace

glBindTexture(GL_TEXTURE_2D, [obj3D.texture textureID]);




No result at all, the teapot does not get rendered. I know I should adjust the texture cords of the objects and all of that but it was just a quick test.

Hi, I tried to reprocude the

January 13, 2013 - 6:12am #6

Hi, I tried to reprocude the same test, and indeed I get the same issue;

it could be that the bindVideoBackground() function perfoms some extra low-level OpenGL operations 

let me investigate it a bit and then I will get back to you asap.


One of my worst fears is that

January 13, 2013 - 3:29pm #5

One of my worst fears is that once that you have called drawBackground or bindVideoBackground, you will never be able to use them again in the same frame. However I do not know why that may happens.

I think I can accomplish what I want by rendering all the 3d objects with camera texture at the beginning.  Although it would be easier if calling bindVideoBackground various times was possible.

I promise to report back with my results.


OK, let us know how to goes,

January 14, 2013 - 12:29am #4

OK, let us know how to goes, this is an interesting issue; meanwhile I'll also investigate...

Hi, I found the issue (and

January 14, 2013 - 12:53am #3

Hi, I found the issue (and solution);

the bindVideoBackground() function performs basically two things:

- binds a special shader (which is used to do some operations on the video frame itself)

- binds the video texture

Consequently, the call to bindVideoBackground() actually has the effect of disabling your current shader (i.e. the shader that you are using to render the teapot);

this explains why the teapot is no longer rendered.


So, you can call bindVideoBackground() more than once without problems (as I just verified), but you need to call it BEFORE calling glUseShader( shaderProgramID );


So the steps to take are:

- remove the line  < glBindTexture(GL_TEXTURE_2D, [obj3D.texture textureID]); >, as you were already doing

- add the bindVideoBackground() function before the line "glUseShader(...)";

Then it should work (I tested it on an Android phone and it works, but it should show the same behaviour on the iPhone too)


Thanks loads Alessandro,

January 14, 2013 - 3:39pm #2

Thanks loads Alessandro, vuforia staff is awesome.

I have tried it and it works like a charm. Do not forget to adjust the glViewport as well, since I think that glBindBackground modifies it.


You're welcome (and glad that

January 15, 2013 - 1:18am #1

You're welcome (and glad that you like Vuforia)

Log in or register to post comments