vertex declaration ? translate to VB
vertex declaration ? translate to VB
vertex declaration ? translate to VB
vertex declaration ? translate to VB
vertex declaration ? translate to VB
vertex declaration ? translate to VB vertex declaration ? translate to VB vertex declaration ? translate to VB vertex declaration ? translate to VB vertex declaration ? translate to VB vertex declaration ? translate to VB vertex declaration ? translate to VB vertex declaration ? translate to VB
vertex declaration ? translate to VB vertex declaration ? translate to VB
vertex declaration ? translate to VB
Go Back  Xtreme Visual Basic Talk > > > > vertex declaration ? translate to VB


Reply
 
Thread Tools Display Modes
  #1  
Old 04-28-2009, 09:42 AM
Chris Ara Chris Ara is offline
Centurion
 
Join Date: Feb 2005
Posts: 176
Question vertex declaration ? translate to VB


I'm trying create a vertex declaration but the code I'm using is in C# and I'm trying to convert it to VB. I'm having some trouble here is the code

C#
VertexElement[] velements = new VertexElement[]
{
new VertexElement(0, 0, DeclarationType.Float3, DeclarationMethod.Default, DeclarationUsage.Position, 0),
new VertexElement(0, 12, DeclarationType.Color, DeclarationMethod.Default, DeclarationUsage.Color, 0),
VertexElement.VertexDeclarationEnd
};
vd = new VertexDeclaration(device, velements);

VB

Code:
 Dim Velements As VertexElement() = New VertexElement(0 To 1) {}

        Velements(0) = New VertexElement(0, 0, DeclarationType.Float3, DeclarationMethod.Default, DeclarationUsage.Position, 0)
        Velements(1) = New VertexElement(0, 12, DeclarationType.Color, DeclarationMethod.Default, DeclarationUsage.Color, 0)
       VertexElement.VertexDeclarationEnd() <-------- this code causes an error

        VD = New VertexDeclaration(nDevice, Velements)
I can't use the vertexdeclarationend function it doesn't work right any suggestions. :>
Reply With Quote
  #2  
Old 04-28-2009, 10:20 AM
Qua's Avatar
Quavertex declaration ? translate to VB Qua is offline
Impetuous & volatile

* Expert *
 
Join Date: Apr 2005
Posts: 2,177
Default

I suppect you don't quite understand what the code is doing. You need to specify when your element is over. This is done by letting the last element in your array be the structure VertexDeclarationEnd.
Code:
 Dim Velements As VertexElement() = New VertexElement(0 To 2) {}

        Velements(0) = New VertexElement(0, 0, DeclarationType.Float3, DeclarationMethod.Default, DeclarationUsage.Position, 0)
        Velements(1) = New VertexElement(0, 12, DeclarationType.Color, DeclarationMethod.Default, DeclarationUsage.Color, 0)
      Velements(2) = VertexElement.VertexDeclarationEnd()

        VD = New VertexDeclaration(nDevice, Velements)
You could have used any C# to VB.NET translator and it would have given you the same result.
__________________
Reading is the foundation for all knowledge - Unknown.
Reply With Quote
  #3  
Old 04-28-2009, 01:32 PM
Chris Ara Chris Ara is offline
Centurion
 
Join Date: Feb 2005
Posts: 176
Default

gotcha I was reading through the article I got this code bit from and it explained what the format was I just didn't realize the end declaration was in the array. I'm such a newb lol , tyvm
Reply With Quote
  #4  
Old 04-28-2009, 01:59 PM
Qua's Avatar
Quavertex declaration ? translate to VB Qua is offline
Impetuous & volatile

* Expert *
 
Join Date: Apr 2005
Posts: 2,177
Default

Reading Riermer's on HLSL per chance?
__________________
Reading is the foundation for all knowledge - Unknown.
Reply With Quote
  #5  
Old 04-28-2009, 02:08 PM
Chris Ara Chris Ara is offline
Centurion
 
Join Date: Feb 2005
Posts: 176
Talking

That's correct :> I'm just having a slow time translating it to VB. Where could I download a good translator from. I'm learning C++ atm so I don't have the time to pick up C# , maybe later I will.
Reply With Quote
  #6  
Old 04-28-2009, 02:23 PM
Qua's Avatar
Quavertex declaration ? translate to VB Qua is offline
Impetuous & volatile

* Expert *
 
Join Date: Apr 2005
Posts: 2,177
Default

VB is really a lot like C# except for a lot of curles and some few specific language features and C++ is also a lot like C# in way of basic syntax with curles and ending semicolons. You should be capable of understanding most C#, and for the bit that you might have some trouble with or you're just too lazy to translate there are plenty of translators online to be found with a quick search on google
__________________
Reading is the foundation for all knowledge - Unknown.
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
vertex declaration ? translate to VB
vertex declaration ? translate to VB
vertex declaration ? translate to VB vertex declaration ? translate to VB
vertex declaration ? translate to VB
vertex declaration ? translate to VB
vertex declaration ? translate to VB vertex declaration ? translate to VB vertex declaration ? translate to VB vertex declaration ? translate to VB vertex declaration ? translate to VB vertex declaration ? translate to VB vertex declaration ? translate to VB
vertex declaration ? translate to VB
vertex declaration ? translate to VB
 
vertex declaration ? translate to VB
vertex declaration ? translate to VB
 
-->