avrudoi Posted June 5, 2014 Share Posted June 5, 2014 good day at the problem with the javascript code that I need to run. the code should draw two lines, but why not draw. here's the code, please help if you can.<!DOCTYPE html><html><head lang="en"> <meta charset="UTF-8"> <title></title></head><body><canvas id = 'MyCanvas' width = 512 height = 384></canvas><script type="text/javascript"> </script><script>var canvas = document.getElementById('MyCanvas');var ctx = canvas.getContext('2D');ctx.beginPath();ctx.moveTo(20,20);ctx.lineTo(470, 20);ctx.lineTo(20, 470);ctx.fill();</script></body></html> Quote Link to comment Share on other sites More sharing options...
Temechon Posted June 5, 2014 Share Posted June 5, 2014 Hello again my dear english-friendly user, This forum is dedicated to Babylon.js in particular, and not webgl.Moreover, if you display the console of your browser (F12 on IE, chrome and Firefox) and look at the errors, you will find this one : Uncaught TypeError: Cannot read property 'beginPath' of null Try this : var ctx = canvas.getContext("2d");Next time, try to post your question in the good forum Kilombo 1 Quote Link to comment Share on other sites More sharing options...
avrudoi Posted June 5, 2014 Author Share Posted June 5, 2014 thank you for the code, could you me tell yet where the error doesn't work anyway and to tell you where we can discuss about such errors. Please. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.