Hi Jonathan,
quite strange a material with a shader chunk should behave like a normal
material.
Can you write your scene as a osb file out so I can try to reproduce the
problem here.
#include <OSGSceneFileHandler.h>
SceneFileHandler::the().write(scene, "test.osb", true);
Andreas
Hello,
First, thank you for your answers. I will work soon on a small example to show
you my problem, but it's not that easy...
Anyway, as I was working on something else, I had another problem :
For information, I use OpenSG with VRJuggler.
I made a shader chunk in order to display some icons in 3D with an opacity
parameter. Here's my very simple shader :
- vertex shader :
varying vec2 texCoord;
void main(void)
{
texCoord = vec2(gl_MultiTexCoord0);
gl_Position = ftransform();
}
- fragment shader :
uniform sampler2D TextureIcone;
uniform float opacite;
varying vec2 texCoord;
void main(void)
{
vec4 couleurTexture = texture2D(TextureIcone,texCoord.st);
gl_FragColor = vec4(couleurTexture.rgb,couleurTexture.a*opacite);
}
As you see, I do nothing really interesting, except with my opacity parameter,
which allows to fade in / fade out the icons when I want to display it or not.
Each icon has its own chunkmaterial (_mchunk) :
beginEditCP(_mChunk);
_mChunk->addChunk(tChunk);
_mChunk->addChunk(_shl);
_mChunk->addChunk(_shlOpaciteParameter);
_mChunk->addChunk(bChunk);
endEditCP(_mChunk);
where tChunk is the texture chunk, _shl is the SHLChunk shared by all icons,
_shlChunkParameter is a SHLChunkParameter, unique for an icon (it contains the
opacity parameter of the icon) and bChunk is a BlendChunk shared by all icons,
which allows to use alpha blending.
It seemed to work fine at first. But when I tried to make some icons disappear
by reducing the opacity parameter to 0, one icon was always opaque. The strange
thing is that it was not one icon in particular, it was the icon which was the
farest from the point of view. And when I try to move the point of view, I can
see this icon disappear suddenly and then reappear, and that's the same for the
other icons, which I believed were fully transparent. So when I move the
camera, my icons are blinking everywhere on my scene and that's really
annoying, as I wanted to use this opacity parameter to display or not my icons.
So I wonder if it is something that I m doing wrong or if it's a problem with
the SHLChunks, because it's as if OpenSG decides not to execute the shaders on
some objects on the screen... as if it culled the objects using shaders.
I remarked too that the objects are culled in a weird way : sometimes, when I
turn the head, an object disappears suddenly, whereas it is supposed to be
mainly displayed on the screen. Maybe this is related.
So have you ever remarked or been informed of such a problem? Is there a
parameter I should set in order the shaders to be executed on every object on
the screen?
Thank you
Jo
-------------------------------------------------------
This SF.net email is sponsored by: 2005 Windows Mobile Application Contest
Submit applications for Windows Mobile(tm)-based Pocket PCs or Smartphones
for the chance to win $25,000 and application distribution. Enter today at
http://ads.osdn.com/?ad_id=6882&alloc_id=15148&op=click
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users
-------------------------------------------------------
This SF.net email is sponsored by: 2005 Windows Mobile Application Contest
Submit applications for Windows Mobile(tm)-based Pocket PCs or Smartphones
for the chance to win $25,000 and application distribution. Enter today at
http://ads.osdn.com/?ad_id=6882&alloc_id=15148&op=click
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users