Re: Creating mesh at runtime for use with CD3DFrame

From: Phil Taylor (phil_at_private-citizen.com)
Date: 01/15/05

  • Next message: mikegi: "Re: Using large images for creating OSD"
    Date: Sat, 15 Jan 2005 11:31:13 -0800
    
    

    given that additional data, its hard to tell what your problem is.

    and if if failed without using CD3DMesh, simply translating the non mesh
    code to mesh code isnt going to fix it. you need to understand what the
    problem is first with raw geometry before progressing.

    given those input coordinates, it doesnt appear to be a size of the model
    problem. but it could be an ordering or triangle definition problem. draw in
    wireframe to see what is going on, and with culling off.

    what is the world transform you use to render this object? and where is the
    camera? is part of the object behind the camera?

    try drawing the object without lighting and textures, to see that its
    correctly placed and sized in the world.

    have you stepped thru theCD3DFrame code in the debugger to see what is going
    on? sometimes, thats what you have to do. its hard for someone to remote
    debug your code via usenet.

    there is no magic silver bullet.

    "Faraz Azhar" <itz_farazSTOPSPAM@hotSPAMmail.com> wrote in message
    news:um2GqFz%23EHA.3820@TK2MSFTNGP11.phx.gbl...
    > Well Phil that does not seem to be the problem. I tried creating this in a
    > test app without using CD3DFrame. It was a simple app that loaded
    > coordinates into array, then I calculated the normals and supplied texture
    > coordinates, then I created a mesh with it, and when I rendered the
    > mesh....
    > it appeared to be waaaaaaaayy tooo big. and the texture was tiled all over
    > it. It was so big I couldnt even see the other end... it came out like a
    > never-ending road. Nothing's wrong with camera or other transformations..
    > I
    > know this because other objects are loading and displaying fine within the
    > same app.
    >
    > Tell me something... ive given the coordinates.. how to write a code that
    > would convert these coordinates into a D3DXMesh?
    >
    >
    > "Phil Taylor" <phil@private-citizen.com> wrote in message
    > news:#kE98oy#EHA.2584@TK2MSFTNGP09.phx.gbl...
    >> disable lighting and disable culling.
    >>
    >> that will tell you that the geometry works at all.
    >>
    >> then if you turn culling back on, and the model disappears you have a
    >> winding order problem. look up culling and winding order in the SDK.
    >>
    >> once you have that sorted, then turn lighting back on. make sure the
    >> clear
    >> color is not black. if you have all black geometry, then you have a
    > lighting
    >> issue. either the vertex or material color is bad, or the normals are
    >> bad.
    >>
    >> then you can move on to textures, texture coordinates, and texture stage
    >> states.
    >>
    >> and yes, you have to supply normals and texture coordinates.
    >>
    >> reading the SDK samples that use CD3DFrame, use lighting, and display
    >> textures is a good first step. that includes the C++ docs and samples.
    > they
    >> do more than the VB samples.
    >>
    >> "Faraz Azhar" <itz_farazSTOPSPAM@hotSPAMmail.com> wrote in message
    >> news:%23XfwlYx%23EHA.1300@TK2MSFTNGP14.phx.gbl...
    >> > Hello,
    >> >
    >> > Im trying to use the CD3DFrame for holding my objects/meshes. I have
    >> > created
    >> > a simple app that uses all the helper modules supplied with DX 8.1 SDK
    > for
    >> > VB. That app loads a mesh (from X file) and displays it in a picture
    >> > box
    >> > (im
    >> > using directx on a picturebox). It all works ok.
    >> >
    >> > Now im trying to create a mesh in runtime, apply texture to it and
    >> > encapsulate it in CD3DFrame. Even with soo many functions, libraries,
    > help
    >> > files around; I am still unable to figure out how to do it.
    >> >
    >> > The mesh I want to create is a simple diamond shape (square you might
    >> > say).
    >> > I have the following coordinates:
    >> > (x, y, z, ny, nz, tu, tv)
    >> > -1, 0, 0, 0, 0, 0, 0.5
    >> > 0, 1, 0, 0, 0, 0.5, 0
    >> > 1, 0, 0, 0, 0, 1, 0.5
    >> > 1, 0, 0, 0, 0, 1, 0.5
    >> > 0, -1, 0, 0, 0, 0.5, 1
    >> > -1, 0, 0, 0, 0, 0, 0.5
    >> >
    >> > I collect all these into an "unlit vertex" format array, and use the
    >> > following code to encapsulate the object into the CD3DFrame:
    >> >
    >> > Dim meshTile As D3DXMesh
    >> > Set meshTile = g_d3dx.CreatePolygon(g_dev, Len(vertDiamond(0)) * 6, 6,
    >> > Nothing)
    >> >
    >> > Dim g_frameroot as CD3DFrame
    >> > Set g_frameroot = New CD3DFrame
    >> > g_frameroot.AddD3DXMesh meshTile
    >> >
    >> >
    >> > Well... no errors occur but nothing displays as well. How should I do
    > it?
    >> > Im
    >> > really having trouble trying to understand all the functions in the
    > helper
    >> > modules... the above method which I wrote was to create an object
    > only...
    >> > how do I supply the texture file to it? and will the "ComputeNormals"
    >> > of
    >> > CD3DFrame automatically calculate the normals for the vertices (after
    > the
    >> > frame is created) or do I have to do it manually?
    >> >
    >> > Thank you!
    >> >
    >> > Faraz Azhar
    >> > [Using DX 8.1 on VB6]
    >> >
    >> >
    >>
    >>
    >
    >


  • Next message: mikegi: "Re: Using large images for creating OSD"