Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to draw polygons with texture but in wireframe mode

128 views
Skip to first unread message

sesime

unread,
Apr 20, 2007, 1:52:01 AM4/20/07
to
How to draw polygons with texture but in wireframe mode

I want to draw my polygons with texture, but I also want to see the
wireframe, lines on the polygons, which displayed in high light color. That
is like modeling in 3DMax, you can see textures and the wireframe.

Thanks

Richard [Microsoft Direct3D MVP]

unread,
Apr 20, 2007, 9:08:02 AM4/20/07
to
[Please do not mail me a copy of your followup]

=?Utf-8?B?c2VzaW1l?= <ses...@discussions.microsoft.com> spake the secret code
<67554F60-7199-4109...@microsoft.com> thusly:

>How to draw polygons with texture but in wireframe mode

Just set the fill mode to D3DFILL_WIREFRAME.
--
"The Direct3D Graphics Pipeline" -- DirectX 9 draft available for download
<http://www.xmission.com/~legalize/book/download/index.html>

Legalize Adulthood! <http://blogs.xmission.com/legalize/>

[Jongware]

unread,
Apr 20, 2007, 10:12:07 AM4/20/07
to
"Richard [Microsoft Direct3D MVP]" <legaliz...@mail.xmission.com> wrote
in message news:%23HUauz0...@TK2MSFTNGP04.phx.gbl...

> [Please do not mail me a copy of your followup]
>
> =?Utf-8?B?c2VzaW1l?= <ses...@discussions.microsoft.com> spake the secret
> code
> <67554F60-7199-4109...@microsoft.com> thusly:
>
>>How to draw polygons with texture but in wireframe mode
>
> Just set the fill mode to D3DFILL_WIREFRAME.

It's a bit more complicated than that.
Probably, the OP will want to draw his objects filled first, then disable
the z-buffer (optional [? -- maybe not]), and THEN draw them in wireframe.
The wireframe also copies the textures, so he'll have to disable these and
draw them with a solid color. Perhaps lighting should be off as well.

[Jongware]


Richard [Microsoft Direct3D MVP]

unread,
Apr 20, 2007, 3:20:23 PM4/20/07
to
[Please do not mail me a copy of your followup]

"[Jongware]" <sorry@no_spam.plz> spake the secret code
<4628ca15$0$329$e4fe...@news.xs4all.nl> thusly:

>"Richard [Microsoft Direct3D MVP]" <legaliz...@mail.xmission.com> wrote
>in message news:%23HUauz0...@TK2MSFTNGP04.phx.gbl...
>> [Please do not mail me a copy of your followup]
>>
>> =?Utf-8?B?c2VzaW1l?= <ses...@discussions.microsoft.com> spake the secret
>> code
>> <67554F60-7199-4109...@microsoft.com> thusly:
>>
>>>How to draw polygons with texture but in wireframe mode
>>
>> Just set the fill mode to D3DFILL_WIREFRAME.
>
>It's a bit more complicated than that.

Oh, I see. I thought he just wanted the wireframe but I see after
looking more closely he wants to draw the lines on top of the
polygons. So yeah, what you recommend is probably the least that will
be required.

Ron Francis

unread,
Apr 20, 2007, 10:55:52 PM4/20/07
to
That is how I managed to do it.
The main problem I had was the lines fighting with the geometry in the same
way two co-planar surfaces fight.
My solution, although tacky, was to move the vertices toward the viewer a
small amount before drawing the lines.
The MeshViewer utility that comes with the SDK draws lines on the edges of
meshes very well, but unfortunately, the source code is no longer supplied
for it.

Regards,
Ron Francis
www.RonaldFrancis.com


"[Jongware]" <sorry@no_spam.plz> wrote in message
news:4628ca15$0$329$e4fe...@news.xs4all.nl...

[Jongware]

unread,
Apr 21, 2007, 7:49:24 PM4/21/07
to
"Ron Francis" <rfra...@senet.com.au> wrote in message
news:u20incGh...@TK2MSFTNGP04.phx.gbl...

> That is how I managed to do it.
> The main problem I had was the lines fighting with the geometry in the same
> way two co-planar surfaces fight.

You have to disable the z-buffer -- that'll take care of that!
Free tip 1: You also have the option of showing only 'forward' triangles (normal
culling), just the 'invisible' ones (reverse your backface culling the other way
around), or all (no culling).
Free tip 2: A nice way to highlight certain triangles is to draw them again (not
in wireframe), with the z-buffer disabled, and with a 50% transparent color.

[Jw]


Jan Bruns

unread,
Apr 21, 2007, 9:58:10 PM4/21/07
to

"[Jongware]":
> "Ron Francis":

>> That is how I managed to do it.
>> The main problem I had was the lines fighting with the geometry in the same
>> way two co-planar surfaces fight.

> You have to disable the z-buffer -- that'll take care of that!

But this also draws hidden lines.

Gruss

Jan Bruns

Ron Francis

unread,
Apr 24, 2007, 8:25:34 AM4/24/07
to
Jw,

Thanks for the tips. Free is always good value.

Regarding the z-buffer, ... I wait to see how you respond to Jan's post.

I would love to use D3DCULL_NONE for things like the interior of bowls
etc.when they don't have any thickness, but there is one major drawback.
If I create a simple scene with a light source and a triangle, and use
D3DCULL_NONE, the lighting is reversed for the backface of the triangle.
That is, the backface of the triangle is most lit when it is facing away
from the light source.
Unless there is something peculiarly odd with my app, it's is the nature of
how DX calculates the light against the triangle's normals and I can't see
an easy way to get around this.
Any ideas?

Free tip 2:
Yours is an interesting way to do it.
The way I do it is to increase the emissive property of the highlighted
triangles.
In this way you don't double up on drawing your primitives

Regards,
Ron Francis
www.RonaldFrancis.com


"[Jongware]" <IdontW...@hotmail.com> wrote in message
news:6f11$462aa2b9$3ec3d632$66...@news.chello.nl...

ZMan

unread,
Apr 24, 2007, 11:21:24 PM4/24/07
to
> The MeshViewer utility that comes with the SDK draws lines on the edges of
> meshes very well, but unfortunately, the source code is no longer supplied
> for it.

Its called DirectXViewer now and the source (C++ only) is still in the SDK I
have installed (April 2007)

Ron Francis

unread,
Apr 27, 2007, 11:13:31 PM4/27/07
to
Not sure of my SDK's release date, but it is 9.0 and doesn't contain the
source code.
Glad to hear that it has been re-introduced!

Regards,
Ron Francis
www.RonaldFrancis.com


"ZMan" <zm...@thezbuffer.com> wrote in message
news:%23SYmaju...@TK2MSFTNGP06.phx.gbl...

Richard [Microsoft Direct3D MVP]

unread,
Apr 29, 2007, 8:21:49 PM4/29/07
to
[Please do not mail me a copy of your followup]

"Ron Francis" <rfra...@senet.com.au> spake the secret code
<Ot7lJ5Zi...@TK2MSFTNGP03.phx.gbl> thusly:

>Not sure of my SDK's release date, but it is 9.0 and doesn't contain the
>source code.

Where are you looking for it?

In the April 2007 SDK its in Utilities\Source\DxViewer.

Ron Francis

unread,
May 1, 2007, 9:00:44 AM5/1/07
to
Richard,
I can't find any reference to the release date in my SDK, but it is 9.0b
"dx90bsdk.exe" and it didn't come with any source for the DxViewer.
As a matter of fact, it didn't install any of the directories you mentioned.
It came with a file "mview.exe" in \Bin\DXUtils.
There was an extras download for v8.1 so I'm wondering if I missed one for
v9.0b?

Regards,
Ron Francis
www.RonaldFrancis.com


"Richard [Microsoft Direct3D MVP]" <legaliz...@mail.xmission.com> wrote

in message news:OU0dM2ri...@TK2MSFTNGP04.phx.gbl...

Richard [Microsoft Direct3D MVP]

unread,
May 1, 2007, 11:25:56 AM5/1/07
to
[Please do not mail me a copy of your followup]

"Ron Francis" <rfra...@senet.com.au> spake the secret code

<e31meK$iHHA...@TK2MSFTNGP03.phx.gbl> thusly:

>I can't find any reference to the release date in my SDK, but it is 9.0b
>"dx90bsdk.exe" and it didn't come with any source for the DxViewer.

9.0b is quite old. I recommend you install a newer SDK as the current
runtime is version 9.0c.

>There was an extras download for v8.1 so I'm wondering if I missed one for
>v9.0b?

This is long ago enough that it might have been in the "SDK extras",
which was a separate download. At any rate I suggest you use at least
a 9.0c SDK, particularly if you use D3DX. Lots of D3DX bug fixes have
come in over the past few years.

Ron Francis

unread,
May 2, 2007, 6:57:59 AM5/2/07
to
I have been looking at it with longing eyes but it is so big!
But you have already commented on my post about that with subject "DX SDK on
CD"

Regards,
Ron Francis
www.RonaldFrancis.com


"Richard [Microsoft Direct3D MVP]" <legaliz...@mail.xmission.com> wrote

in message news:%23F8gEUA...@TK2MSFTNGP04.phx.gbl...

0 new messages