RE: Texture Mapping

From: Fine, Valeri <fine_at_bnl.gov>
Date: Tue, 27 May 2008 14:12:28 -0400


Hello Akira,

I have added a couple of lines to my script "rootgeom_coint.C" script
http://root.bnl.gov/QtRoot/root/qtExamples/macros/rootgeom_coin.C (it was used to produce my Acat'2007 presentation http://agenda.nikhef.nl/contributionDisplay.py?contribId=105&amp;session Id=15&amp;confId=55 ) to show you can use the ROOT 3D objects http://root.bnl.gov/QtRoot/pictures/RootEarth.gif and OpenGL texture easily ( ZERO programming is really needed )

Best Regards

                         Valeri Fine


Brookhaven National Laboratory
Upton, NY 11973, USA
Phone: +1 631 344 7806
Fax: +1 631 344 4206
E-mail: fine_at_bnl.gov

> -----Original Message-----
> From: OKUMURA, Akira [mailto:oxon_at_ceres.phys.s.u-tokyo.ac.jp]
> Sent: Tuesday, May 27, 2008 9:56 AM
> To: Fine, Valeri
> Cc: ROOT Talk
> Subject: Re: [ROOT] Texture Mapping
>
> Hello Valeri,
>
> The example you gave me seems what I want. I will start from your
> macro and suggestions Matevz told me.
>
> Thank you.
>
> Regards,
>
> OKUMURA, Akira oxon_at_ceres.phys.s.u-tokyo.ac.jp
> Department of Physics, The University of Tokyo
> 7-3-1 Hongo, Bunkyo-ku, Tokyo 113-0033
> TEL/FAX +81 3-5841-4173/4059
> Skype : okumura.akira
>
> On 2008/05/26, at 14:42, Fine, Valeri wrote:
>
> > Dear Akira,
> >
> > I am sorry, I forgot to provide the link to the ROOT macro.
> > Here you are the screen snapshot
> > http://root.bnl.gov/QtRoot/pictures/HelloEarth.gif
> >
> > produced by the 20 lines long ROOT macro (it uses the standard ROOT
> > plug-in and its Coin implementation)
> > http://root.bnl.gov/QtRoot/root/qtExamples/HelloEarth/earth.C
> > ROOT macro
> >
> > void earth()
> > {
> > // Draw the globe using "worldmap.bmp" texture file
> > if ( gSystem->AccessPathName("earth.iv") ) {
> > // Create the Inventor file if needed
> > ofstream out("earth.iv");
> > out << "#Inventor V2.1 ascii" << endl;
> > out << " Texture2 { filename \"worldmap.bmp\" " << endl;
> > out <<" model REPLACE } "<< endl;
> > out << "Sphere { radius 10 }" << endl;
> > }
> > TCanvas *c = new TCanvas;
> > c->SetFillColor(kBlack);
> > TVirtualViewer3D *viewer =0;
> > if (viewer = TVirtualViewer3D::Viewer3D(c,"oiv")) {
> > gEnv->SetValue("Gui.InventorBackgroundShape","earth.iv");
> > gEnv->SetValue("Gui.SnapShotFileCounter","100");
> > // Start ROOT 3D viewer
> > viewer->BeginScene(); viewer->EndScene();
> > }
> > }
> >
> > It generates the picture from the texture file:
> >
> > http://root.bnl.gov/QtRoot/root/qtExamples/HelloEarth/worldmap.bm p
> >
> > You can replace on line
> >
> > out << " Texture2 { filename \"worldmap.bmp\" " << endl;
> >
> > in the macro above to use your own texture file as well.
> > I think you can use this technique right now (it is very simple and
> > requires no OpenGL / Open Inventor / C++ knowledge) and switch to
> > the "official ROOT class later on.
> >
> > As my Acat 2007 Workshop talk mentioned, the technique above can be
> > used to attach any Coin3D node to any ROOT 3D class object to get
> > the mixed ROOT/Coin 3D scene as well.
> > (see

>
http://agenda.nikhef.nl/contributionDisplay.py?contribId=105&amp;session Id=15&amp;confId=55
> > )
> >
> > Hope this helps, Valeri
> >
> > ________________________________
> >
> > From: owner-roottalk_at_root.cern.ch on behalf of Fine, Valeri
> > Sent: Mon 5/26/2008 1:15 PM
> > To: OKUMURA, Akira; ROOT Talk
> > Subject: RE: [ROOT] Texture Mapping
> >
> >
> >
> > Hello Akira,
> >
> > Do you need something like
> > http://doc.coin3d.org/Coin/classSoTextureCoordinateSphere.html
> >
> > backed with
> >
> > http://doc.coin3d.org/Coin/classSoGeoCoordinate.html
> >
> > thank you.
> > Valeri
> >
> >
> > ________________________________
> >
> > From: owner-roottalk_at_root.cern.ch on behalf of OKUMURA, Akira
> > Sent: Mon 5/26/2008 7:47 AM
> > To: ROOT Talk
> > Subject: [ROOT] Texture Mapping
> >
> >
> >
> > Hello ROOTers,
> >
> > I would like to show a sphere of which surface is a texture mapping
of
> > an all-sky image of cosmic gamma rays. Is there any ROOT function to
> > create such sphere using OpenGL? If not, which ROOT classes are good
> > starting point?
> >
> > I know that OpenGL itself has functions to handle texture mapping
but
> > I am not an expert of OpenGL. So I am wondering if I can easily
access
> > OpenGL's texture mapping via ROOT system.
> >
> > Regards,
> >
> > OKUMURA, Akira oxon_at_ceres.phys.s.u-tokyo.ac.jp
> > Department of Physics, The University of Tokyo
> > 7-3-1 Hongo, Bunkyo-ku, Tokyo 113-0033
> > TEL/FAX +81 3-5841-4173/4059
> > Skype : okumura.akira
> >
> >
> >
> >
> >
Received on Tue May 27 2008 - 20:12:47 CEST

This archive was generated by hypermail 2.2.0 : Tue May 27 2008 - 23:50:01 CEST