I'm sorry to re-send the same post but does anybody have an idea about where the
problem could be? I'm not an expert in OpenSG so I don't really see where this
problem can come from.
Thanks.
Jo
(my last post :)
Selon Jonathan Bard <[EMAIL PROTECTED]>:
> Hi,
>
> Sorry, it wasn't a bug in OpenSG. I tried so many things that I didn't
> realize I
> was using a sampler2D in my glsl shader instead of a sampler3D... And so
> OpenSG
> was forced to use the last 2D texture, I presume, which led to this behaviour
> (the one I described 2 mails ago).
> Now, the problem is that my shader produces a black texture, whereas I filled
> my
> 3D texture with random colors. I know my texture coordinates are alright,
> because when I use the fragment shader instruction : gl_FragColor =
> vec4(texCoord.xyz,1.0); I can see the colors of the pixels changing from
> green
> to red.
> I use the fragment shader instruction :
> gl_FragColor = vec4(texture3D(TextureEssai,texCoord.xyz).rgb,1.0);
> in order to present the color of my 3D texture on the screen. And that leads
> to
> pure black.
> I've already talked about what I'm doing to create all the chunks, etc. And
> neither OpenGL nor OpenSG produces an error when my application compiles and
> links the SHLChunk, which means that the constant parameters are OK, I think.
> When I generate the texture, I use the code :
> beginEditCP(img, Image::PixelFieldMask);
> {
> UInt8 *data = img->getData();
> UIntRGB valeurPixel;
> // ... valeurPixel calculations ...
> memcpy( &(data[ic*3]), &valeurPixel, 3*sizeof(UInt8) );
> }
> endEditCP(img, Image::PixelFieldMask);
> where UIntRGB is a small struct to stock the UInt8 of the 3 colors. I also
> printed the values data[ic*3], data[ic*3+1] and data[ic*3+2] after the memcpy
> and they are alright. Then I call imageContentChanged() on the texture chunks
> which use this image.
> So what's wrong in my application ? Any idea ?
> And that would be really cool if someone answered the questions I asked in my
> last mail, about the TextureChunk stuff, because it is not quite clear to me.
> Thank you very much.
>
> Jo
>
>
> Selon Jonathan Bard <[EMAIL PROTECTED]>:
>
> > Hi,
> >
> > Thanks for the hint with the textureChunk finding, it works great. I have a
> > question though : I set my texture on a slot by calling
> > ChunkMaterial::addChunk, which takes the texture chunk ptr as first
> > parameter.
> > When I do that, am I sure that if it's the first time I call addChunk with
> a
> > TextureChunk on this materialchunk, the texturechunk will be assigned the
> > slot
> > number 0? If I call a second time addChunk on the same materialChunk with
> > another texturechunk, will the slot number be 1? etc.
> > What about the second parameter of the addChunk function : is it a good way
> > to
> > provide our own texture slot number? Like that, I would call
> > addChunk(texChunk,
> > slotNumber), and I will be sure that this texture chunk will be assigned
> this
> > slotNumber, instead of counting the times we've called addChunk on this
> > material before. Does it work like that?
> >
> > Anyway, I tried with the debug libs and it doesn't seem I have any OpenGL
> > error.
> > Still, I'm not sure about what you call "texture definition" : I generate
> > myself the data of the texture, by feeding the data pointer of the image
> > pointer (which I get by calling getData() on the Image) with UChar8
> triplets.
> > And I use the format "OSG_RGB_PF" :
> > img->set( Image::OSG_RGB_PF, _iBar, _jBar, _kBar, 1, 1, 0);
> > Is it related to what you call texture definitions?
> > Just to know what to look for, because my log file is awfully enormous,
> what
> > kind of messages would I get with such an OpenGL?
> >
> > Thanks for help
> >
> > Jonathan
> >
> > Selon Dirk Reiners <[EMAIL PROTECTED]>:
> >
> > >
> > > Hi Jonathan,
> > >
> > > just a quick precheck answer. Your code seems to be ok, just want to
> > > confirm one detail: you're using volume textures, right?
> > >
> > > I can think of two possible reasons for your behavior. Does the texture
> > > definition work? I.e. when running with debug libs, do you get no
> > > messages on the console about OpenGL errors? The other would be a bug in
> > > OpenSG, we can never totally rule that out, but I don't expect it.
> > >
> > > BTW, you can simplify your Chunk search code, the ChunkMaterial has
> > > something very similar built in:
> > >
> > > StateChunkPtr stateChunk = pM->find(TextureChunk::getClassType(), 0);
> > >
> > > to find the TextureChunk for slot 0.
> > >
> > > Yours
> > >
> > > Dirk
> > >
> > > --
> > > Dirk Reiners <[EMAIL PROTECTED]>
> > >
> > >
> > >
> > > -------------------------------------------------------
> > > SF email is sponsored by - The IT Product Guide
> > > Read honest & candid reviews on hundreds of IT Products from real users.
> > > Discover which products truly live up to the hype. Start reading now.
> > > http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
> > > _______________________________________________
> > > Opensg-users mailing list
> > > [email protected]
> > > https://lists.sourceforge.net/lists/listinfo/opensg-users
> > >
> >
> >
> >
> >
> > -------------------------------------------------------
> > SF email is sponsored by - The IT Product Guide
> > Read honest & candid reviews on hundreds of IT Products from real users.
> > Discover which products truly live up to the hype. Start reading now.
> > http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
> > _______________________________________________
> > Opensg-users mailing list
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/opensg-users
> >
>
>
>
>
> -------------------------------------------------------
> SF email is sponsored by - The IT Product Guide
> Read honest & candid reviews on hundreds of IT Products from real users.
> Discover which products truly live up to the hype. Start reading now.
> http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
> _______________________________________________
> Opensg-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/opensg-users
>
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users