Results 1 to 16 of 16

Thread: How do you render in wireframe?

  1. #1

    Thread Starter
    Addicted Member Cuallito's Avatar
    Join Date
    Apr 2001
    Location
    You know that chest that you could never get opened? If you ever do, I'm there.
    Posts
    136

    Arrow How do you render in wireframe?

    How can you tell D3D you want to render in wireframe? Im using meshes, so linelist won't work. BTW this is DX8.
    BTW, Thanks for all your help

    Member of the anti-gay cross-dressing trans-species wolves alliance.

  2. #2
    Good Ol' Platypus Sastraxi's Avatar
    Join Date
    Jan 2000
    Location
    Ontario, Canada
    Posts
    5,134
    You should PM or email Zaei. Like he says he is great with D3D8.
    All contents of the above post that aren't somebody elses are mine, not the property of some media corporation.
    (Just a heads-up)

  3. #3
    Zaei
    Guest
    D3DDevice.SetRenderState D3DRS_FILLMODE, D3DFILL_WIREFRAME.

    to go back to regular:

    D3DDevice.SetRenderState D3DRS_FILLMODE, D3DFILL_SOLID.

    Z.

  4. #4

    Thread Starter
    Addicted Member Cuallito's Avatar
    Join Date
    Apr 2001
    Location
    You know that chest that you could never get opened? If you ever do, I'm there.
    Posts
    136

    thx

    Thanks my man ;P
    BTW, Thanks for all your help

    Member of the anti-gay cross-dressing trans-species wolves alliance.

  5. #5
    Zaei
    Guest
    I havent downloaded the Zip, but for the things that dont want to draw, try "D3DDevice.SetRenderState D3DRS_CULLMODE, D3DCULL_NONE". This stops D3D from culling triangles. For the floar thing, just create a big square, with a custom vertex using "D3DFVF_XYZ or D3DFVF_DIFFUSE or D3DFVF_TEX1", where your vertex type is:
    Code:
    Type TEXTVERT
       X as single
       Y as single
       Z as single
       color as long
       tu as single
       tv as single
    End Type
    "tu" and "tv" are the texture "x" and "y" coordinates. they range from 0.0, to 1.0. So, say we have a square....
    Code:
    (0.0),(0.0)+-----------+(1.0),(0.0)
               |\          |
               |  \        |
               |    \      |
               |      \    |
               |        \  |
    (0.0),(1.0)+-----------+(1.0),(1.0)
    The coordinates are your texture coordinates. In this example, im showing the entire texture. if all of the "1.0"s at the bottom were "0.5"s, id be showing half of the texture.

    If you have any questions, let me know, and ill see what i can do to help.

    Z.

  6. #6
    Hyperactive Member Wak's Avatar
    Join Date
    Nov 2000
    Location
    Brisbane, Queensland
    Posts
    298

    Unhappy Thanx

    Thanx for the help,
    I'll try to explain a little better. I've already had all the stuff done which you explained in the previous post, I even had that exact vertex type, the main problem, is that I actually assign the texture to the floor, but it does nothing. I don't get any errors, but also, the floor remains at the four colours that I initially apointed to it. I think that there is something else that I have to set to make it work, for example, I left the tv and tu variables at 0, cause I'm not too sure what they do, and also, the floor is 50 x 50, and my texture is 128 x 128. Plz help me as soon as possible.
    Visual Basic 6.0 Enterprise
    Visual C++ 6.0 Professional

    Wak

  7. #7
    Good Ol' Platypus Sastraxi's Avatar
    Join Date
    Jan 2000
    Location
    Ontario, Canada
    Posts
    5,134
    Not too sure as I am not the best with 3D, but I think you need to set the tU and tV settings (UxV, texture width x texture height) to 128x128. This (I believe) sets what drawing width you get from the texture.
    All contents of the above post that aren't somebody elses are mine, not the property of some media corporation.
    (Just a heads-up)

  8. #8
    Hyperactive Member Wak's Avatar
    Join Date
    Nov 2000
    Location
    Brisbane, Queensland
    Posts
    298

    Exclamation Thanx

    I'll try it when I get home
    Visual Basic 6.0 Enterprise
    Visual C++ 6.0 Professional

    Wak

  9. #9
    Zaei
    Guest
    Ok. I fixed your project up. The first thing in noticed was that you were using Triangle lists to render your triangles, but you were passing 6 as the number of primitives. You have to set this to 2, because you only want to draw 2 triangles. I guess you were thinking of vertices (ive done that =).

    As to the floor thing, there were two things going on. The first, as Sastraxi said, was that you hadnt set up your tu and tv values. The second was that you werent calling D3DDevice.SetTexture before rendering. Here is the code you should replace:

    Code:
    '//Draw the Landscape
    D3DDevice.SetTexture 0, floorTexture
    D3DDevice.SetStreamSource 0, VScapeBuffer, Len(Landscape(0))
    D3DDevice.DrawPrimitive D3DPT_TRIANGLELIST, 0, 2
    D3DDevice.SetTexture 0, Nothing
               
    '//Draw the Roof
    D3DDevice.SetStreamSource 0, VRoofBuffer, Len(Landscape(0))
    D3DDevice.DrawPrimitive D3DPT_TRIANGLELIST, 0, 2
               
    'Side1
    D3DDevice.SetStreamSource 0, vSide1Buffer, Len(Sidescape1(0))
    D3DDevice.DrawPrimitive D3DPT_TRIANGLELIST, 0, 2
               
    'Draw the player.  It moves!!
    D3DDevice.SetTransform D3DTS_WORLD, matSquare 'Make character move
    D3DDevice.SetStreamSource 0, VTriBuffer, Len(triList(0))
    D3DDevice.DrawPrimitive D3DPT_TRIANGLELIST, 0, 1
                
    TextRect.Top = 0
    TextRect.bottom = 20
    TextRect.Right = 150
    D3DX.DrawText MainFont, &HFFFFCC00, "Press Esc to Exit..", TextRect, DT_TOP Or DT_LEFT
                
    TextRect.Top = 20
    TextRect.bottom = 40
    TextRect.Right = 250
    D3DX.DrawText MainFont, &HFFFFCC00, "Made by Matt Warner...", TextRect, DT_TOP Or DT_LEFT
                
    TextRect.Top = 40
    TextRect.bottom = 60
    TextRect.Right = 150
    D3DX.DrawText MainFont, &HFFFFCC00, "3D-World!", TextRect, DT_TOP Or DT_LEFT
    I moved the text drawing to the bottom because it won't show if you draw it first. This is because when you draw onto the back buffer, if you draw some text, then some geometry on top, it is just like BitBlt, or something similar. The text gets covered up. Draw it last, always.

    Here is the part i changed in your geometry initialization:
    Code:
    'Floor
    Landscape(0) = CreateLitVertex(-0, DFC, 50, cGreen, 0, 0, 1)  'far right point
    Landscape(1) = CreateLitVertex(-0, DFC, -0, cGreen, 0, 0, 0) 'Closes point right 1/2
    Landscape(2) = CreateLitVertex(50, DFC, 50, cGreen, 0, 1, 1) 'Farback point right 1/2
    Landscape(3) = CreateLitVertex(-0, DFC, -0, cGreen, 0, 0, 0) 'Closest point left 1/2
    Landscape(4) = CreateLitVertex(50, DFC, -0, cGreen, 0, 1, 0) 'Far left point
    Landscape(5) = CreateLitVertex(50, DFC, 50, cGreen, 0, 1, 1) 'Farback point left 1/2
    I just set up the tu and tv values. Note how they range from 0 to 1. Also a tip that i recommend, is that yous hould never use fullscreen until you know that your rendering isnt going to crash, and even better, until you know you wont have to do any breaking in your code at all. When using windowed mode, DO NOT set the back buffer width or height. I suggest a function that takes in a boolean to tell it if you want windowed or not, and the backbuffer heights and widths. When you set your presentparams if you want windowed, dont set the back buffer height or width.

    Hope that helps you out.

    Z.

  10. #10
    Zaei
    Guest
    I just re-read Sastraxi's post, and i have to make a correction. For textures, tu and tv can only range from 0.0 to 1.0. They are percentages. Textures can only be of sizes 2^X.

    Z.

  11. #11
    Hyperactive Member Wak's Avatar
    Join Date
    Nov 2000
    Location
    Brisbane, Queensland
    Posts
    298

    Zaei, u are an absolute legend

    I owe u so so much, than u, thank u, thank u. If you have a website with banners on it anywhere, tell me it and I'll visit it 100000000 times just to get you the 1 cent per click or whatever. Thanks. But of course, now I can't be happy. That textture that waz there, how can I tile that as the floor instead? Really sorry, but thanx a million....
    Visual Basic 6.0 Enterprise
    Visual C++ 6.0 Professional

    Wak

  12. #12
    Hyperactive Member Wak's Avatar
    Join Date
    Nov 2000
    Location
    Brisbane, Queensland
    Posts
    298

    lol

    Yey, I am not Ignoramus, I figured it out. But I thought of another question to keep u busy. I changed the tu values to 10, and I notice that half of my floor triangle, that in part makes up the square, shows the texture differently to the other half?? How can I fix this?
    Visual Basic 6.0 Enterprise
    Visual C++ 6.0 Professional

    Wak

  13. #13
    Zaei
    Guest
    Looks fine to me...

    Z.

  14. #14
    Good Ol' Platypus Sastraxi's Avatar
    Join Date
    Jan 2000
    Location
    Ontario, Canada
    Posts
    5,134
    They must ALWAYS be 1 according to Zaei
    All contents of the above post that aren't somebody elses are mine, not the property of some media corporation.
    (Just a heads-up)

  15. #15
    Zaei
    Guest
    They dont HAVE to be 1, but that just shows the entire texture.

    Z.

  16. #16
    Hyperactive Member Wak's Avatar
    Join Date
    Nov 2000
    Location
    Brisbane, Queensland
    Posts
    298

    Thanx

    I got it now, thanx for the help.
    Visual Basic 6.0 Enterprise
    Visual C++ 6.0 Professional

    Wak

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width