Re: [osg-users] Load of 8 bits image for creating texture
Hi Robert, Unfortunatly I'm always not able to display correctly my texture. For the moment I have a black texture... I'm probably wrong when assigning texture coordinates of the 1D Texture but I don't know how I should do. Could you plpease help me for this ? I do the following. I load the image in two parts. First the color table in a 1D Texture thanks to a TransferFunction1D instance, then I create a 2D Texture with the data of the image. I verify and this two images are ok so the associated textures too. Then I assign the texture coordinates to the texture 2D (the same as before when the image was loading like a 32 bits image) thanks to setTexCoordArray on my osg::Geometry. For the 1D Texture I'm a little bit lost and don't know really what assign as texture coordinates. I tried with GL_TEXTURE_GEN_S but have always this black texture as result. Do you have an idea of how I can see the colour on my texture ? Thanks in advance for your help, Adrien. -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=32291#32291 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Load of 8 bits image for creating texture
Hi Robert, Thanks for your quick reply. I had done exactly what you've said. So something else should be wrong in my code (perhaps in the loading of the image). I have to investigate more... Thanks again, Regards, Adrien -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=32158#32158 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Load of 8 bits image for creating texture
Hi Robert, I know I'm a little bit late but I've just begin to try your solution at the beginning of this week (no time before... :( ). I'm now able to load the image information on a Texture2D and the color table in a Texture1D thanks to the osg::TransferFunction1D class. What I miss now is the link between the two types of texture (Should be there in the same osg::StateSet ? How link the one with the other ?) I've tried to create two textures in the same stateSet but nothing appears. It will be very helpful if you could say me what I'm missing ? Thanks in advance for your help, Adrien. -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=32141#32141 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Load of 8 bits image for creating texture
Hi Adrien, When using multi-texturing you need to decide which texture units to use then set up your texenv (if using fixed function pipeline) or shaders to reflect this. Typically, in your case, one would use texture unit 0 and texture unit 1, so you'd do something like: stateset-setTextureAttribute(0, textureSource); stateset-setTextureAttribute(1, textureLookUp); Robert. On Tue, Sep 28, 2010 at 5:19 PM, Adrien Chassard osgfo...@tevs.eu wrote: Hi Robert, I know I'm a little bit late but I've just begin to try your solution at the beginning of this week (no time before... :( ). I'm now able to load the image information on a Texture2D and the color table in a Texture1D thanks to the osg::TransferFunction1D class. What I miss now is the link between the two types of texture (Should be there in the same osg::StateSet ? How link the one with the other ?) I've tried to create two textures in the same stateSet but nothing appears. It will be very helpful if you could say me what I'm missing ? Thanks in advance for your help, Adrien. -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=32141#32141 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Load of 8 bits image for creating texture
Hi Adrien, The way to do colour look up tables in OpenGL these days is to use a fragment program that reads the source texture which is an 8bit intensity/alpha texture and then look this up a second texture. So create the two osg::Image, one for the 8bit data, and then a second one for the RGBA look up table. Assign these two osg::Image to Texture2D and an Texture1D respectively. The is an osg::TransferFunction1D class for helping create RGBA look up tables, this is used in osgVolume so you could look at this as an example. Robert. On Tue, Jun 29, 2010 at 7:02 PM, Adrien Chassard coupe2...@hotmail.fr wrote: Hi, I try to load a 8bits image and create an osg::Texture2D with it. I search all the day but without sucess. It seems that the image load by osgDB::readImageFile(...) is transform in a 32 bits image. Is it possible to load it as 8bits image with an associated look up table ? (I didn't find attribut in osg::Image that could correspond to a lut, is there one ?) However if I can load my image as a 8 bits image, I don't know how I can associate the color table to the texture, is there a way to do that ? In fact and to clarify what I mean, here is the code in OpenGL I would like to translate in OpenSceneGraph : glColorTableEXT(GL_TEXTURE_2D, GL_RGBA8, 256, GL_RGBA, GL_UNSIGNED_BYTE, colorTable); glTexImage2D(GL_TEXTURE_2D, 0, GL_COLOR_INDEX8_EXT, width, height, 0, GL_COLOR_INDEX, GL_UNSIGNED_BYTE, texture); I hope I was enough clear. Sorry if I wasn't. Thank you very much for your help. Cheers, Adrien -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=29500#29500 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Load of 8 bits image for creating texture
Hi Robert, Thanks for the quick and very interesting reply! I will take a look at the example and try what you suggest. I let you know if I succed or not. Adrien -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=29550#29550 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Load of 8 bits image for creating texture
Hi, I try to load a 8bits image and create an osg::Texture2D with it. I search all the day but without sucess. It seems that the image load by osgDB::readImageFile(...) is transform in a 32 bits image. Is it possible to load it as 8bits image with an associated look up table ? (I didn't find attribut in osg::Image that could correspond to a lut, is there one ?) However if I can load my image as a 8 bits image, I don't know how I can associate the color table to the texture, is there a way to do that ? In fact and to clarify what I mean, here is the code in OpenGL I would like to translate in OpenSceneGraph : glColorTableEXT(GL_TEXTURE_2D, GL_RGBA8, 256, GL_RGBA, GL_UNSIGNED_BYTE, colorTable); glTexImage2D(GL_TEXTURE_2D, 0, GL_COLOR_INDEX8_EXT, width, height, 0, GL_COLOR_INDEX, GL_UNSIGNED_BYTE, texture); I hope I was enough clear. Sorry if I wasn't. Thank you very much for your help. Cheers, Adrien -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=29500#29500 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org