How to create a mesh "manually"
How to create a mesh "manually"
How to create a mesh "manually"
How to create a mesh "manually"
How to create a mesh "manually"
How to create a mesh "manually" How to create a mesh "manually" How to create a mesh "manually" How to create a mesh "manually" How to create a mesh "manually" How to create a mesh "manually" How to create a mesh "manually" How to create a mesh "manually"
How to create a mesh "manually" How to create a mesh "manually"
How to create a mesh "manually"
Go Back  Xtreme Visual Basic Talk > > > > How to create a mesh "manually"


Reply
 
Thread Tools Display Modes
  #1  
Old 03-30-2006, 03:00 PM
parduz parduz is offline
Newcomer
 
Join Date: Nov 2003
Location: Italy
Posts: 17
Default How to create a mesh "manually"


I need a working sample code that shows me how to create a mesh by code, with different submesh and textures.
I've read a bunch of web page about it, but i can't figure out how i should do this.
Pls help me, being the last step i need to finish my little app.
Thanks
Reply With Quote
  #2  
Old 04-04-2006, 12:37 AM
guest_5432How to create a mesh "manually" guest_5432 is offline
Junior Contributor

* Expert *
 
Join Date: Nov 2005
Posts: 259
Default Creating a mesh using D3DXCreateMeshFVF

Quote:
Originally Posted by parduz
I need a working sample code that shows me how to create a mesh by code, with different submesh and textures.
I've read a bunch of web page about it, but i can't figure out how i should do.
Wouldn't it be special if we all got what we "need" just be asking..

First of all (to clue you in) the number of working DirectX VB code samples is (and has always been) somewhat limited.

Many of the working code samples that you can/do find out there on the Internet are simply variations on the samples that come with the DirectX SDKs.

Here's a quote:
Quote:
It doesn't take a genius to realise that these models are not hard-coded into the game - doing that would require 1000's of lines for each frame of an animation - not a very clever way of doing things.
..from the DirectX4Vb tutorial on "loading pre-created objects":
http://directx4vb.vbgamer.com/Direct...R_Lesson08.asp

Also -- creating 3D mesh objects directly from code would be somewhat (very) tedious.

That is why people who create 3D objects/models use special software that allows them shape 3D objects (including meshes) interactively using a GUI.
Then the 3D objects are saved to 3D model files which are then converted to DirectX files -- which can be loaded and manipulated using the DirectX API.
This definitely seems the standard way of doing things

If you do a search of the forum's LegacyVB DirectX section using the term "mesh" you'll find that most threads on the topic are from people who have trouble just loading a mesh from a pre-created DirectX file.

I'm not saying that the DirectX API doesn't have the means to create meshes manually. Unfortunately (as your research has probably shown..although it would have been helpful to cite the web pages you visited), most of the online MSDN documentation for DirectX is oriented toward the C/C++ programmer, including this page on the D3DXCreateMeshFVF function:
http://msdn.microsoft.com/archive/de...atemeshfvf.asp

The only reason I could think of that your project would need to be able to create a mesh manually is if you where doing some kind of 3D modelling utility and if that is the case --good luck.
I have yet to see such a "sample" of a 3D interactive model editor written in VB.

Last edited by guest_5432; 04-04-2006 at 12:53 AM.
Reply With Quote
  #3  
Old 04-04-2006, 12:52 AM
parduz parduz is offline
Newcomer
 
Join Date: Nov 2003
Location: Italy
Posts: 17
Default

Quote:
Originally Posted by guest_5432
Wouldn't it be special if we all got what we "need" just be asking.. ....
What a waste of time. "Philosophy of the Meshes" would be a good title for you next book. Pls use your poetry somewhere else.

Anyway, i still need to understand how to make a complete mesh programmatically. And i means that i've more or less understood how a mesh is built in memory, i just need to se the VB version of the code that do it. Pointer are things that VB have not, and i'm tired to make "1 try per 1 reboot".
Reply With Quote
  #4  
Old 04-04-2006, 01:01 AM
guest_5432How to create a mesh "manually" guest_5432 is offline
Junior Contributor

* Expert *
 
Join Date: Nov 2005
Posts: 259
Default Pure poetry

Quote:
Originally Posted by parduz
What a waste of time. "Philosophy of the Meshes" would be a good title for you next book.
I guess I can scratch your reserved copy then.

Just for the record -
You gave nothing in your original post - not a single line of code, or link..

..I at least cited the necessary function (D3DXCreateMeshFVF) for the next person who reads this thread (even if it is C/C++ DirectX function, maybe the next person will find a way to convert it to VB - pointers can sometimes be "simulated" in VB using the CopyMemory and VarPtr APIs):
http://www.codeproject.com/useritems...ters_In_VB.asp
Reply With Quote
  #5  
Old 04-04-2006, 02:40 AM
DaftasBrush's Avatar
DaftasBrushHow to create a mesh "manually" DaftasBrush is offline
Senior Contributor

* Expert *
 
Join Date: Jun 2003
Location: A room without Windows
Posts: 896
Default

Leade posted quite a nice Mesh Class not so long ago...
Check out this thread
Even if you don't use it directly, it's got everything you need to create a mesh "from code"

For future reference, passing pointers in VB can be as easy as just passing the variable. When a function uses a byref argument, that's exactly what you're doing... most of the DirectX functions work that way.

PS. You'll find that the VB declarations of many functions vary slightly from the C/C++ one, look in the DX8 CHM, rather than MS Website..
Code:
D3DX8.CreateMeshFVF : Creates a mesh object using a flexible vertex format (FVF) code.
object.CreateMeshFVF(
    NumFaces As Long, _ 
    NumVertices As Long, _ 
    Options As Long, _ 
    FVF As Long, _ 
    Device As Direct3DDevice8) As D3DXMesh
HTH
__________________
Dan B
"Don't anthropomorphize computers. They don't like it."
Trig is for wuss's - Coordinate Geometry RULES!

Last edited by DaftasBrush; 04-04-2006 at 02:59 AM.
Reply With Quote
  #6  
Old 04-04-2006, 06:48 AM
parduz parduz is offline
Newcomer
 
Join Date: Nov 2003
Location: Italy
Posts: 17
Default

DaftaBrush, this is Great! I wonder why that thread does'nt come out while i was searching for something like that before my post...
Anyway, now i understand what i need to do... thanks a lot.
Reply With Quote
  #7  
Old 07-12-2009, 04:54 PM
arfgh arfgh is offline
Newcomer
 
Join Date: Jul 2008
Posts: 8
Default

i also wanted to do the same, but for some reasson cant make that the render to show my custom mesh
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
How to create a mesh "manually"
How to create a mesh "manually"
How to create a mesh "manually" How to create a mesh "manually"
How to create a mesh "manually"
How to create a mesh "manually"
How to create a mesh "manually" How to create a mesh "manually" How to create a mesh "manually" How to create a mesh "manually" How to create a mesh "manually" How to create a mesh "manually" How to create a mesh "manually"
How to create a mesh "manually"
How to create a mesh "manually"
 
How to create a mesh "manually"
How to create a mesh "manually"
 
-->