From: Michel B. <mic...@fr...> - 2009-08-27 06:03:44
|
"John A. Stewart" <ale...@cr...> - Tue, 25 Aug 2009 10:23:51 -0400 >Doug; > >> Anaglyph 6 >> Texture shader - draw in color including textures in 1 step. As with >> the primitive color shader already implemented in freewrl, this >> shader program is run before rendering the scenegraph, so it >> replaces that part of the FFP (fixed function pipeline). GLSL Shader >> code... > > >> RESULTS: >> Not good. The problem is how to detect when no texture is applied so >> as to switch to color. Setting a flag is equivalent to going through >> scenegraph code to make changes, something I would rather avoid. >> When done on tests, it renders faster than the > >My GLSL books are at home (bedtime reading - sheesh) but, can you >query if GL_TEXTURE_2D is enabled or not? Maybe see which if any of >the texture units are enabled? > >BTW - I would like to propose methods of setting global shaders; not >just ones on a per-material basis, for X3D. I think it would be a good >thing to do. Any comments? > Hello, querying for GL_TEXTURE_2D during rendering is a performance kill. The scenegraph function should be able to tell whether this specific object being rendered has or does not has textures / shaders / materials enabled. Isn't it ? Doug: please feed us with example of your work : screen shots, X3D example files ;) ... it'd help to understand what you are trying to do. BTW : the classical technique is to make a pass for objects with their specific characteristics and then make a pass for additional effects such as glooming, edges, etc ... I.e two global pass. If you want to draw only edges in the second pass you can setup OpenGL to fill only points & lines, not 2D primitives. But better performances & effects are achieved through proper use of global shaders added to each rendered object, I think (making all in one pass). Cheers, Michel |