DrawSprite() usage?


#1

I’m trying to draw a sprite using Rhino.Display.DrawSprite(). I’ve tried calling both the 2D and 3D overloads, and have tried many permutations of the size and blendColor options, however nothing ever seems to come up. The bitmaps and jpgs I’m using have dimensions 256 by 256 pixels.

Any ideas what could be going wrong? Alternatively, anyone have some sample code that has been verified to work?


(Dale Fugier) #2

When and where are you drawing? Hopefully it is within a conduit or a dynamic draw operation…

Example code might be helpful to see.


#3

TestBitmap.zip (414 Bytes)

I’ve attached the image file I’m using for testing.

Just to clarify, what does the “size” parameter refer to? Is it a scaling factor (eg size = 1 displays a 256x256 image at 256x256)? Or is it set so that size = 1 would only produce draw 1 pixel?

It’s in the same function as other (successful) calls to DrawLine() and DrawShadedMesh() so I’m assuming it’s in the right place?

Here is the code I’m using

DisplayBitmap displayBitmap = DisplayBitmap.Load("TestBitmap.bmp");
display.DrawSprite(displayBitmap,new Point2d(0,0),1f);

I’ve verified that it’s loading the bitmap, since if I type in the wrong path, it displays errors in the Rhino console.


(Dale Fugier) #4

Again, where are you calling DrawSprite()? In a display conduit? Can you post some sample code that we can run here that reproduces the problem>