Can't load image before init canvas #25

Closed
finscn opened this Issue Oct 9, 2012 · 2 comments

Projects

None yet

3 participants

@finscn
Contributor
finscn commented Oct 9, 2012

if I load some images before get the canvas and context , sometimes the image will be blank.

example

var ima=new Image()
img.src="a.png"
img.onload=function(){
ctx.drawImage(img,0,0)
}

var canvas=document.getElementById("canvas")
var ctx=canvas.getContext("2d")

there are no error,no warning,but can't display the image

@phoboslab
Owner

Yep, see the documentation.

This should probably be fixed in the long run. Maybe by allowing to re-size the canvas element after getting the context and creating a default context before the index.js is executed. I'll look into it.

@nmtitov
nmtitov commented Nov 7, 2012

this should be written with huge red letters on the very first doc page

@phoboslab phoboslab added a commit that closed this issue Nov 14, 2012
@phoboslab Fix #25 - create the GL context as soon as the App starts, so that te…
…xtures can be loaded without a ScreenCanvas
7ad9728
@phoboslab phoboslab closed this in 7ad9728 Nov 14, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment