How to render to bitmap??

Hi ,all.
I have some question.
I had read tutorial “Render to texture” and I got it very well.

Now I want to render it to bitmap (in a blue border) like a picture below.

I tried to find out but it no use…
Help me please and give me some code…
Thank you!! :slight_smile:

If your goal is to have an avatar view in the corner, just apply the texture you are rendering to as an ordinary texture to a polygon you attach to aspect2d.

No need to make an external bitmap image in this case. For your purposes, a texture is a bitmap.

Though as far as that goes, if you’re just applying the texture to a square polygon, you don’t even need to use render-to-texture. Instead of going through all this trouble, you can just create a DisplayRegion that corresponds to the little square in the corner for your avatar view, and render directly to that DisplayRegion.

David

sorry , i want to create avatar view like this. it 's a character status
i read answer by drwr and have some question.
i want create a DisplayRegion and render face of player into avatar frame
now , i try it . i made new scene and showed it by some code
base.bufferViewer.toggleEnable()

please , give me some code about create and render to DisplayRegion and i will apply it

thank you

:astonished:

Try this:

c2 = base.makeCamera(base.win, sort = 10, displayRegion = (0, 0.25, 0, 0.25))

Now c2 is a new camera that renders into the lower-left corner of your screen. You can point c2 wherever you like. Depending on the nature of your avatar-view, you might want to clear the rectangle it is drawing into:

c2.node().getDisplayRegion(0).setClearDepthActive(1)
c2.node().getDisplayRegion(0).setClearColorActive(1)
c2.node().getDisplayRegion(0).setClearColor(VBase4(0.1, 0.1, 0.3, 1))

David