Main Menu

Wireframe

Started by Anonymous, September 21, 2003, 03:03:51 PM

Previous topic - Next topic

Anonymous

Is there a way to render wireframe?  If not, is there a method that will convert a 3d point to a point on the screen?

EgonOlsen

Quote from: "Anonymous"Is there a way to render wireframe?  If not, is there a method that will convert a 3d point to a point on the screen?
To answer your first question: No, there isn't (not yet). jPCT isn't targeted to that kind of rendering. Anyway, i've already thought about adding support for it...i just have to have a look at the software renderer if it would fit in there without much hassle. Are you using software or OpenGL mode? In the later case, i can offer to add a temporary solution that would work in OpenGL (i.e. hardware rendering) mode only (this is basically one line of code to add).
What exactly do you have in mind with your second question? There is a method to project and object's center from 3D into 2D, but there isn't a method to project all vertices of an object in that way.

Anonymous

QuoteAre you using software or OpenGL mode?
I'm using the software renderer.
QuoteWhat exactly do you have in mind with your second question?
Well, I could always manually draw lines if I knew where to draw them.  I could find the verticies of an object by using a vertex controller that doesn't modify the verticies, and then I could draw lines to connect them if I had a method that would take 3d points and convert them to 2d points on the screen.

EgonOlsen

Your idea with the VertexController is something i came up with too, but it would require a complete construction of a transformation matrix for EVERY VERTEX if the method to do the projection would be as simple as project3D2D(SimpleVector...). Another option would be to transform a whole bunch of vertices with one call but this isn't cheap nor very elegant either. That, and the VertexController doesn't give you information about how the vertices are connected. So you are ending up with a soup of projected vertices but you wouldn't know how to connect them to form triangles.
To make you understand why there is no wireframe support in jPCT: There is no line-algorithm in jPCT...simply because you don't need one for the things jPCT is doing. However, there is one in Java, but i can't use it because it can't be used on a MemoryImageSource and therefor i would break 1.1 compatibility if i would use it. Another point is, that the OpenGL wireframe mode draws something like textured and lit outlines of the polygons and not just simple "white lines". To emulate this behaviour in software, i would have to use the texturemapper with a kind of degenerated triangles...i tried this once, but it didn't work too well on flat edges.
As you can see, there are some problems with wireframe... :wink:
How important is wireframe mode for your project  :?:

Edit: Would it be sufficient to draw the whole scene in wireframe or are you talking about "wireframing" certain objects only?

Anonymous

Well, basically I'm trying to have an object that you can rotate to view at all angles.  I'm going to use wireframe for when you rotate it, so it will be fast even on slow computers.  Then, when you release the mouse, it will show it textured.  It's fine to have the whole scene in wireframe at once.

EgonOlsen

I'll see what i can do...i'll keep you informed!

Anonymous


EgonOlsen

Ok, i've added support for a wireframe mode for both, software- and GL-renderer. It will be included in the next release (0.94) which isn't too far away if everythings goes as planned (maybe in a week, maybe tomorrow...who knows...).

EgonOlsen

0.94 is out (see the News-section for more details).

Anonymous