Problem on immediate mode rendering.

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Problem on immediate mode rendering.

Smat
I want to draw an object after canvas3d has finished rendering and here is the code so far.
@override
Void postRender(){
Super.postRender();
g=getGraphicsContext3D();
g.addLight(somelight);
g.flush();
g2d=getGraphics2D();
g2d.drawRect(0,0,1,1);
g2d.flush();
g.draw(someshape3D);
Paint(getGraphics2D);

}
What this code does is it will render a shape3d after java3d has finished rendering . Their for the shape3d (in this case someshape3d) will always be rendered on top and won't be culled or hide; which is perfect. The problem i am having now is when someshape3d is rendered , it is not perfectly rendered as other objects in the scene that were added to scenebranchgraph; someshape3d's size is small and it's 3d to 2d drawing is not accurate. Is their anybody who can tell me why ? Thank you for reading and i hope i got replie from java3d guys, or anyone who can answer it. Thank you!
Reply | Threaded
Open this post in threaded view
|

Re: Problem on immediate mode rendering.

gouessej
Administrator
Hi

Maybe you can modify the transform of "someshape3d" to obtain the desired effect.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Problem on immediate mode rendering.

Smat
That is my question. dude! Which transform3d is making the problem?
Because as it seems(and as you notice) even if both objects(someshape3D and the one on the scenebranchgroup) their is a clear size difference between them. Which i suspect the object in the scenebranchgroup is transformed. My question is which transform3D ?.(Note i didn't use any transform3D.)
 And after trying some code i can even generate the problem by just adding this code before g2d.drawRect(0,0,1,1); The code is =
g.draw(new Sphere(0.3f).getShape()); and by replacing "someshape3D"
With "new sphere(0.3f).getShape()". As you can see the two spheres have same radius but after render their is a huge difference b/n them. Why did this happen ? Any explanation at all so that i can dig based on that ? Or, should i just use some transform3D and use it to transform the shape ?(note i am using manual resize for transformation by trial and error). Would i get consistency in different devices if i go by the manual "try until you get equal shapes on your device" way ? What if different screen size devices need different "resizing factor" ? It will be greate to know what make this difference. Thanks!
 
Reply | Threaded
Open this post in threaded view
|

Re: Problem on immediate mode rendering.

Smat
Sorry for the typo's; here it is the code.
@override
Void postRender(){
Super.postRender();
g=getGraphicsContext3D();
g.addLight(somelight);
g.flush();
g2d=getGraphics2D();
g.draw(new Sphere(0.3f).getShape());
g2d.drawRect(0,0,1,1);
g2d.flush();
g.draw(new Sphere(0.3f).getShape());
Paint(getGraphics2D);
}
On the above code... even if both spheres have equal radius they will get render in different sizes. Thank you for understanding.
Reply | Threaded
Open this post in threaded view
|

Re: Problem on immediate mode rendering.

gouessej
Administrator
You should provide a SSCCE. Maybe Harvey, August or Emmanual could help you better than me.
Julien Gouesse | Personal blog | Website