Making a Custom mesh
Making a Custom mesh
Making a Custom mesh
Making a Custom mesh
Making a Custom mesh
Making a Custom mesh Making a Custom mesh Making a Custom mesh Making a Custom mesh Making a Custom mesh Making a Custom mesh Making a Custom mesh Making a Custom mesh
Making a Custom mesh Making a Custom mesh
Making a Custom mesh
Go Back  Xtreme Visual Basic Talk > > > > Making a Custom mesh


Reply
 
Thread Tools Display Modes
  #1  
Old 07-12-2009, 10:55 AM
arfgh arfgh is offline
Newcomer
 
Join Date: Jul 2008
Posts: 8
Default Making a Custom mesh


Hi

i want to create a custom mesh and render it, but i had not lucky at these moments. For example... i can do the follow

Set mesh = g_D3DX.CreateTeapot(g_D3DDevice, Nothing)

and render it with

mesh.DrawSubset 0

and all is ok, but now the problem is when i try to set the vertexes and buffer data that i initialize:

'A structure for our custom vertex type representing a point on the screen
Private Type CUSTOMVERTEX '24 bytes
position As vector
colors As Long
texcoord As uv
End Type

Const D3DFVF_CUSTOMVERTEX = (D3DFVF_XYZ Or D3DFVF_DIFFUSE Or D3DFVF_TEX1)

InitGeometry buffer
Set mesh = g_D3DX.CreateMeshFVF(buffer.polys, buffer.vertices, D3DXMESH_VB_MANAGED, D3DFVF_CUSTOMVERTEX, g_D3DDevice)
If mesh Is Nothing Then Stop
D3DXMeshVertexBuffer8SetData mesh, 0, buffer.vertices * 24, 0, buffer.buffer(0)

and now when i render the mesh i cant see any polygon.

Please help ! what i am doing bad ?

Last edited by arfgh; 07-13-2009 at 07:16 AM.
Reply With Quote
  #2  
Old 07-13-2009, 03:09 AM
AdrianDeAngelis's Avatar
AdrianDeAngelis AdrianDeAngelis is offline
Contributor
 
Join Date: May 2005
Location: Australia
Posts: 549
Default

There are so many things that you could be doing wrong... I can only give you a few hints since I don't actually use D3D8 but A few thoughts come to mind

Have you actually created any vertices?
Are your vertices ordered correctly? (ie: clockwise order)
Have you got the correct number of vertices to render?
What about your render settings... you need to set lighting etc... to render something in 3D.

My advice would be to try to load a .x file... something that you know will work and then test your render settings and see if you can draw something on the screen. If not then you need to fix that first before you start fiddling with making a mesh yourself.
__________________
Automation error... What do you mean automation error you %#@*&!$ thing!

Star Admiral: 3D tactical space sim *** New Version 0.38 10/01/09 ***
Damage, shields and special weapons systems
Reply With Quote
  #3  
Old 07-13-2009, 07:16 AM
arfgh arfgh is offline
Newcomer
 
Join Date: Jul 2008
Posts: 8
Default

yes yes,, using the drawing primitives function instead of the mesh.drawsubset,the object is visible. All is correct. But the thing now is that i want to create a custom mesh and not use the loadFormX function.

i tried to test if the custom vertexes are set to the buffer or not with the follow lines...

Setmesh = g_D3DX.CreateMeshFVF(buffer.polys, .buffer.vertices, D3DXMESH_VB_MANAGED, D3DFVF_CUSTOMVERTEX, g_D3DDevice)
D3DXMeshVertexBuffer8SetData mesh, 0, buffer.vertices * 24, 0, buffer.buffer(0)

Dim vertex() As CUSTOMVERTEX, x As Long
ReDim vertex(buffer.vertices)
D3DXMeshVertexBuffer8GetData mesh, 0, buffer.vertices * 24, 0, vertex(0)
For x = 0 To UBound(vertex)
Debug.Print vertex(x).position.x
Next

and yes, all the values for my custom vertexes were correctly set.
But then... why the "mesh.DrawSubset 0" dont paint the object ?

thx in advance for the help
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
Making a Custom mesh
Making a Custom mesh
Making a Custom mesh Making a Custom mesh
Making a Custom mesh
Making a Custom mesh
Making a Custom mesh Making a Custom mesh Making a Custom mesh Making a Custom mesh Making a Custom mesh Making a Custom mesh Making a Custom mesh
Making a Custom mesh
Making a Custom mesh
 
Making a Custom mesh
Making a Custom mesh
 
-->