Roku Developer Program

Join our online forum to talk to Roku developers and fellow channel creators. Ask questions, share tips with the community, and find helpful resources.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
jlim
Visitor

texture mapping?

I am new to the Roku developer program. I'm having trouble seeing if I can texture map an image with the Roku BrightScript SDK. I would like to animate a card from a deck of playing cards turning over, like in a game of 21. I can't find an image buffer to access to change pixel values to set a pixel value or draw a line. Is there a way to do so with BrightScript? Perhaps I need to use a different SDK?

Jon
0 Kudos
3 REPLIES 3
MazeWizzard
Visitor

Re: texture mapping?

First off, try the advanced functions in the 2D API, like DrawPolygon() and FillPolygon(). Then move into texture mapping with Plot() in an ultra-fast mapping algorithm (that you'd have to write).

Oh wait. Wrong API. Nope. No such in the SDK. Maybe the NDK. Search for posts about that.

However, you can make use of bitmaps in the SDK. Think of it like an animated GIF where each frame is a subset of the whole thing. There are animated sprite routines that will even animate the sprite frame changes for you if you wish. That may help. It's more or less pre-rendered that way.

You can simulate a Plot() by drawing a line with the same start and end points. Slow though. I managed a FillPolygon() routine that was about 30ms for a medium sized arbitrary polygon. It was basically rasterized. However, only single color. IDK what would happen on a point-by-point basis but it wouldn't be pretty (well, wouldn't be quick).

So basically, pre render stuff and then blit it to the screen. See the sprite and compositor stuff in the 2D API. This is all normally done in a drawing loop that redraws the entire screen every frame for double buffered screens. But could be an overlay too I guess.
0 Kudos
Trevor
Visitor

Re: texture mapping?

A card flip animation could be done by scaling the width down on the graphic of the back side of the card, and then switch the graphic to the front side of the card and scale the width back up. Animated that would appear as if the card were flipping.
*** Trevor Anderson - bloggingwordpress.com - moviemavericks.com ***
0 Kudos
jlim
Visitor

Re: texture mapping?

Thank you very much for the responses. I will need quite some time to look into them.
0 Kudos