type of  trouble
type of  trouble
type of  trouble
type of  trouble
type of  trouble
type of  trouble type of  trouble type of  trouble type of  trouble type of  trouble type of  trouble type of  trouble type of  trouble
type of  trouble type of  trouble
type of  trouble
Go Back  Xtreme Visual Basic Talk > > > > type of trouble


Reply
 
Thread Tools Display Modes
  #1  
Old 10-07-2006, 02:15 PM
psychotomusSim psychotomusSim is offline
Centurion
 
Join Date: Apr 2006
Posts: 192
Default type of trouble


im converting this C++ code to vb.net

C++
Code:
private VertexBuffer vb;
public void createTriangle()
{
      CustomVertex.PositionColored[] triangle = new CustomVertex.PositionColored[3]; //create an array of 3 vertices
      //using the CustomVertex.PositionColored constructor to set each vertex 
      triangle[0] = new CustomVertex.PositionColored(-0.1f, 0.0f, 1.0f, Color.Blue.ToArgb()); 
      triangle[1] = new CustomVertex.PositionColored(-0.1f, 0.2f, 1.0f, Color.Red.ToArgb());
      triangle[2] = new CustomVertex.PositionColored(0.1f, 0.0f, 1.0f, Color.Green.ToArgb());
      vb = new VertexBuffer(typeof(CustomVertex.PositionColored), 3, direct3d.XilathDevice, Usage.WriteOnly, CustomVertex.PositionColored.Format, Pool.Managed);
      GraphicsStream stm; //our GraphicsStream object that we will use to access the 
      //lock the VB. Locks a range of vertex data and obtains the vertex buffer memory and stores it in the GraphicsStream object (stm) 
      stm = vb.Lock(0, 0, LockFlags.None); 
      stm.Write(triangle); //write the triangle array to the GraphicsStream Object
      vb.Unlock(); //unlock the VertexBuffer, we are finished writing the data to it.
}

VB
Code:
        Dim triangle(2) As CustomVertex.PositionColored
        triangle(0) = New CustomVertex.PositionColored(-0.1F, 0.0F, 1.0F, Color.Blue.ToArgb())
        triangle(1) = New CustomVertex.PositionColored(-0.1F, 0.2F, 1.0F, Color.Red.ToArgb())
        triangle(2) = New CustomVertex.PositionColored(0.1F, 0.0F, 1.0F, Color.Green.ToArgb())
        vertex = New VertexBuffer(typeof(CustomVertex.PositionColored), 3, GraphicsDevice, Usage.WriteOnly, CustomVertex.PositionColored.Format, Pool.Managed)
        Dim stm As GraphicsStream
        'lock the VB. Locks a range of vertex data and obtains the vertex buffer memory and stores it in the GraphicsStream object (stm) 
        stm = vertex.Lock(0, 0, LockFlags.None)
        stm.Write(triangle) 'write the triangle array to the GraphicsStream Object
        vertex.Unlock() 'unlock the VertexBuffer, we are finished writing the data to it.

i get an error on this line

vertex = New VertexBuffer(typeof(CustomVertex.PositionColored), 3, GraphicsDevice, Usage.WriteOnly, CustomVertex.PositionColored.Format, Pool.Managed)


saying CustomVertex.PositionColored cant no be used as an expression.
__________________
Game Maker Forums - Game Programming Forums
Online RPG Creator - Create your own Web Game
Reply With Quote
  #2  
Old 10-07-2006, 03:02 PM
Iceplug's Avatar
Iceplugtype of  trouble Iceplug is offline
MetaCenturion

Retired Moderator
* Guru *
 
Join Date: Aug 2001
Location: Iowa, USA
Posts: 16,583
Default

Use GetType() function instead.
__________________

Iceplug, USN
Quadrill 1 Quadrill 2 (full) Quadrill 3 JumpCross .NET Website is ALIVE! - DL Platform Tour for VB.NET! Posting Guidelines Hint: Specify your location in your user cp profile if you want compassion!
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
type of  trouble
type of  trouble
type of  trouble type of  trouble
type of  trouble
type of  trouble
type of  trouble type of  trouble type of  trouble type of  trouble type of  trouble type of  trouble type of  trouble
type of  trouble
type of  trouble
 
type of  trouble
type of  trouble
 
-->