Kyle Alexander Buan
unread,Sep 8, 2013, 6:32:10 AM9/8/13Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to alche...@googlegroups.com
I didn't try every function, but yes, it worked correctly.
Except, that if M3G is used by a program, and that program exited,
then running that program again says that: "M3G is used by another
process," though it is not.
Rephrase: When a program that uses M3G exits, we cannot use M3G again.
We have to restart Alchemy OS.
Here's my program: (sorry, I was in a hurry when I did this)
use "ui"
use "canvas"
use "m3g"
use "sys"
def main(a: [String]) {
var vposa = [
-1, -1, 1, 1, -1, 1, -1, 1, 1, 1, 1, 1, -1, -1, -1,
1, -1, -1, -1, 1, -1, 1, 1, -1 ]
var vpos = new [Byte](24)
for (var i=0, i<vposa.len, i+=1) vpos[i] = vposa[i]
var tind = [ 0, 1, 2, 3, 7, 1, 5, 4, 7, 6, 2, 4, 0, 1 ]
var vb = new VertexBuffer()
var vp = new VertexArray(vpos.len/3, 3, 1)
vp.set(0, vpos.len/3, vpos)
vb.setPositions(vp, 1.0f, null)
var tsa = new TriangleStripArray(tind, [tind.len])
var cam = new Camera()
var can = new Canvas(false)
ui_set_screen(can)
var cg = can.graphics()
cam.setPerspective(30.0f,
can.width.cast(Float)/can.height.cast(Float), 1.0f, 1000.0f)
var ct = new Transform()
ct.postTranslate(0f, 0f, 10.0f)
m3g_setCamera(cam, ct)
m3g_bindTarget(cg)
m3g_clear(null)
m3g_render(vb, tsa, new Appearance(), null)
m3g_releaseTarget()
can.refresh()
sleep(5000) }