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

RE: [Public WebGL] y-orientation for texImage2D from HTML elements



Could you please explain why you think this “bottom left” label is relevant when rendering to a texture?

 

Thanks,

Georg

 

From: Florian Bösch [mailto:pyalot@gmail.com]
Sent: 07 December 2012 17:24
To: Georg Kolling
Cc: Mark Callow; Jeff Gilbert; Gregg Tavares (
社用); public webgl
Subject: Re: [Public WebGL] y-orientation for texImage2D from HTML elements

 

Nevertheless 0,0 is bottom left on a framebuffer given the same viewport definition.

 

On Fri, Dec 7, 2012 at 6:09 PM, Georg Kolling <Georg.Kolling@imgtec.com> wrote:

My point is that physical orientation is meaningless until you map data existing in an abstract coordinate space (such as window space or texture space) to an output device, because physical orientation (top/bottom, left/right) can only be interpreted relative to an observer.

When rendering to a texture there is no output device involved and thus no physical orientation.

 

The only (slight) exception from that is the concept of front- and back-facing based on “clockwise” and “counterclockwise” winding order of vertices. However, even those terms can be defined  purely mathematically without reference to physical orientation of window space.

 

Regards,

Georg

 

From: Florian Bösch [mailto:pyalot@gmail.com]
Sent: 07 December 2012 16:56


To: Georg Kolling
Cc: Mark Callow; Jeff Gilbert; Gregg Tavares (

社用); public webgl


Subject: Re: [Public WebGL] y-orientation for texImage2D from HTML elements

 

Nevertheless bottom/left is 0,0 on FBOs not top/left.

 

On Fri, Dec 7, 2012 at 5:52 PM, Georg Kolling <Georg.Kolling@imgtec.com> wrote:

When you render to a texture the origin is the origin.

 

That is, the origin in window space is mapped to the origin in texture space, and the positive X and Y directions are aligned with the positive S and T directions.

 

There is a single set of (texture coordinates, window coordinates), or if you want to take a step back, a single set of (texture coordinates, normalized device coordinates) to map the texture space origin to the window space origin.

 

Regards,

Georg

 

From: Florian Bösch [mailto:pyalot@gmail.com]
Sent: 07 December 2012 15:59
To: Georg Kolling
Cc: Mark Callow; Jeff Gilbert; Gregg Tavares (
社用); public webgl


Subject: Re: [Public WebGL] y-orientation for texImage2D from HTML elements

 

On Fri, Dec 7, 2012 at 4:31 PM, Georg Kolling <Georg.Kolling@imgtec.com> wrote:

In my opinion the fault here lies with the GL specification which incorrectly applies a physical orientation to an abstract coordinate space.

 

In reality TexImage2D accepts pixel data in “origin-first, S-major (S-increasing, T-increasing)” order. The first pixel passed, at the memory address given, is taken to be at (or near) the texture space origin. Each row of pixels form a line along the positive S axis, and subsequent rows are located at increasing T.

Physical orientation has no meaning in an abstract coordinate space such as texture space. Positive T direction is neither “up” nor “down” (or left-right, front-back, north-south, you get the idea).

If you take the description above, i.e. “origin-first” it immediately becomes clear that if you want to preserve the origin location, HTML elements with their origin in the top-left corner should be passed to TexImage2D top-left corner first.

Regards,

Georg

When you render to a texture the origin is bottm/left not top/left. If you're serious about origin preservation such as not to end up with cases where there is no right UV set anymore or you render things upside down variably, you upload with origin bottom/left not top/left. Alternatively you fix glViewport, glScissors, FBOs, to have origin top/left such that you'll not have to render things upside down and can apply one set of UV coords regardless.