Author Topic: Wireframe  (Read 7311 times)

Anonymous

  • Guest
Wireframe
« on: September 21, 2003, 03:03:51 pm »
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?

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Wireframe
« Reply #1 on: September 22, 2003, 06:06:17 pm »
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

  • Guest
Wireframe
« Reply #2 on: September 22, 2003, 11:16:46 pm »
Quote
Are you using software or OpenGL mode?

I'm using the software renderer.
Quote
What 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.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Wireframe
« Reply #3 on: September 23, 2003, 12:27:46 am »
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

  • Guest
Wireframe
« Reply #4 on: September 23, 2003, 12:59:37 am »
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.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Wireframe
« Reply #5 on: September 23, 2003, 06:28:43 pm »
I'll see what i can do...i'll keep you informed!

Anonymous

  • Guest
Wireframe
« Reply #6 on: September 23, 2003, 09:32:25 pm »
Thanks.  :D

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Wireframe
« Reply #7 on: September 24, 2003, 12:34:18 am »
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...).

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Wireframe
« Reply #8 on: September 25, 2003, 10:47:55 pm »
0.94 is out (see the News-section for more details).

Anonymous

  • Guest
Wireframe
« Reply #9 on: September 27, 2003, 03:38:37 am »
Thank you.  :D