[SOLVED] prepare_now changes??

I just upgraded and rebuilt Panda1.8 from SVN.

Now when I compile my app the following error appears.

 error: no suitable conversion function from "PointerTo<GraphicsStateGuardianBase>" to "PreparedGraphicsObjects *" exists
1>  	gsg->release_texture(Buffertexture->prepare_now(gsg->get_prepared_objects(),gsg));

Has there been recent change in source code for prepare_now?

EDIT. I notice that in texture.h prepare_now is defined as:

TextureContext *prepare_now(int view,PreparedGraphicsObjects *prepared_objects, GraphicsStateGuardianBase *gsg);

[i]> Is this a recent change? (no mention of revision change in the header since ‘Updated by: fperazzi, PandaSE(29Apr10…’), please note change date in the headers!!!)

what should be the parameter view? I suppose I should leave this parameter to 1 if not using stereo buffering???[/i]

Yes, this is a recent change, my apologies. You do have to expect the occasional change when you pull code directly from the head of the cvs trunk. :wink: We generally don’t update the headers with each new change; if we did, the headers would soon get very long. That’s what the cvs history is for.

You should pass 0 as the first parameter to prepare_now() if you are not using stereo textures.

It’s an odd use of prepare_now(), though. You prepare a texture and then immediately release it?


Well actually I’m using it this way to get texture GL index:

GLTextureContext *GLtexContext =  DCAST(GLTextureContext,Buffertexture->prepare_now(1,gsg->get_prepared_objects(),gsg));
GLuint tex_GLindex = GLtexContext->_index;

and it works ok

For the ‘weird’ release stuff, I know it’s a bit strange, but the aim is that I wanted to be sure that the texture won’t be left around since I’m manipulating it directly with openGL…

Well, it’s true that if your texture doesn’t have multiviews, it doesn’t really matter what value you put in for view. It will be understood to be 0 regardless. But 0 is the correct number of the first (or only) view.

OK, as long as you don’t release it until you’re done manipulating it with OpenGL. Calling release_texture() will tell Panda that it can safely reuse the texture ID for a different texture, so if you’re still using the texture ID directly in OpenGL you’ve got a smoking gun.