Testing X3D

Thursday March 7th, 2013By: CyrIng

1- Export the Blender source to X3D.

2- Go to the instantlabs online converter.

  • choose X3D as input encoding
  • and HTML5 as output encoding
  • past the X3D export
  • copy the encoded output in a html file

3- Give a look to the demo in our Lab, menu Projects/X3D





WebGL for WordPress

Sunday January 27th, 2013By: CyrIng

We develop a ShortCode to embed WebGL into WordPress posts.

The syntax looks like below:

  • first declare a JSON data structure
[
{ "o":"TRIANGLES"
, "v":[0.45,-0.45,-0.45,0.45,-0.45,0.45,-0.45,-0.45,0.45,-0.45,-0.45,-0.45,0.45,0.45,-0.45,0.45,0.45,0.45,-0.45,0.45,0.45,-0.45,0.45,-0.45]
, "i":[0,1,2,0,2,3,4,7,6,4,6,5,0,4,5,0,5,1,1,5,6,1,6,2,2,6,7,2,7,3,4,0,3,4,3,7]
, "c":[ [0.8, 0.8, 0.8, 0.5], [0.0, 0.3, 0.5, 0.5], [0.7, 0.7, 0.3, 0.5], [0.7, 0.3, 0.7, 0.5], [0.0, 0.5, 0.0, 0.5], [0.0, 0.6, 0.8, 0.5] ]
, "r":[1, 0, 1]
, "t":[0.0, 0.0, -2.5]
, "b":1
},
{ "o":"TRIANGLES"
, "v":[0.000000,-0.250000,-0.250000 ,0.000000,0.250000,-0.250000 ,0.048773,-0.250000,-0.245196 ,0.048773,0.250000,-0.245196 ,0.095671,-0.250000,-0.230970 ,0.095671,0.250000,-0.230970 ,0.138893,-0.250000,-0.207867 ,0.138893,0.250000,-0.207867 ,0.176777,-0.250000,-0.176777 ,0.176777,0.250000,-0.176777 ,0.207867,-0.250000,-0.138893 ,0.207867,0.250000,-0.138893 ,0.230970,-0.250000,-0.095671 ,0.230970,0.250000,-0.095671 ,0.245196,-0.250000,-0.048773 ,0.245196,0.250000,-0.048773 ,0.250000,-0.250000,-0.000000 ,0.250000,0.250000,-0.000000 ,0.245196,-0.250000,0.048773 ,0.245196,0.250000,0.048773 ,0.230970,-0.250000,0.095671 ,0.230970,0.250000,0.095671 ,0.207867,-0.250000,0.138893 ,0.207867,0.250000,0.138893 ,0.176777,-0.250000,0.176777 ,0.176777,0.250000,0.176777 ,0.138893,-0.250000,0.207867 ,0.138893,0.250000,0.207867 ,0.095671,-0.250000,0.230970 ,0.095671,0.250000,0.230970 ,0.048773,-0.250000,0.245196 ,0.048773,0.250000,0.245196 ,-0.000000,-0.250000,0.250000 ,-0.000000,0.250000,0.250000 ,-0.048773,-0.250000,0.245196 ,-0.048773,0.250000,0.245196 ,-0.095671,-0.250000,0.230970 ,-0.095671,0.250000,0.230970 ,-0.138893,-0.250000,0.207867 ,-0.138893,0.250000,0.207867 ,-0.176777,-0.250000,0.176777 ,-0.176777,0.250000,0.176777 ,-0.207868,-0.250000,0.138892 ,-0.207868,0.250000,0.138892 ,-0.230970,-0.250000,0.095671 ,-0.230970,0.250000,0.095671 ,-0.245196,-0.250000,0.048772 ,-0.245196,0.250000,0.048772 ,-0.250000,-0.250000,-0.000000 ,-0.250000,0.250000,-0.000000 ,-0.245196,-0.250000,-0.048773 ,-0.245196,0.250000,-0.048773 ,-0.230970,-0.250000,-0.095671 ,-0.230970,0.250000,-0.095671 ,-0.207867,-0.250000,-0.138893 ,-0.207867,0.250000,-0.138893 ,-0.176776,-0.250000,-0.176777 ,-0.176776,0.250000,-0.176777 ,-0.138892,-0.250000,-0.207868 ,-0.138892,0.250000,-0.207868 ,-0.095671,-0.250000,-0.230970 ,-0.095671,0.250000,-0.230970 ,-0.048772,-0.250000,-0.245196 ,-0.048772,0.250000,-0.245196]
, "i":[0,1,3 ,0,3,2 ,2,3,5 ,2,5,4 ,4,5,7 ,4,7,6 ,6,7,9 ,6,9,8 ,8,9,11 ,8,11,10 ,10,11,13 ,10,13,12 ,12,13,15 ,12,15,14 ,14,15,17 ,14,17,16 ,16,17,19 ,16,19,18 ,18,19,21 ,18,21,20 ,20,21,23 ,20,23,22 ,22,23,25 ,22,25,24 ,24,25,27 ,24,27,26 ,26,27,29 ,26,29,28 ,28,29,31 ,28,31,30 ,30,31,33 ,30,33,32 ,32,33,35 ,32,35,34 ,34,35,37 ,34,37,36 ,36,37,39 ,36,39,38 ,38,39,41 ,38,41,40 ,40,41,43 ,40,43,42 ,42,43,45 ,42,45,44 ,44,45,47 ,44,47,46 ,46,47,49 ,46,49,48 ,48,49,51 ,48,51,50 ,50,51,53 ,50,53,52 ,52,53,55 ,52,55,54 ,54,55,57 ,54,57,56 ,56,57,59 ,56,59,58 ,58,59,61 ,58,61,60 ,3,1,63 ,3,63,61 ,3,61,5 ,61,59,5 ,59,7,5 ,59,57,7 ,57,9,7 ,57,55,9 ,55,11,9 ,55,53,11 ,53,13,11 ,53,51,13 ,51,15,13 ,51,49,15 ,49,17,15 ,49,47,17 ,47,19,17 ,47,45,19 ,45,21,19 ,45,43,21 ,43,23,21 ,43,41,23 ,41,25,23 ,41,39,25 ,39,27,25 ,39,37,27 ,37,29,27 ,37,35,29 ,35,31,29 ,35,33,31 ,1,0,62 ,1,62,63 ,60,61,63 ,60,63,62 ,0,2,62 ,2,60,62 ,2,4,60 ,4,58,60 ,4,6,58 ,6,56,58 ,6,8,56 ,8,54,56 ,8,10,54 ,10,52,54 ,10,12,52 ,12,50,52 ,12,14,50 ,14,48,50 ,14,16,48 ,16,46,48 ,16,18,46 ,18,44,46 ,18,20,44 ,20,42,44 ,20,22,42 ,22,40,42 ,22,24,40 ,24,38,40 ,24,26,38 ,26,36,38 ,26,28,36 ,28,34,36 ,28,30,34 ,30,32,34]
, "c":[ [0.0, 0.3, 0.4, 1.0], [0.0, 0.3, 0.6, 0.9], [0.0, 0.3, 0.8, 0.8], [0.0, 0.3, 1.0, 0.7] ]
, "r":[1, 1, 0]
, "t":[0.0, 0.0, -2.0]
, "b":2
}
]
  • then call the function using its ShortCode
[ primitive id="canvas.01272013" height="540" width="640" style="border: 1px solid navy;" rgba="1.00, 0.9375, 0.9375, 1.0" ]

[continue]

















How To import Blender in OpenGL

Sunday January 13th, 2013By: CyrIng

 Thanks to the Assimp library, we are programming a C import of Blender Mesh.

Download the source code, make it and start it with the path to .blend file as the argument.

$ make
Compiling : Done.
Linking : Done.
Ready : ./bin/blenderGL

$ ./bin/blenderGL samples/monkey.blend

Use keys from [1] to [9] to translate;  arrows  [Begin] and [End] to rotate following the 3 axes. The [Esc] key to exit.

Don’t forget to save your Blender Mesh file using the legacy format.