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: [EMAIL PROTECTED] [mailto:osg-users- > [EMAIL PROTECTED] 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! > > _______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

