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

2007-10-21 Thread zhangguilian
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;iTEXTUREWIDTH;i++)
{
for(j=0;jTEXTUREHEIGHT;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
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Problem with new OpenScenGraph version 2.2.0

2007-10-21 Thread Robert Osfield
Hi Son,

I develop under Linux as do many others and 2.2.0 was compiling fine
including osgtext.cpp.  What error did you get?  What OS/compile
version are you using?

As for the file path issues, I have now clue as you're provide too
little info.  Things have worked just fine on all the linux machines I
have here, no others have reported problems with finding files, so my
guess its down to something you've done at your end.

Robert.

On 10/19/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
 Hi all,
 I just downloaded the new Version 2.2.0 of OpenScenGraph. All libraries and
 examples (after fixing a syntax error in file examples/osgtext/osgtext.cpp)
 let successfully build on my x86 GNU/Linux machine. But almost examples only
 show a blank screen now.
 Env. OSG_FILE_PATH and LD_LIBRARY_PATH are correctly set.
 For example calling osgviewer cow.osg  or osggeometry, both examples
 show a blank screen with clear color.
 Unlike that it seams to be alrights with osgviewerQT cow.osg.

 I didn't have this problem with previous OpenScenGraph version 2.0.

 Many thanks for any ideas, what's the reason ?

 Son

 ___
 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] Performance Problems

2007-10-21 Thread Robert Osfield
HI Shawn,

The OSG can handles scenes with thousands of objects, and millions of
polygons on modern machines at a solid 60Hz, the numbers of objects
you are talking about suggest there is something wrong with how you
are setting up your app.  Could it be that you are doing a single quad
per geometry? This isn't an efficient way to do rendering.  Could it
be that you are compiling with a debug build and then doing
benchmarking?

Robert.

On 10/19/07, Shawn Cook [EMAIL PROTECTED] wrote:

  Hi, Trying to do something simple and getting a poor framerate.  I'm sure
 it's just something I don't know about OSG and need to learn, perhaps you
 folks can help.  Basically, imagine a camera positioned above a grid with
 anywhere from 100 to 5000 quads of similar size shuffling around on the 2D
 plane with the grid.  The position of each of these quads is controlled in
 real time by a seperate Java app via multicast.

  My coworker is working on an identical project in parallel to mine on an
 identical laptop but is using Cocoa(Mac OS X 10.5) and straight OpenGL.  He
 is getting a framerate of 100+ frames per second with 500 quads while I
 cannot get more than 30fps with 500.  That framerate is acceptable, but
 eventually I would like to do more than just draw quads.  Instead, each quad
 will be a little tail of quads following a head around - like tracers or
 a little snake.  Again, my coworker has done this already and is acheiving a
 similarly phenominal framerate - If I add just a couple quads my framerate
 drops.  What's the deal?  At first I was using a single geode, geometry
 object and vec3array for each quad and was getting an unusable framerate.
 When I restructured with a single geode, geometry for the application and
 one large vec3array for all the quads my framerate got up to where it is now
 (acceptable, but slow when I add the tracers).

  How can I acheive 100+ fps like my friend?

  System info:
  MacBook Pro 1,1
  Windows XP (using Bootcamp)
  1MB RAM
  2GHz Dual Core
  OpenSceneGraph 2.0.0
  VRJuggler 2.0.3-1

  Also, this is a VRJuggler/OpenSceneGraph application - perhaps if you guys
 can't help I'll hit up the VRJuggler mailing lists for some help.

  Thanks folks,
  S

 
 Help yourself to FREE treats served up daily at the Messenger Café. Stop by
 today!
 ___
 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] How to write RGB value of the osg::Texture2D

2007-10-21 Thread Robert Osfield
Hi Zahnggulian,

You set up the texture imagery using osg::Image.  There is a range of
OSG plugins that set up osg::Image such as the rgb, jpeg, gif etc
plugins, have a look at these.

Robert.

On 10/20/07, zhangguilian [EMAIL PROTECTED] wrote:


 Hi, I have an question and eagerly to know the answer.
 How can I directly write the RGB value of the osg::Texture2D?
 As a matter of fact,I can write the RGB value of Texture in OpenGL,such as :
 #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;iTEXTUREWIDTH;i++)
 {
 for(j=0;jTEXTUREHEIGHT;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;
 }
 }
 }


 void myinit(void)
 {
 auxInitDisplayMode(AUX_SINGLE|AUX_RGBA);
 auxInitPosition(0,0,500,500);
 auxInitWindow(sample1);
 auxInitWindow(sample1);
 glClearColor(0.0,0.0,0.0,0.0);
 glClear(GL_COLOR_BUFFER_BIT);

 //The data used for creating texture image is saved in Texture[][][]
 makeTexture();
 glPixelStorei(GL_UNPACK_ALIGNMENT,1);

 //Used here
 glTexImage2D(GL_TEXTURE_2D,0,3,TEXTUREWIDTH,
 TEXTUREHEIGHT,0,GL_RGB,GL_UNSIGNED_BYTE,
 Texture[0][0][0]);

 glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_CLAMP);
 glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_CLAMP);
 glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
 glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);

 glTexEnvf(GL_TEXTURE_ENV,GL_TEXTURE_ENV_MODE,GL_DECAL);

 glEnable(GL_TEXTURE_2D);
 glEnable(GL_TEXTURE_2D);
 // glShadeModel(GL_FLAT);
 }

 But I really don't know how to use this mathod in OSG,Could you please give
 me an advice,Thanks a lot!
  

 zhangguilian
 2007-10-20
 ___
 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] .hdr Image format in RAW modus

2007-10-21 Thread Robert Osfield
On 10/20/07, Art Tevs [EMAIL PROTECTED] wrote:
 Hi.

 I am wonder why the HDR-Reader does not upload the raw
 values per default to the image.

 I mean, what is the reason, why you have to specify
 this option extra, since it is intuitively clear, that
 the reader has to pass the data in the same manner as
 it is stored in the file, raw data. The values can be
 later used by a shader to convert them properly.

 Otherwise it would be gratefull to check, if the GPU
 does support float textures and upload the values
 directly converted to float?

You can't check GPU support from within a plugin as a plugin doesn't
neccesarily have a valid graphics context - rather its later code that
should check this.



 Thanks, Art

 P.S. Everytime a new version of osg is coming out, I
 have to modify the hdr plugin to upload the raw data
 ;-)

I'm not the author of the HDR plugin so know little specifically about
the HDR plugin.  Is there are legitimate versions of the HDR format
that are presently supported that should be the please add this
support and submit it for inclusion in the SVN version of the OSG,
this way it'll be in the next release.

Robert.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] Collada Plugin DAE build errors

2007-10-21 Thread kbeal
I have this same problem.  I tried removing LIBXML_STATIC from the preprocessor 
defines in LIBXMLPlugin.vcproj and rebuilt and still get the same error.

Adrian Egli wrote:
 hi

 (1) i downloaded the collada prebuild library from 
 http://sourceforge.net/projects/collada-dom
 (2) installed the prebuild library 
 http://sourceforge.net/project/showfiles.php?group_id=157838package_id=211510
  
 http://sourceforge.net/project/showfiles.php?group_id=157838package_id=211510
  
 (17.04.2007)
 (3) c-make configurated
 (4) build osg with VC 7 and got the following errors:

 Plug 3d dae error LNK2019: unresolved external symbol _xmlFree 
 referenced in function private: void __thiscall 
 daeLIBXMLPlugin::readAttributes(class daeElement *,struct 
 _xmlTextReader *) 
 (?readAttributes at 
 daeLIBXMLPlugin@@AAEXPAVdaeElement@@PAU_xmlTextReader@@@Z) 
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org