[osg-users] How to write RGB value To the osg::Texture object pixelby pixel?

Mike Weiblen mweiblen at zebraimaging.com
Mon Oct 22 09:28:43 PDT 2007


The osgToy::MipmapTestImage shows how to construct an image using code,
see
http://osgtoy.svn.sourceforge.net/viewvc/osgtoy/osgtoy/trunk/src/osgToy/
MipmapTestImage.cpp?revision=173&view=markup

Cheers
-- mew

Mike Weiblen -- Zebra Imaging -- Austin Texas USA --
http://www.zebraimaging.com/

> -----Original Message-----
> From: osg-users-bounces at lists.openscenegraph.org [mailto:osg-users-
> bounces at lists.openscenegraph.org] On Behalf Of zhangguilian
> Sent: Sunday, October 21, 2007 2:45 AM
> To: osg-users
> Subject: [osg-users] How to write RGB value To the osg::Texture object
> pixelby pixel?
> 
> Hi ,I still don't know how to write RGB value to the osg::Texture
object
> pixel by pixel which can be realized in OpenGL as follows:
> 
> //in openGL
> #define TEXTUREWIDTH 64
> #define TEXTUREHEIGHT 64
> GLubyte Texture[TEXTUREWIDTH][TEXTUREHEIGHT][3];
> void makeTexture(void)
> void makeTexture(void)
> {
> int i,j,r,g,b;
> for(i=0;i<TEXTUREWIDTH;i++)
> {
> for(j=0;j<TEXTUREHEIGHT;j++)
> {
> r=(i*j)%255;
> g=(4*i)%255;
> b=(4*j)%255;
> Texture[i][j][0 =(GLubyte)r;
> Texture[i][j][1 =(GLubyte)g;
> Texture[i][j][2 =(GLubyte)b;
> }
> }
> }
> 
> //Used here
> glTexImage2D(GL_TEXTURE_2D,0,3,TEXTUREWIDTH,
> TEXTUREHEIGHT,0,GL_RGB,GL_UNSIGNED_BYTE,
> &Texture[0][0][0]);
> 
> Could you please give some examples? Thank you very much!
> 
> 



More information about the osg-users mailing list