Show
Ignore:
Timestamp:
07/19/05 18:30:55 (9 years ago)
Author:
robert
Message:

Ported all the render to texture examples across to using the new osg::CameraNode?.
Added support for texture cube maps in FBO + CameraNode?.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • OpenSceneGraph/trunk/examples/osgpoints/osgpoints.cpp

    r4368 r4395  
    123123    viewer.getUsage(*arguments.getApplicationUsage()); 
    124124 
     125    bool shader = false; 
     126    while (arguments.read("--shader")) shader = true; 
     127 
    125128    // if user request help write it out to cout. 
    126129    if (arguments.read("-h") || arguments.read("--help")) 
     
    196199    // register the handler for modifying the point size 
    197200    viewer.getEventHandlerList().push_front(new KeyboardEventHandler(viewer.getGlobalStateSet())); 
     201 
     202 
     203    if (shader) 
     204    { 
     205        osg::StateSet* stateset = loadedModel->getOrCreateStateSet(); 
     206     
     207        /////////////////////////////////////////////////////////////////// 
     208        // vertex shader using just Vec4 coefficients 
     209        char vertexShaderSource[] =  
     210            "void main(void) \n" 
     211            "{ \n" 
     212            "\n" 
     213            "    gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;\n" 
     214            "}\n"; 
     215 
     216        ////////////////////////////////////////////////////////////////// 
     217        // fragment shader 
     218        // 
     219        char fragmentShaderSource[] =  
     220            "void main(void) \n" 
     221            "{ \n" 
     222            "    gl_FragColor = gl_Color; \n" 
     223            "}\n"; 
     224 
     225 
     226        osg::Program* program = new osg::Program; 
     227        stateset->setAttribute(program); 
     228 
     229        osg::Shader* vertex_shader = new osg::Shader(osg::Shader::VERTEX, vertexShaderSource); 
     230        program->addShader(vertex_shader); 
     231 
     232        //osg::Shader* fragment_shader = new osg::Shader(osg::Shader::FRAGMENT, fragmentShaderSource); 
     233        //program->addShader(fragment_shader); 
     234    } 
     235 
     236 
    198237 
    199238    // create the windows and run the threads.