<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Recent changes to Shader Functions</title><link>https://sourceforge.net/p/arcanfe/wiki/Shader%2520Functions/</link><description>Recent changes to Shader Functions</description><atom:link href="https://sourceforge.net/p/arcanfe/wiki/Shader%20Functions/feed" rel="self"/><language>en</language><lastBuildDate>Wed, 24 Oct 2012 15:19:00 -0000</lastBuildDate><atom:link href="https://sourceforge.net/p/arcanfe/wiki/Shader%20Functions/feed" rel="self" type="application/rss+xml"/><item><title>WikiPage Shader Functions modified by Björn Ståhl</title><link>https://sourceforge.net/p/arcanfe/wiki/Shader%2520Functions/</link><description>&lt;pre&gt;--- v12
+++ v13
@@ -3,7 +3,7 @@
 [image_shader] | vid, shader_id | | Change the active shader of the specified VID.
 [mesh_shader] | vid, shader_id, slot | | Associate a shader for the specified mesh slot.
 [build_shader] | vshdr, fshdr, label | shader_id | 
-[shader_uniform] | |shader_id, symbol, fmtstr, persist, ... | Define a value for the *symbol* slot uniform in the specifed shader, using a *fmtstr* to define how the variadic arguments at the end should map.
+[shader_uniform] | shader_id, symbol, fmtstr, persist, ... | | Define a value for the *symbol* slot uniform in the specifed shader, using a *fmtstr* to define how the variadic arguments at the end should map.
 
 ------
 About
&lt;/pre&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Björn Ståhl</dc:creator><pubDate>Wed, 24 Oct 2012 15:19:00 -0000</pubDate><guid>https://sourceforge.netd338f5aec27a1fd9a3061205aed2d22127249f0c</guid></item><item><title>WikiPage Shader Functions modified by Björn Ståhl</title><link>https://sourceforge.net/p/arcanfe/wiki/Shader%2520Functions/</link><description>&lt;pre&gt;--- v11
+++ v12
@@ -3,7 +3,7 @@
 [image_shader] | vid, shader_id | | Change the active shader of the specified VID.
 [mesh_shader] | vid, shader_id, slot | | Associate a shader for the specified mesh slot.
 [build_shader] | vshdr, fshdr, label | shader_id | 
-[shader_uniform] |shader_id, symbol, fmtstr, persist, ... | Define a value for the *symbol* slot uniform in the specifed shader, using a *fmtstr* to define how the variadic arguments at the end should map.
+[shader_uniform] | |shader_id, symbol, fmtstr, persist, ... | Define a value for the *symbol* slot uniform in the specifed shader, using a *fmtstr* to define how the variadic arguments at the end should map.
 
 ------
 About
&lt;/pre&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Björn Ståhl</dc:creator><pubDate>Wed, 24 Oct 2012 15:18:43 -0000</pubDate><guid>https://sourceforge.net6c58480b41953dcf1e127077c38045b57b3d9573</guid></item><item><title>WikiPage Shader Functions modified by Björn Ståhl</title><link>https://sourceforge.net/p/arcanfe/wiki/Shader%2520Functions/</link><description>&lt;pre&gt;--- v10
+++ v11
@@ -1,7 +1,9 @@
-Available Functions
----
-[image_shader] [mesh_shader] [build_shader] [shader_uniform]
-
+function | args | returns | description
+-------- | ---- | ------- | -----------
+[image_shader] | vid, shader_id | | Change the active shader of the specified VID.
+[mesh_shader] | vid, shader_id, slot | | Associate a shader for the specified mesh slot.
+[build_shader] | vshdr, fshdr, label | shader_id | 
+[shader_uniform] |shader_id, symbol, fmtstr, persist, ... | Define a value for the *symbol* slot uniform in the specifed shader, using a *fmtstr* to define how the variadic arguments at the end should map.
 
 ------
 About
&lt;/pre&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Björn Ståhl</dc:creator><pubDate>Wed, 24 Oct 2012 15:18:27 -0000</pubDate><guid>https://sourceforge.net0af856e7f83fb603c5ccc47e75e5618978a1772e</guid></item><item><title>WikiPage Shader Functions modified by Björn Ståhl</title><link>https://sourceforge.net/p/arcanfe/wiki/Shader%2520Functions/</link><description>&lt;pre&gt;--- v9
+++ v10
@@ -26,6 +26,7 @@
 Shaders have their own shared namespace that is handled a bit differently from VIDs and AIDs. For one is that there is a compile-time defined upper limit and that each compiled tuple of programs are associated with both a unique text label and an ID. A shader that have been built stays allocated for the remainder of the program lifespan.
 
 A call to [build_shader] such as:
+
 ~~~~
     shid = build_shader( vertprogram, fragprogram, "background");
 ~~~~
&lt;/pre&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Björn Ståhl</dc:creator><pubDate>Fri, 06 Jul 2012 09:31:46 -0000</pubDate><guid>https://sourceforge.net9e58bb9a72d3febb7b7c3f0de27929adc0c43653</guid></item><item><title>WikiPage Shader Functions modified by Björn Ståhl</title><link>https://sourceforge.net/p/arcanfe/wiki/Shader%2520Functions/</link><description>&lt;pre&gt;--- v8
+++ v9
@@ -60,6 +60,7 @@
 texcoord   | per vertex texture coordinate
 
 The default fragment shader (version 120) for the 2D pipeline looks like this: 
+
 ~~~~
 uniform sampler2D map_diffuse;
 varying vec2 texco;
&lt;/pre&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Björn Ståhl</dc:creator><pubDate>Fri, 06 Jul 2012 09:31:30 -0000</pubDate><guid>https://sourceforge.net2da72e5b3ad813e8b132981823e1bbe5ec64d267</guid></item><item><title>WikiPage Shader Functions modified by Björn Ståhl</title><link>https://sourceforge.net/p/arcanfe/wiki/Shader%2520Functions/</link><description>&lt;pre&gt;--- v7
+++ v8
@@ -59,8 +59,7 @@
 color      | per vertex color
 texcoord   | per vertex texture coordinate
 
-The default fragment shader (version 120) for the 2D pipeline looks like this (unset samplers default to 0, the first texture unit):
-
+The default fragment shader (version 120) for the 2D pipeline looks like this: 
 ~~~~
 uniform sampler2D map_diffuse;
 varying vec2 texco;
@@ -72,8 +71,7 @@
     gl_FragColor = col;
 }
 ~~~~
-
-The default vertex shader for the 2D pipeline looks like this:
+(unset samplers default to 0, the first texture unit). The default vertex shader for the 2D pipeline looks like this:
 
 ~~~~
 uniform mat4 modelview;
&lt;/pre&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Björn Ståhl</dc:creator><pubDate>Fri, 06 Jul 2012 09:31:14 -0000</pubDate><guid>https://sourceforge.net1dac5eee5266a1f36cfa36e3a7ae83e9ba5affe9</guid></item><item><title>WikiPage Shader Functions modified by Björn Ståhl</title><link>https://sourceforge.net/p/arcanfe/wiki/Shader%2520Functions/</link><description>&lt;pre&gt;--- v6
+++ v7
@@ -60,6 +60,7 @@
 texcoord   | per vertex texture coordinate
 
 The default fragment shader (version 120) for the 2D pipeline looks like this (unset samplers default to 0, the first texture unit):
+
 ~~~~
 uniform sampler2D map_diffuse;
 varying vec2 texco;
@@ -73,6 +74,7 @@
 ~~~~
 
 The default vertex shader for the 2D pipeline looks like this:
+
 ~~~~
 uniform mat4 modelview;
 uniform mat4 projection;
&lt;/pre&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Björn Ståhl</dc:creator><pubDate>Fri, 06 Jul 2012 09:30:34 -0000</pubDate><guid>https://sourceforge.net006047661c7ac107b51684bac689563c3284ab07</guid></item><item><title>WikiPage Shader Functions modified by Björn Ståhl</title><link>https://sourceforge.net/p/arcanfe/wiki/Shader%2520Functions/</link><description>&lt;pre&gt;--- v5
+++ v6
@@ -32,9 +32,9 @@
 
 would try and compile vertprogram and fragprogram into a shader tagged as 'background'. The resulting SHID can then be used with the [image_shader] [build_shader] and [shader_uniform] functions.
 
-The shader compilation step depends on the quality of the compiler in the graphics drivers or GL libraries (e.g. MesaGL) and can be a source of much headache. Having GDebugger &lt;http://www.gremedy.com&gt; or similar tools ready for debugging purposes is recommended as they can fail for very subtle reasons and error messages aren't always helpful. 
+The shader compilation step depends on the quality of the compiler in the graphics drivers or GL libraries (e.g. MesaGL) and can be a source of much headache. Having GDebugger &lt;http://www.gremedy.com&gt; or similar tools ready for debugging purposes is recommended as they can fail for very subtle reasons and error messages aren't always helpful. Keep in mind that there is a full C- style preprocessor part in every GLSL shader (e.g. #define, #ifdef, all work ...) 
 
-There are a few formalized ways of passing data to/between shaders, e.g. varying and uniform variables and there are a few hard-coded symbols that Arcan will try and look for, and update whenever relevant. 
+There are a few formalized ways of passing data to/between shaders, e.g. attributes and uniform variables and there are a few hard-coded symbols that Arcan will try and look for, and update whenever relevant. 
 
 User-defined uniforms can be set and manipulated through the [shader_uniform] function.
 
@@ -50,12 +50,41 @@
 timestamp      | int     | current monotonic time value
  
 
-Arcan-defined varyings (will be set if used by shader, vertex and texcoord will almost always be needed):
+Arcan-defined attributes (will be set if used by shader, vertex and texcoord will almost always be needed):
 
-Varying  | Use
--------- | ------------------
-vertex   | object space vertex values
-normal   | object space normal
-color    | per vertex color
-texcoord | per vertex texture coordinate
+Attributes | Use
+--------   | ------------------
+vertex     | object space vertex values
+normal     | object space normal
+color      | per vertex color
+texcoord   | per vertex texture coordinate
 
+The default fragment shader (version 120) for the 2D pipeline looks like this (unset samplers default to 0, the first texture unit):
+~~~~
+uniform sampler2D map_diffuse;
+varying vec2 texco;
+uniform float obj_opacity;
+
+void main(){
+    vec4 col = texture2D(map_diffuse, texco);
+    col.a = col.a * obj_opacity;
+    gl_FragColor = col;
+}
+~~~~
+
+The default vertex shader for the 2D pipeline looks like this:
+~~~~
+uniform mat4 modelview;
+uniform mat4 projection;
+
+attribute vec2 texcoord;
+attribute vec4 vertex;
+
+varying vec2 texco;
+
+void main()
+{
+    texco = texcoord;
+    gl_Position = (projection * modelview) * vertex;
+}
+~~~~
&lt;/pre&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Björn Ståhl</dc:creator><pubDate>Fri, 06 Jul 2012 09:30:06 -0000</pubDate><guid>https://sourceforge.nete6cc01e3527f906a0b289463f951322dd4c334a1</guid></item><item><title>WikiPage Shader Functions modified by Björn Ståhl</title><link>https://sourceforge.net/p/arcanfe/wiki/Shader%2520Functions/</link><description>&lt;pre&gt;--- v4
+++ v5
@@ -50,9 +50,12 @@
 timestamp      | int     | current monotonic time value
  
 
+Arcan-defined varyings (will be set if used by shader, vertex and texcoord will almost always be needed):
+
 Varying  | Use
-----------------------------
+-------- | ------------------
 vertex   | object space vertex values
 normal   | object space normal
 color    | per vertex color
 texcoord | per vertex texture coordinate
+
&lt;/pre&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Björn Ståhl</dc:creator><pubDate>Fri, 06 Jul 2012 09:15:34 -0000</pubDate><guid>https://sourceforge.neta4683449af4ccf47564354c1070c637873e7eb22</guid></item><item><title>WikiPage Shader Functions modified by Björn Ståhl</title><link>https://sourceforge.net/p/arcanfe/wiki/Shader%2520Functions/</link><description>&lt;pre&gt;--- v3
+++ v4
@@ -41,7 +41,7 @@
 Arcan-defined uniforms (will be set if used by shader):
 
 Uniform        | Kind    | Use
-----------------------------
+-------------- | ------- | ----------------------------------------
 modelview      | matr4x4 | object-&gt;eye transform. 
 projection     | matr4x4 | eye(camera) -&gt; clip transform. 
 texturem       | matr4x4 | not in use currently.
&lt;/pre&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Björn Ståhl</dc:creator><pubDate>Fri, 06 Jul 2012 09:09:00 -0000</pubDate><guid>https://sourceforge.netb21202b99139f24c66fa2dcc397e3616a0c138d9</guid></item></channel></rss>