Creating a dice in code?

Blitz3D Forums/Blitz3D Programming/Creating a dice in code?

Not Available(Posted 2003) [#1]
Hi all,

This seems like such a newbie question, however I'll ask it anyhow; how does one create a dice with the numbers textured on each face in Blitz 3D code only (ie. starting from createcube, how do you texture each face individually)?

Kind Regards to everyone,
-R


puki(Posted 2003) [#2]
I'm a newbie too, but I assume you could simply create a cube and then cube map the numbers onto it - "X"'s being the faces
X
XXXX
X


Not Available(Posted 2003) [#3]
How do you cube map the numbers onto it in code?

ie.
dim side(6)
for a=1 to 6
side(a)=createtexture(128,128)
setbuffer texturebuffer(side(a)
s$=str(a)
text (128-stringwidth(s$))/2,(128-stringheight(s$))/2,s$
************* WHAT COMMAND GOES HERE TO PLACE THE
************* TEXTURE ON SIDE N OF THE CUBE
next


puki(Posted 2003) [#4]
I might be greatly leading you astray but, have a look at the help documention for "SetCubeFace"


puki(Posted 2003) [#5]
I suppose you could also probably create your cube out of 6 flat sides and texture each one individually and then calculate them together to make a cube - I only mentioned cube mapping as it is the new thing Blitz can do - it may not be the most efficient - you best wait for help from someone who knows their stuff - I'm no expert


Ross C(Posted 2003) [#6]
You could use cube-mapping. I suppose that's what you doing above. Basically cube mapping is one texture with six frames in it. so createtexture (768,128) and don't forget to put the cube mapping flag in. Your probably better create 6 quads and texturing each of them, and arranging them in a box shape. OR, create a texture with all six sides on it, and manually adjust the uv co-ords of each vertex so that the texture fits correctly.

Or, and final or, Create your cube in a modelling program, and uv map it yourself, saving alot of cding :D


puki(Posted 2003) [#7]
SirRicho - I would go for the first two options as the modelling one is a bit of a cop-out versus learning to code it - as you can still model it anway if you can't code it.


Not Available(Posted 2003) [#8]
Nevermind... I've done it... I'm using vondermans physics stuff and having a play, I pivoted 6 cubes to the ODE mesh that gets created...

-R


Koriolis(Posted 2003) [#9]
Just a note to say that cube mapping has nothing to do with that. Cube mapping doesn't mean mapping textures onto a cube (or else we would also need, tetraedron mapping, pyramid mapping, or whateve mapping, that would be funny :) )
Standard mapping is what you want here.


Ross C(Posted 2003) [#10]
Yeah, but it's a cheap way to get around it. set the cube mapping mode to static and you've got a mapped cube :)


bradford6(Posted 2003) [#11]
while you could do this in code, the best way to do this is to use unwrap3d to unwrap a cube mesh and paint the 6 sides on a single texture...

I just did it. the new unwrap3d has a cube primitive built in www.unwrap3d.com


Rook Zimbabwe(Posted 2004) [#12]
I painted up a quick dice code... Trying to link the image here:



Use it or abuse it. I wouldn't mind a nod in the thanks you page! : )


Rook Zimbabwe(Posted 2004) [#13]
Hmmm well that didn't seem to work. The "properties should tell you what to hit in your browser and ANYONE that feels like telling me what i did wrong feel free to hit me!


Rook Zimbabwe(Posted 2004) [#14]
Ah... here is it:



Rook Zimbabwe(Posted 2004) [#15]
Last Time I promise... I copied the FAQ code exactly and moved the image to the http directory



I hope that works


Deldy(Posted 2004) [#16]
Well could you not use: SetSurface to something? Just a sugestion


puki(Posted 2004) [#17]
Wow! This brings back memories - this is my first ever post in the forums - "Not Available" was "SirRicho" - he seems to have gone now.

This is kind of like going back to the first house you ever lived in. Anybody want to buy it?