File tree Expand file tree Collapse file tree 1 file changed +6
-5
lines changed
Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -94,11 +94,12 @@ var Shader = (function() {
9494
9595 Shader . prototype . drawRect = function ( left , top , right , bottom ) {
9696 var undefined ;
97- var viewport = gl . getParameter ( gl . VIEWPORT ) ;
98- top = top !== undefined ? ( top - viewport [ 1 ] ) / viewport [ 3 ] : 0 ;
99- left = left !== undefined ? ( left - viewport [ 0 ] ) / viewport [ 2 ] : 0 ;
100- right = right !== undefined ? ( right - viewport [ 0 ] ) / viewport [ 2 ] : 1 ;
101- bottom = bottom !== undefined ? ( bottom - viewport [ 1 ] ) / viewport [ 3 ] : 1 ;
97+ // this is (t/l/r/b - viewport minx/miny/maxx/maxy) / (viewport width/hieght/hieght/width)
98+ // is top/left/right/botom always 0/0/0/0?
99+ top = top !== undefined ? top / gl . drawingBufferHeight : 0 ;
100+ left = left !== undefined ? left / gl . drawingBufferWidth : 0 ;
101+ right = right !== undefined ? right / gl . drawingBufferWidth : 1 ;
102+ bottom = bottom !== undefined ? bottom / gl . drawingBufferWidth : 1 ;
102103 if ( gl . vertexBuffer == null ) {
103104 gl . vertexBuffer = gl . createBuffer ( ) ;
104105 }
You can’t perform that action at this time.
0 commit comments