Can we draw alpha image in viewport
-
Hey,
I want to draw images with alpha in viewport, but what I got is a image with black bg, I already test
DrawTextureflagDRAW_ALPHA_NORMAL_FROM_IMAGEandDRAW_ALPHA_FROM_IMAGE, they will not work.Can I draw bitmaps with alpha in viewport, like the little icon under the mouse?
Cheers~
DunHou -
Hey @Dunhou,
Can you please share code and possibly a bug report? Alphas with
DrawTexturehave a troubled history but when I tried in the py-ocio_node_2025 example right now, it works for me.Cheers,
FerdinandResult
We draw the little cube icon with alphas next to the existing drawing examples.

Code
I just added the highlighted code in the
py-ocio_node_2025example.

# Draw the texture and a label for the flag below it. bd.DrawTexture(self._bitmap, points, texColors, texNormals, texUVs, 4, c4d.DRAW_ALPHA_NORMAL, flags) # --- new code: start --- icon: c4d.bitmaps.BaseBitmap | None = c4d.bitmaps.InitResourceBitmap(c4d.Ocube) if icon: points: list[c4d.Vector] = [ c4d.Vector(xb, ya, 0), c4d.Vector(xb + 20, ya, 0), c4d.Vector(xb + 20, ya + 20, 0), c4d.Vector(xb, ya + 20, 0) ] bd.DrawTexture(icon, points, texColors, texNormals, texUVs, 4, c4d.DRAW_ALPHA_NORMAL, flags) # --- new code: end --- bd.DrawHUDText(xa, yb, "USE_PROFILE_COLOR" if isProfile else "NONE")edit: I made my changes part of the official code example, as I thought it does not hurt to show that there too.
-
Sorry for my stupid question @ferdinand , I should use
c4d.DRAW_ALPHA_NORMALbut notc4d.DRAW_ALPHA_FROM_IMAGE.Shame on me

Cheers~
DunHou -
I do not think that
DRAW_ALPHA_FROM_IMAGEshould not work. I just pickedDRAW_ALPHA_NORMALbecause it is the "most default one" out of theDRAW_ALPHAflags. I will have a look later. But you can for now probably just useDRAW_ALPHA_NORMAL.