WebGL:WordPress
From Wiki.cyring.fr
(Difference between revisions)
Cyril (Talk | contribs)
(Page créée avec « === functions.php === <syntaxhighlight lang="php" line start="1"> <?php function gPrimitive( $atts ) { extract(shortcode_atts(array( 'gid' => '', 'style' => '', 'w... »)
Newer edit →
(Page créée avec « === functions.php === <syntaxhighlight lang="php" line start="1"> <?php function gPrimitive( $atts ) { extract(shortcode_atts(array( 'gid' => '', 'style' => '', 'w... »)
Newer edit →
Revision as of 08:47, 2 February 2013
functions.php
<?php
function gPrimitive( $atts ) {
extract(shortcode_atts(array(
'gid' => '',
'style' => '',
'width' => '640',
'height'=> '540',
'rgba' => '0.0, 0.0, 0.0, 1.0'), $atts));
$output = '<script type="text/javascript" src="' . get_stylesheet_directory_uri() . '/glMatrix-min.js"></script>'
. '<script type="text/javascript" src="' . get_stylesheet_directory_uri() . '/webgl-utils.js"></script>'
. '<script type="text/javascript" src="' . get_stylesheet_directory_uri() . '/primitive.js"></script>';
$main = '<script type="text/javascript">'
. 'main("' . $gid . '",' . $rgba . ');'
. '</script>';
$output = sprintf( '%s<canvas id="%s" style="%s" width="%s" height="%s"></canvas>%s',
$output, $gid, $style, $width, $height, $main );
return($output);
}
?>