Texture a random shape.

Blitz3D Forums/Blitz3D Beginners Area/Texture a random shape.

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

You may find using sprites is the easiest (check out the 'Sprite' commands in the Blitz3D help - hit F2 or F1 twice in the default IDE, I think!). Sprites are flat 3D entities and are square in shape, but your texture can always contain transparent areas to create the look of more complex objects - depends what you need. They are easy to use and can be set (default) to always face the camera (you always need a camera and lights to view 3D objects).

However, creating your own quads is more flexible and faster (but more complicated). Check out this code I found by quickly looking in the code archives. I am not saying these are the best for you, but they look ok from a quick read through and you should be able to modify for your own needs. If all you need is a square, you only need 4 vertices and 2 triangles (a quad).

http://www.blitzbasic.com/codearcs/codearcs.php?code=463

http://www.blitzbasic.com/codearcs/codearcs.php?code=382

I learnt an awful lot by studying other peoples code, so always worth browsing the archives (and forums). 3D is a big topic, I am still learning after having Blitz3D for nearly 2 years!

Have fun,
Rhy

EDIT: Oh, and once you have your quad or sprite, you will apply your texture to it using EntityTexture. You will need to store handle of the quad or sprite in a variable which you pass to EntityTexture (see Blitz help). You can adjust texture position using UV coordinates (do a search, I am sure you find exisiting info on this).