{"author_name":"Cube_","cat":"LD #33","comments":[{"author_name":"","time":"August 20, 2015 4:00 am","epoch":1440061200,"text":"what about varyings?<br \/>\n varyings are shared between vertex and fragment shaders.","spam":"N"},{"author_name":"","time":"August 20, 2015 4:20 am","epoch":1440062400,"text":"The &#8220;show us the code&#8221; aspect is really only to discourage cheating.  Its not you giving people permission to *use* the code.","spam":"N"},{"author_name":"","time":"August 20, 2015 4:49 am","epoch":1440064140,"text":"Not sure what exactly you are trying to do with your shaders, but I can tell you that WebGL is virtually identical to OpenGL ES 2.0 (not 1.0). You can pass data from vertex shader to fragment shader just fine, using a varying variable (as mentioned by snooze82). It works like this:","spam":"N"},{"author_name":"CubeGod","time":"August 20, 2015 12:17 pm","epoch":1440091020,"text":"@snooze82, yes I eventually managed to dig that info up from apple&#8217;s iOS documentation of all places (about the last place I&#8217;d ever think of looking)","spam":"N"}],"epoch":1440060480,"likes":2,"metadata":{"p_key":"16542","p_author":"Cube_","p_authorkey":"504927","p_urlkey":"51831","p_title":"Fun fact: WebGL shaders are way different from GLSL shaders","p_cat":"LD #33","p_event":"LD33","p_time":"1440060480","p_likes":"2","p_comments":"4","p_status":"UPD5","us_key":"504927","us_name":"Cube_","us_username":"Cube_","event_start":"1440115200","event_key":"29","event_name":"LD33"},"text":"<p>I&#8217;m not entirely certain how I can pull data from the vertex shader into the fragment shader, after writing a quick test shader and butchering it until it worked I didn&#8217;t manage to pull vertex colors.<\/p>\n <p>But that&#8217;s fine, that&#8217;s actually fine. This works too; I just have to be a bit more peculiar about it (I WAS going to pull vertex colors as a lazy way to color sprites because that would save a huge time), if I can&#8217;t get my engine to support that I&#8217;ll just work around it.<\/p>\n <p>(webgl shaders are essentially GL ES 1.0 shaders and they don&#8217;t support in\/out or inout)<\/p>\n <p>Regardless, still in.<br \/>\n On the bright side, there&#8217;s no API I could possibly know better than that of my engine, I wrote it after all (in two days nonetheless!); it&#8217;s deceptively simple with only <del>five<\/del> four graphical functions.<\/p>\n <p>Sprites.<br \/>\n Tiles.<br \/>\n Textures (global resources set up for use by sprites, tiles and shaders).<br \/>\n Shaders.<\/p>\n <p>add simple bounding box intersection physics and a very crude SDL2 audio wrapper and you have yourself a deceptively simple engine with a potentially huge power:simplicity ration (because shaders, all the magic happens in the shader code&#8230; and it&#8217;s not that interesting, it&#8217;s really rather close to the reference implementation because the OpenGL documentation is very robust).<\/p>\n <p>Also licensing. I have to figure out if the ludum dare supports the CC-BY-NC-SA license, because when I invariably release my source code I will release it as such, it&#8217;s for people to learn from, not earn from. \ud83d\ude09<\/p>\n <p>Anywho, back to coding, if someone has a clue as to how one would solve my shader predicament that&#8217;d be lovely but in worst case I&#8217;ll just not use vertex colors, that&#8217;s fine too.<br \/>\n I need to finalize my interfaces, do a bit more unit testing and polish up my audio implementation.<\/p>","time":"August 20th, 2015 3:48 am","title":"Fun fact: WebGL shaders are way different from GLSL shaders"}