Страница: 1 | 
		
		
			
	
		 
		
			
  
    |   | 
    
Вопрос: VB + DX
     | 
    
Добавлено: 29.12.08 12:25
     | 
      | 
  
		
			
			  
    
      
Автор вопроса:   -=Fenix=-
       | 
    
    
      
        Dim Verts(3) As Microsoft.DirectX.Direct3D.CustomVertex.PositionNormalColored
 
 
        Verts(0).Position = New Microsoft.DirectX.Vector3(0.0F, 1.0F, 1.0F)
 
        Verts(0).Normal = New Microsoft.DirectX.Vector3(0.0F, 0.0F, -1.0F)
 
        Verts(0).Color = Color.White.ToArgb
 
 
        Verts(1).Position = New Microsoft.DirectX.Vector3(-1.0F, -1.0F, 1.0F)
 
        Verts(1).Normal = New Microsoft.DirectX.Vector3(0.0F, 0.0F, -1.0F)
 
        Verts(1).Color = Color.White.ToArgb
 
 
        Verts(2).Position = New Microsoft.DirectX.Vector3(1.0F, -1.0F, 1.0F)
 
        Verts(2).Normal = New Microsoft.DirectX.Vector3(0.0F, 0.0F, -1.0F)
 
        Verts(2).Color = Color.White.ToArgb
 
 
        Device.RenderState.CullMode = Microsoft.DirectX.Direct3D.Cull.None
 
 
        Device.RenderState.Lighting = True
 
        Device.Lights(0).Type = Microsoft.DirectX.Direct3D.LightType.Point
 
        Device.Lights(0).Position = New Microsoft.DirectX.Vector3()
 
        Device.Lights(0).Diffuse = System.Drawing.Color.White
 
        Device.Lights(0).Attenuation0 = 1.0F
 
        Device.Lights(0).Range = 1000.0F
 
        Device.Lights(0).Update()
 
        Device.Lights(0).Enabled = True
 
        Device.RenderState.Ambient = Color.White
 
 
        Vertex_Buffer = New Microsoft.DirectX.Direct3D.VertexBuffer(GetType(Microsoft.DirectX.Direct3D.CustomVertex.PositionColored), 3, Device, Microsoft.DirectX.Direct3D.Usage.Dynamic Or Microsoft.DirectX.Direct3D.Usage.WriteOnly, Microsoft.DirectX.Direct3D.CustomVertex.PositionNormalColored.Format, Microsoft.DirectX.Direct3D.Pool.Default)
 
        Vertex_Buffer.SetData(Verts, 0, Microsoft.DirectX.Direct3D.LockFlags.None)
 
 
 
        Device.BeginScene()
 
 
        Device.VertexFormat = Microsoft.DirectX.Direct3D.CustomVertex.PositionNormalColored.Format
 
        Device.SetStreamSource(0, Vertex_Buffer, 0)
 
        Device.DrawPrimitives(Microsoft.DirectX.Direct3D.PrimitiveType.TriangleList, 0, 1)
 
 
        Device.EndScene()
 
 
При компиляции вылетает на Vertex_Buffer = New ... с ошибкой:
 
AccessViolationException was unhandled (Попытка чтения или записи в защищенную память. Это часто свидетельствует о том, что другая память повреждена.)
 
 
брррр, подскажите - в чём причина?
Ответить
        | 
    
  
		
			
		
		
			
		
	  Страница: 1 | 
 
		
			Поиск по форуму