[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Public WebGL] HI-DPI displays and WebGL issues




On 20/06/2012, at 11:11 AM, Gregg Tavares (çç) wrote:

This brings up a bunch of new questions

What should this do?

   gl.texImage2D(......, canvas) 

For compatibility it should upload a CSS pixel version of the canvas. 

There likely is less WebGL content that would be broken if you chose to return device pixels here, but for consistency CSS pixels seems like the right thing.

In general I'm not a fan of auto-doubling the backing store. It gets very confusing. The user needs to detect a bunch of things before knowing what will happen. With WebGL it gets even more tricky - what should MSAA do? Produce 16x the backing store?


Possibly we could add a gl.pixelStorei parameter like gl.UNPACK_USE_HI_RESOLUTION_WEBGL or something if you want the full res backing store?

Similarly the same thing applies to the img tag.  I don't know what the final img tag spec will be but regardless if you functionally have this

    <img alt="image description" src="" srcset="/path/to/otherimage.png 2x">

       gl.texImage2D(......, img) 
   
Which image do you get, "image.png" or "otherimage.png", and at what size?  Do we need a new API to handle that case? Or at least a way of querying either the size you're going to get or the size you got

    img.getActualWidth
    img.getActualHeight

or

    gl.getTexLevelParameteri(gl.TEXTURE_2D, level, GL_TEXTURE_LEVEL_DIMENSIONS);

or both

Thoughts?

Yep, these are all very good points. There is some urgency to these questions - both for 2d canvas, 3d canvas and img elements.

Dean