source: trunk/tutorial/01_triangle.lolfx @ 2216

Last change on this file since 2216 was 1930, checked in by sam, 8 years ago

lolfx: improve the LolFx compiler, including error reporting. We can now
successfully parse a few of our full GLSL/HLSL shaders.

File size: 628 bytes
Line 
1/*
2 * Awesome triangle shader
3 */
4
5technique FlatColor
6{
7    pass DefaultPass
8    {
9        vertexshader = vert;
10        pixelshader = frag;
11    }
12}
13
14[vert.glsl]
15#version 120
16
17attribute vec2 in_Position;
18
19void main(void)
20{
21    gl_Position = vec4(in_Position, 0.0, 1.0);
22}
23
24[frag.glsl]
25#version 120
26
27void main(void)
28{
29    gl_FragColor = vec4(0.7, 0.2, 0.5, 1.0);
30}
31
32[vert.hlsl]
33void main(float2 in_Position : POSITION,
34          out float4 out_Position : POSITION)
35{
36    out_Position = float4(in_Position, 0.0, 1.0);
37}
38
39[frag.hlsl]
40void main(out float4 out_FragColor : COLOR)
41{
42    out_FragColor = float4(0.7, 0.2, 0.5, 1.0);
43}
44
Note: See TracBrowser for help on using the repository browser.