JOGLFBOTextureExample question

Have jReality programming problems or questions? Post them here.
Post Reply
cznlzq
Posts: 17
Joined: Mon 5. Mar 2012, 22:55

JOGLFBOTextureExample question

Post by cznlzq » Tue 20. Nov 2012, 17:04

Hi,

I run the JOGLFBOTextureExample, it runs fine.

However, when I add the 3D text to scene and then try to using the FBO, it just messed up.

What I expected is that both the icosahedron and the 3D text are rendered to the FBO, but it doesn't deliver what I want.

A simple example is to add the following codes in the JOGLFBOTextureExample just after the creation of the icosahedron.

IndexedFaceSet ifs = Primitives.icosahedron();
geometryNode.setGeometry(ifs);

//Tex
PointSetFactory psf_x = new PointSetFactory();
double [][] vertice_x = new double[][] { {1, 0, 0} };
psf_x.setVertexCount( vertice_x.length );
psf_x.setVertexCoordinates( vertice_x );
psf_x.update();
PointSet ps_x = psf_x.getPointSet();
int n_x=ps_x.getNumPoints();
String[] label_x = new String[n_x];
label_x[0] = "Tex";
ps_x.setVertexAttributes(Attribute.LABELS, StorageModel.STRING_ARRAY.createReadOnly(label_x));
SceneGraphComponent text_x = new SceneGraphComponent();
text_x.setName("TexTextX");
text_x.setGeometry(ps_x);
Appearance text_xAp = new Appearance();
DefaultGeometryShader dgs_x = ShaderUtility.createDefaultGeometryShader(text_xAp, false);
dgs_x.setShowFaces(false);
dgs_x.setShowLines(false);
dgs_x.setShowPoints(true);
DefaultTextShader pts_x = (DefaultTextShader) ((DefaultPointShader)dgs_x.getPointShader()).getTextShader();
pts_x.setDiffuseColor(Color.RED);
double[] offset_x = new double[]{-.001,0,0};
pts_x.setOffset(offset_x);
Double scale_x = new Double(0.0001);
pts_x.setScale(.75*scale_x);
Font f_x = new Font("Arial Bold", Font.ITALIC, 38);
pts_x.setFont(f_x);
text_x.setAppearance(text_xAp);
geometryNode.addChild(text_x);

It looks like the 3D text also uses the texture and I guess it causes some problems in the rendering pipeline.

Any ideas?

Thank you.

cznlzq
Posts: 17
Joined: Mon 5. Mar 2012, 22:55

Re: JOGLFBOTextureExample question

Post by cznlzq » Tue 20. Nov 2012, 23:19

I just figured out because the scale of 3D text is too small......

Set it bigger then it looks great.

Post Reply