Results 1 to 1 of 1

Thread: online shader sites the code is different than glsl?

Share/Bookmark
  1. #1
    thinBasic MVPs kryton9's Avatar
    Join Date
    Nov 2006
    Location
    Naples, Florida & Duluth, Georgia
    Age
    61
    Posts
    3,869
    Rep Power
    397

    online shader sites the code is different than glsl?

    They have many cool online shader sites. Their code does not look like the glsl code that I study... They don't have separate fragment and vertex shaders, just one source?

    Here is a simple online shader:
    http://glslsandbox.com/e
    Here is the code from it, it looks like just the fragment shader:
    #ifdef GL_ES
    precision mediump float;
    #endif
    
    #extension GL_OES_standard_derivatives : enable
    
    uniform float time;
    uniform vec2 mouse;
    uniform vec2 resolution;
    
    void main( void ) {
    
    	vec2 position = ( gl_FragCoord.xy / resolution.xy ) + mouse / 4.0;
    
    	float color = 0.0;
    	color += sin( position.x * cos( time / 15.0 ) * 80.0 ) + cos( position.y * cos( time / 15.0 ) * 10.0 );
    	color += sin( position.y * sin( time / 10.0 ) * 40.0 ) + cos( position.x * sin( time / 25.0 ) * 40.0 );
    	color += sin( position.x * sin( time / 5.0 ) * 10.0 ) + sin( position.y * sin( time / 35.0 ) * 80.0 );
    	color *= sin( time / 10.0 ) * 0.5;
    
    	gl_FragColor = vec4( vec3( color, color * 0.5, sin( color + time / 3.0 ) * 0.75 ), 1.0 );
    
    }
    
    Here is a partial code listing of a shader I wrote in c++.

            /* vertex shader */
    "varying vec4 v_color;\n"
    "\n"
    "void main()\n"
    "{\n"
    "    gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;\n"
    "    v_color = gl_Color;\n"
    "}",
            /* fragment shader */
    "varying vec4 v_color;\n"
    "\n"
    "void main()\n"
    "{\n"
    "    gl_FragColor = v_color;\n"
    "}"
    
    How could I use those sites to develop my shaders and then use them in my own code?

    Edit: Found an online site that has both parts: http://shdr.bkcore.com/
    Near the top left you will see the shader type with a pencil icon. The shader type is a drop down to pick fragment or vertex shader.
    Last edited by kryton9; 12-05-2017 at 02:22.
    Acer Notebook: Win 10 Home 64 Bit, Core i7-4702MQ @ 2.2Ghz, 12 GB RAM, nVidia GTX 760M and Intel HD 4600
    Raspberry Pi 3: Raspbian OS use for Home Samba Server and Test HTTP Server

Similar Threads

  1. Useful Youtube Programming Sites
    By kryton9 in forum Help Material
    Replies: 9
    Last Post: 16-05-2017, 19:02
  2. Basic example on passing value from ThinBASIC to shader
    By Petr Schreiber in forum TBGL Tutorials
    Replies: 8
    Last Post: 19-05-2013, 09:41
  3. PHP on thinBasic web sites
    By ErosOlmi in forum Web and Forum
    Replies: 3
    Last Post: 07-01-2010, 08:15
  4. google email & sites are forever
    By zak in forum Shout Box Area
    Replies: 2
    Last Post: 11-10-2009, 19:13
  5. TAB tutorial online
    By catventure in forum T.A.B. (ThinBasic Adventure Builder)
    Replies: 3
    Last Post: 14-10-2006, 21:45

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •