I am trying to produce a simple cheesy effect. I am trying to make a moving dotted line (think similar to a barber shop pole).
- I start with a GL_LINE_STRIP. - Then I add a 1D texture to it so I can control how it looks and how it moves. (Currently it is an alternating off-on texture so it looks like a dotted line.) - I use osg::TexGen to generate texture coordinates for me. (In my general case, I may add or subtract points to my line so I didn't want to have to manually set TexCoords myself.) - I then use osg::TexMat to generate movement This all seems to work well enough. But my final step is where things seem to break. I then add a Vertex Shader to the mix. When I do this, my line does not render correctly. Often I seem to get a line that completely flashes off or on, rather than seeing the animated dots. To start with, I'm just trying to write a simple vertex shader that is effectively a pass-through program so it should look identical to the fixed pipeline program. I have been able to reproduce the problem on both Mac and Windows (with different video cards). So I'm guess I'm missing something important. If I remove the glTexGen stuff and set the glTexCoord manually, things seem to work, but I would like to know how to get it to work with glTexGen as well. (It makes my general case easier.) I assume I'm doing something wrong with either my shader or the way I set up TexGen. Attached is a tar-ball containing the source to two programs plus my vertex shader. One uses TexGen, the other does not. In the program that uses TexGen, there is a single line of code that will make or break the program. Search for "KEY LINE". If the line is enabled, the shader is used and I get the flashing. If disabled, the program works as expected. (Also, I think I might have found a bug in OSG. As noted in the comment, if I set the stateset's setAttributeAndModes to osg::StateAttribute::OFF, the shader still gets loaded and run.) Can somebody tell me how to fix my program so it works with TexGen? This is the build line I use for Mac: g++ -D__USE_OSX_AGL_IMPLEMENTATION__ shader_<no>texgen.cpp -framework osg -framework osgUtil -framework osgDB -framework osgGA -framework osgProducer -framework Producer -framework OpenThreads -framework osgText -framework OpenGL (Adapt as necessary for your platform.) Thanks, Eric
TexGenShaderProblem.tar.gz
Description: GNU Zip compressed data
_______________________________________________ osg-users mailing list [email protected] http://openscenegraph.net/mailman/listinfo/osg-users http://www.openscenegraph.org/
