This is my first time with html and javascript , I need simply to open an html file triangle.html . I wrote the code in a txt editor then I saved it in .html. Html file and js file are in the same folder. When I double click on triangle.html it opens mi default browser but on the page there is only the same code that I wrote. I should see a big red triangle...
Here it is the code I wrote :
<!DOCTYPE html>
<html>
<head>
<script id="vertex-shader" type="x-shader/x-vertex">
attribute vec4 vPosition;
void main(){
gl_Position = vPosition;
}
</script>
<script id="fragment-shader" type="x-shader/x-fragment">
precision mediump float;
void main(){
gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
}
</script>
<script type="text/javascript" src="Users/Rubio/Desktop/angelCommon/webgl-utils.js"></script>
<script type="text/javascript" src="Users/Rubio/Desktop/angelCommon/initShaders.js"></script>
<script type="text/javascript" src="Users/Rubio/Desktop/angelCommon/MV.js"></script>
<script type="text/javascript" src="Users/Rubio/Desktop/angelCommon/triangle.js"></script>
</head>
<body>
<canvas id="gl-canvas" width="512" height="512">
Oops ... your browser doesn't support the HTML5 canvas element
</canvas>
</body>
</html>
Aucun commentaire:
Enregistrer un commentaire