How to specify the level value in isosurface drawing with TF3 and GL?

Hello,
the following example shows that isosurface drawing with TF3 and GL seems to draw the surface level
f(x,y,z)=-0.2 whereas without GL options it draws the surface level f(x,y,z)=0.
Here i take for example f(x,y,z)=xyz.
Do i miss the correct way to specify the value of the function?
Thanks,
Frédéric Faure.

glc

glc

c2

#include <TApplication.h>
#include <TCanvas.h>
#include <TStyle.h>
#include <TPaveLabel.h>
#include <TFormula.h>
#include <TF3.h>
#include <TText.h>
//-----------------------------
main ()
{
	TApplication theApp("App", nullptr, nullptr);

	//----- With GL ---------
    //.... prepare the 3D window
	gStyle->SetCanvasPreferGL(1);
	TCanvas *cnv = new TCanvas("glc", "TF3: Surface", 200, 10, 600, 600);
	TPad *tf3Pad = new TPad("box", "box",0,0,1,1);
	tf3Pad->Draw();
    //.... define and draw the 3D object

	TF3 *tf3 = new TF3("Surface","x*y*z+0.2", -1,1,-1,1,-1,1);
	
	tf3->SetFillColor(kRed);
	tf3Pad->cd();
	tf3->Draw("gl");

	TText *texte=new TText(0.2,0.9,"f(x,y,z)= x*y*z+0.2");
	texte->Draw();
	
	//----- Without GL ---------

	auto c2 = new TCanvas("c2","c2", 1000, 1000);

	TF3 *tf3bis = new TF3("Surface","x*y*z", -1,1,-1,1,-1,1);
	tf3bis->Draw("FBBB");

	//------------------------
	theApp.Run();
} 

__
ROOT Version: Not Provided
Platform: Not Provided
Compiler: Not Provided


yes i can see the same with the following macro:

void tf3gl (int gl=1)
{
   if (gl==1) gStyle->SetCanvasPreferGL(true);
   auto c = new TCanvas("c", "TF3: Surface", 0, 0, 600, 600);

   if (gl==1) {
      TF3 *tf3 = new TF3("Surface","x*y*z+0.2", -1,1,-1,1,-1,1);
      tf3->Draw("glfbbb");
   } else {
      TF3 *tf3 = new TF3("Surface","x*y*z", -1,1,-1,1,-1,1);
      tf3->Draw("FBBB");
   }
}

In the file graf3d/gl/src/TGLTF3Painter.cxx in the method Bool_t TGLTF3Painter::InitGeometry() I see the line:

   builder.BuildMesh(fF3, geom, &fMesh, 0.2);

if I replace 0.2 by 0. on that line then the gl and non gl version behave the same.

May be @tpochep (the author if this code) has an idea why there is an hardcoded 0.2 there ?

I have done this change in the ROOT master.
The GL and non-GL version are the same now.
Thanks to have seen this mismatch.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.