Making a Card from a 3D object


I’m trying to build a game that has an UI with models that can be drag and dropped into the stage. I already built this, using DirectGUI. Howecer, when I parent the models in my “sidebar”, I get 2D representations of my models.

I thought that I could use a TextureBuffer to create a card that shows my object in the sidebar, in 3D.

Here’s the code:

# A parent node of all the "3D models" in my sidebar
self.theParent = self.parentDirectFrame.attachNewNode("models")
delta = 0
for m in models:
    # start the buffer"Another Scene", 800,600)
    # load the model and parent it to the buffer's scene                    
    model = loader.loadModel(m)
    # get a card with what should be IMO the 3D representation of the model        
    delta = delta - 1.5

If anyone knows the right approach or if I’m not making myself clear about my problem, thanks!

Got it!. The solution was creating my own card and using TextureBuffer’s getTexture. For some weird reason when I tried to use getTextureCard, I got again the 2D representation.

However I’m getting the following problem:

As you can see, the scene that is used for each card has the same grey background as my main scene. (BTW, all the cards are together so they appear as if they were only one huge card).

How can I change the background, so the sidebar does look nice? Is there an equivalent for base.setBackgroundColor in this case?


Use setClearColor on the buffer to set the ‘background’ color.