Changeset 8931:37b99d1a4718 in orange


Ignore:
Timestamp:
09/09/11 10:21:15 (3 years ago)
Author:
matejd <matejd@…>
Branch:
default
Convert:
b1e4004a5d3394d50ffb5f3e835f7e115da582be
Message:

Removed bitwise operations requirement from the main shader - should now work everywhere

Location:
orange/OrangeWidgets/plot
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • orange/OrangeWidgets/plot/symbol.fs

    r8797 r8931  
    1  
    2 in vec4 var_color; 
     1varying vec4 var_color; 
    32 
    43void main(void) 
    54{ 
    6     gl_FragColor = var_color; // gl_FragColor is deprecated 
     5    gl_FragColor = var_color; 
    76} 
  • orange/OrangeWidgets/plot/symbol.vs

    r8806 r8931  
    1 #version 150 
    2  
    3  
    41// Each example is drawn using a symbol constructed out 
    52// of triangles. Each vertex is specified by its offset 
    63// from the center point, example's position, color, normal 
    7 // and index. 
    8 in vec3 position; 
    9 in vec3 offset; 
    10 in vec3 color; 
    11 in vec3 normal; 
    12 in float index; 
     4// and index (stored in .w components of position and offset). 
     5attribute vec4 position; 
     6attribute vec4 offset; 
     7attribute vec3 color; 
     8attribute vec3 normal; 
    139 
    14 out vec4 var_color; 
     10varying vec4 var_color; 
    1511 
    1612uniform bool use_2d_symbols; 
     
    3026 
    3127void main(void) { 
    32     vec3 offset_rotated = offset; 
     28    vec3 offset_rotated = offset.xyz; 
    3329    offset_rotated.x *= symbol_scale.x; 
    3430    offset_rotated.y *= symbol_scale.x; 
     
    5652    } 
    5753 
    58     vec3 pos = position; 
     54    vec3 pos = position.xyz; 
    5955    pos += translation; 
    6056    pos *= scale; 
     
    6965    else if (encode_color) 
    7066    { 
    71         var_color = vec4(float((uint(index) & uint(0xFF))) / 255., 
    72                          float((uint(index) & uint(0xFF00)) >> uint(8)) / 255., 
    73                          float((uint(index) & uint(0xFF0000)) >> uint(16)) / 255., 
    74                          float((uint(index) & uint(0xFF000000)) >> uint(24)) / 255.); 
     67        var_color = vec4(position.w, offset.w, 0, 0); 
    7568    } 
    7669    else 
     
    8578        if (use_2d_symbols) 
    8679        { 
    87             // Disable lighting for 2d symbols. 
    88             // TODO: gradients? 
     80            // No lighting for 2d symbols. 
    8981            var_color = vec4(color, a); 
    9082        } 
     
    9284        { 
    9385            // Calculate the amount of lighting this triangle receives (diffuse component only). 
    94             // The calculations are physically wrong, but look better. TODO: make them look better 
     86            // The calculations are physically wrong, but look better. 
    9587            vec3 light_direction = normalize(vec3(1., 1., 0.5)); 
    9688            float diffuse = max(0., dot(normalize((modelview * vec4(normal, 0.)).xyz), light_direction)); 
Note: See TracChangeset for help on using the changeset viewer.