gl_FragCoord is larger than the window size - Using Cinder

文章推薦指數: 80 %
投票人數:10人

And you could remove all the resize code and passing any uniforms to the shader since everything is now in the 0..1 range, regardless of window size. gl_FragCoordislargerthanthewindowsize UsingCinder skmhrk1209 October7,2020,4:47pm #1 Hello, IwroteasimpleGLSLvertexandfragmentshaderasfollows: #version150 uniformmat4ciModelViewProjection; invec4ciPosition; voidmain() { gl_Position=ciModelViewProjection*ciPosition; } #version150 uniformvec2uResolution; outvec4oFragColor; voidmain() { oFragColor=vec4(vec3(gl_FragCoord.xuniform("uResolution",ci::vec2(getWindowSize())); } } So,Ithinktheresultwouldbeawhiterectangle,butIgot: result1504×1228100KB Doesanyoneknowwhythegl_FragCoordislargerthanthewindowsize? lithium October7,2020,11:30pm #2 Iwouldexpectthattobeallblackasopposedtoallwhitesincegl_FragCoord.xwouldalwaysbeuniform("uResolution",ci::vec2(app::toPixels(getWindowSize()))); 2Likes skmhrk1209 October8,2020,3:50pm #6 ci::app::toPixelsworkswell. Gotit!Thankyou! seph October8,2020,7:08pm #7 fyiIthinkthereisadefaultciWindowSizeuniformthatCinderprovides. 2Likes



請為這篇文章評分?