gomidas

Members
  • Content count

    14
  • Joined

  • Last visited

Community Reputation

163 Neutral

About gomidas

  • Rank
    Member

Personal Information

  • Interests
    |programmer|
  1. Culling in SharpDX

    can anyone tell what it does if back face culling or front face culling set.
  2. I render it by clearing context.ClearDepthStencilView(depthView, DepthStencilClearFlags.Depth, 1.0f, 0); And also I did it larger but I did those already problem is when I have a mesh backwards front mesh's outline stays backward other mesh here is the result and issue : https://www.youtube.com/watch?v=4bcdfndc3sQ&feature=youtu.be
  3. I am trying to render outline for my mesh. I basicly re-render the mesh without texture and put color. My problem is I want to show the outline topmost. When I clear depthview after rendering outline mesh my outline stays background of target mesh but also background of other meshes. I want to show outline top of other meshes but behind of my target mesh ? Is that possible ? If I clear depthview for mesh and outline at this time my mesh will be top of other meshes which I do not want.
  4. Hmm, I am going to check that thank you very much.
  5. Alright, that would be perfect if there was an example usage about how will I put them inside. Buf for retriving existing cooords I do not have use that I can get correct positions over matrix and pass transformed coords to VertexData instead of it huh ? I think access is for animations (?)
  6. I am using a static vertex buffer. I need to get immediate update of vertex positions how can I achieve that instead re-creating a buffer everytime ? After getting dynamic buffer how will I update positinos ?   Thanks if anyone answer.
  7. I want to select my meshes with mouse on screen. I think I wiil need 2d coords of mesh vertices I use vector4 for it. Is there a simple way to do it ?   CoordinateConverter class         public Vector2 Convert_3Dto2D(Vector3 position, Matrix viewProj, RenderForm_EX form)         {             var project = Vector3.Project(position, 0, 0, form.ClientSize.Width, form.ClientSize.Height, 0, 1, viewProj);             Console.WriteLine(project.X+" "+ project.Y);             return new Vector2(project.X, project.Y);         } Inside RenderLoop if (MEListener.MouseDown) {    var viewProj = Matrix.Multiply(Meshes.MeshCollection[0].ViewLayer.Camera.getView(), proj); for (int _iV = 0; _iV < Meshes.MeshCollection[0].VertexData.Length; _iV++) {      CoordConverter.Convert_3Dto2D((Vector3)Meshes.MeshCollection[0].VertexData[_iV].Position + Meshes.MeshCollection[0].Position, viewProj, form); } } I think I did it correct. When I move mesh I can get still correct result I think. But what happens if I rotate or scale mesh ? For translation I do it like:  So I +add Position of mesh (Vector3)Meshes.MeshCollection[0].VertexData[_iV].Position + Meshes.MeshCollection[0].Position,... What should I Do to get coorect results ?
  8. Alright I fixed it by adding to my mesh class worldviewmatrix. Now each mesh has its own. I set positions from a Vector3 position and when calculation is done I use it inside WorldViewMatrix = Matrix.Translation (position.X,position.Y,position.Z) * ... * viewProj; Move operation inside render loop foreach (Mesh __mesh in Meshes.MeshCollection) {  if ( __mesh.IsSelected )   {                                 if (IHandler.KeyRight) { __mesh.Position.X += 0.050f; }                                 if (IHandler.KeyLeft) { __mesh.Position.X -= 0.050f; }                                 if (IHandler.KeyUp) { __mesh.Position.Z += 0.050f; }                                 if (IHandler.KeyDown) { __mesh.Position.Z -= 0.050f; }                                 if (IHandler.KeyQ) { __mesh.Position.Y -= 0.050f; }                                 if (IHandler.KeyE) { __mesh.Position.Y += 0.050f; }                             }                             __mesh.Render(contantBuffer,viewProj); }   Then if I should avoid to directly manipulate vertices how should I do some animation for my mesh just like in autodesk maya ? Example an water surface animation ???
  9. Thank you I fixed it. I checked my TEXCOORD call and I saw something like :  new InputElement("TEXCOORD", 0, Format.R32G32_Float, InputElement.AppendAligned, 0) I changed InputElement.AppendAligned to 16 and it was fixed for my cube. I did not get what does it mean InputElement.AppendAligned. However, problem is fixed.
  10.   Assuming of course that your object has a XMMATRIX member. You want to use matrices for transformations mostly for speed purposes as you don't have to edit potentially thousands of vertices, and re-upload them to the GPU for every key press, and a Matrix can describe a transformation in 64 bytes. That being said, I'd like to clarify, are you asking about overall mesh transformations, or vertice animation? Like a sine wave, or vegetation animation? Thank you for the answer, for now I was asking for the mesh transformation. If I got it correct you mean I will have World view projections for each mesh (?) I had one projection for all and I tried to move each mesh's vertices. //EXAMPLE : Matrix.Translation(-1,0,0); var worldViewProj = Matrix.Translation(-1,0,0)*Matrix.RotationX(45) * Matrix.RotationY(0 * 2) * Matrix.RotationZ(0 * .7f) * viewProj; Now should I change my setup to have multiple matrixes to move each mesh ? Then if I want to move camera instead of meshes should I do operation for all the mesh matrixes ?
  11. I am trying to manipulate vertices during rendering time in order to move my rendred object.   VertexBuffer:             var VertexBuffer = SharpDX.Direct3D11.Buffer.Create(_device, BindFlags.VertexBuffer, Vertices);   Vertices: Vertices = new[] //A BOX  {  new Vector4(-1.0f, -1.0f, -1.0f, 1.0f), new Vector4(1.0f, 0.0f, 0.0f, 1.0f),  ... new Vector4( 1.0f,  1.0f,  1.0f, 1.0f), new Vector4(0.0f, 1.0f, 1.0f, 1.0f),  }; Setting VertexBuffer:  d3dDevice.ImmediateContext.InputAssembler.SetVertexBuffers(0, new VertexBufferBinding(VertexBuffer, Utilities.SizeOf<Vector4>() * 2, 0)); My purpose is moving them on the screen left,right... so just like in games. Before I did something like :                 RenderLoop.Run(form, () =>                 {                             if ( __mesh.IsSelected )                             {                                 for (int i = 0; i <= __mesh.VerticesCount - 1; i++)                                 {                                 if (IHandler.KeyRight) __mesh.Vertices[i].X += 0.050f;                                 if (IHandler.KeyLeft) __mesh.Vertices[i].X -= 0.050f;                                 if (IHandler.KeyUp) __mesh.Vertices[i].Y += 0.050f;                                 if (IHandler.KeyDown) __mesh.Vertices[i].Y -= 0.050f;                                 }                             } //INSIDE RENDERLOOP I CREATED NEW BUFFER EVERY TIME (?) MOST PROBABLY THIS IS WRONG.             VertexBuffer = SharpDX.Direct3D11.Buffer.Create(device, BindFlags.VertexBuffer, Vertices); }); It worked but I am not sure if this is the correct way to do it. What should I do ?  
  12. There I added only part of the code it is not full normally I will add it. Most probably problem is UV but I do not know how to add UV. After adding how can I get it work ? There is something called IndexBuffer is that about UV ? How can I use UVs and get it work ?
  13. I am trying to display texture on mesh correctly but texture looks like crushed. I added references. I have texture on polygon I think there is UV problem.   Program.cs // Copyright (c) 2010-2013 SharpDX - Alexandre Mutel //  // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: //  // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. //  // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. using System; using System.Diagnostics; using System.Windows.Forms; using SharpDX; using SharpDX.D3DCompiler; using SharpDX.Direct3D; using SharpDX.Direct3D11; using SharpDX.DXGI; using SharpDX.Windows; using Buffer = SharpDX.Direct3D11.Buffer; using Device = SharpDX.Direct3D11.Device; using SharpDX.RawInput; using SharpDX.Multimedia; using CubeApp.EngineTools; using AlphaMode = SharpDX.Direct2D1.AlphaMode; using Factory = SharpDX.DXGI.Factory; using System.Threading; using System.Collections.Generic; using CubeApp.Configration; using CubeApp.Windows; namespace CubeApp {     /// <summary>     /// SharpDX MiniCube Direct3D 11 Sample     /// </summary>     internal static class Program     {         [STAThread]         private static void Main()         {             new Thread(new ThreadStart(() =>             {                 DisposeCollector DC=new DisposeCollector();                 var form = new RenderForm(Globals.Window_Title) { Width = Globals.Window_Size.Width, Height = Globals.Window_Size.Height, AllowUserResizing = false, MinimizeBox = false };                 InputHandler IHandler = new InputHandler(form);                 SampleDescription SamplerDesc = new SampleDescription(8, 0);                 // SwapChain description                 var desc = new SwapChainDescription()                 {                     BufferCount = 2,                     ModeDescription = new ModeDescription(form.ClientSize.Width, form.ClientSize.Height, new Rational(60, 1), Format.R8G8B8A8_UNorm),                     IsWindowed = true,                     OutputHandle = form.Handle,                     SampleDescription = SamplerDesc,                     SwapEffect = SwapEffect.Discard,                     Usage = Usage.RenderTargetOutput                 };                 var samplerStateDescription = new SamplerStateDescription                 {                     AddressU = TextureAddressMode.Wrap,                     AddressV = TextureAddressMode.Wrap,                     AddressW = TextureAddressMode.Wrap,                     Filter = Filter.MinMagMipLinear                 };                 var rasterizerStateDescription = RasterizerStateDescription.Default();                 rasterizerStateDescription.IsFrontCounterClockwise = true;                 // Used for debugging dispose object references                 Configuration.EnableObjectTracking = true;                 // Disable throws on shader compilation errors                 Configuration.ThrowOnShaderCompileError = false;                 SharpDX.DXGI.Factory factory = new SharpDX.DXGI.Factory1();                 SharpDX.DXGI.Adapter adapter = factory.GetAdapter(1);                 Adapter[] availableAdapters = factory.Adapters;                 foreach(Adapter _adapter in availableAdapters)                 {                     Console.WriteLine(_adapter.Description.Description);                 }                 // Create Device and SwapChain                 Device device;                 SwapChain swapChain;                 Device.CreateWithSwapChain(adapter, DeviceCreationFlags.SingleThreaded, desc, out device, out swapChain);                 var context = device.ImmediateContext;                 //factory.MakeWindowAssociation(form.Handle, WindowAssociationFlags.IgnoreAll);                 // Compile Vertex and Pixel shaders                 var vertexShaderByteCode = ShaderBytecode.CompileFromFile("MiniCube.hlsl", "VS", "vs_5_0", ShaderFlags.Debug);                 var vertexShader = new VertexShader(device, vertexShaderByteCode);                 var pixelShaderByteCode = ShaderBytecode.CompileFromFile("MiniCube.hlsl", "PS", "ps_5_0", ShaderFlags.Debug);                 var pixelShader = new PixelShader(device, pixelShaderByteCode);                 var signature = ShaderSignature.GetInputSignature(vertexShaderByteCode);                 // Layout from VertexShader input signature                 var layout = new InputLayout(device, signature, new[]                 {                 new InputElement("POSITION", 0, Format.R32G32B32A32_Float, 0, 0),                 new InputElement("NORMAL", 0, Format.R32G32B32A32_Float, 0, 0),                 new InputElement("COLOR", 0, Format.R32G32B32A32_Float, 16, 0),                 new InputElement("TEXCOORD", 0, Format.R32G32_Float, InputElement.AppendAligned, 0)                 });                 var samplerState = new SamplerState(device, samplerStateDescription);                 Mesh mesh1 = new Mesh("mesh1", new[] { new Vector4(0, 0, 0, 1) }, "", device, "1_Purple.jpg") { IsSelected=true };                 Mesh mesh2 = new Mesh("mesh2", new[] { new Vector4(0, 0, 0, 1) }, "", device, "1_Purple.jpg");                 //MenuCreator menu1 = new MenuCreator(device,new[] {new Vector4(0, 0, 0, 0) });                 // Create Constant Buffer                 var contantBuffer = new Buffer(device, Utilities.SizeOf<Matrix>(), ResourceUsage.Default, BindFlags.ConstantBuffer, CpuAccessFlags.None, ResourceOptionFlags.None, 0);                 ShaderResourceView textureView;                 SharpDX.WIC.ImagingFactory2 ImagingFactory2 = new SharpDX.WIC.ImagingFactory2();                 // Prepare All the stages                 context.InputAssembler.InputLayout = layout;                 context.VertexShader.SetConstantBuffer(0, contantBuffer);                 context.VertexShader.Set(vertexShader);                 context.PixelShader.Set(pixelShader);                 context.PixelShader.SetSampler(0, samplerState);                 //context.PixelShader.SetShaderResource(0, textureView);                 Matrix proj = Matrix.Identity;                 // Use clock                 var clock = new Stopwatch();                 FPS fps = new FPS();                 clock.Start();                 // Declare texture for rendering                 bool userResized = true;                 Texture2D backBuffer = null;                 RenderTargetView renderView = null;                 Texture2D depthBuffer = null;                 DepthStencilView depthView = null;                 // Setup handler on resize form                 form.UserResized += (sender, args) => userResized = true;                 // Setup full screen mode change F5 (Full) F4 (Window)                 form.KeyUp += (sender, args) =>                 {                     if (args.KeyCode == Keys.F5)                     swapChain.SetFullscreenState(true, null);                     else if (args.KeyCode == Keys.F4)                         swapChain.SetFullscreenState(false, null);                     else if (args.KeyCode == Keys.Escape)                         form.Close();                 };                 //CREATE DEPTH STENCIL DESCRIPTION                 DepthStencilStateDescription depthSSD = new DepthStencilStateDescription();                 depthSSD.IsDepthEnabled = false;                 depthSSD.DepthComparison = Comparison.LessEqual;                 depthSSD.DepthWriteMask = DepthWriteMask.Zero;                 DepthStencilState DSState = new DepthStencilState(device, depthSSD);                 Camera camera = new Camera();                 camera.eye = new Vector3(0, 0, -5);                 camera.target = new Vector3(0, 0, 0);                 Globals.Render = true;                 /*void DrawEmptyCircle(Vector3 startPoint, Vector2 radius, Color color)                 {                     List<VertexPositionColor> circle = new List<VertexPositionColor>();                     float X, Y;                     var stepDegree = 0.3f;                     for (float angle = 0; angle <= 360; angle += stepDegree)                     {                         X = startPoint.X + radius.X * (float)Math.Cos((angle));                         Y = startPoint.Y + radius.Y * (float)Math.Sin((angle));                         Vector3 point = new Vector3(X, Y, 0);                         circle.Add(new VertexPositionColor(point, color));                     }                 }*/                 CubeApp.Windows.SystemInformation.Print(CubeApp.Windows.SystemInformation.GetSystemInformation());                 HardwareInformation.GetHardwareInformation("Win32_DisplayConfiguration", "Description");                 // Main loop                 RenderLoop.Run(form, () =>                 {                                              fps.Count();fps.setFormHeader(form);                     // Prepare matrices                     if (Globals.Render)                     {                         var view = camera.getView();                     // If Form resized                     if (userResized)                     {                         // Dispose all previous allocated resources                         Utilities.Dispose(ref backBuffer);                         Utilities.Dispose(ref renderView);                         Utilities.Dispose(ref depthBuffer);                         Utilities.Dispose(ref depthView);                             foreach (Mesh _mesh in Meshes.MeshCollection)                         {                             if (_mesh.IsDisposed == false)                             {                                 Utilities.Dispose(ref _mesh.VerticesBuffer);                             }                         }                             // Resize the backbuffer                             swapChain.ResizeBuffers(desc.BufferCount, form.ClientSize.Width, form.ClientSize.Height, Format.Unknown, SwapChainFlags.None);                             // Get the backbuffer from the swapchain                             backBuffer = Texture2D.FromSwapChain<Texture2D>(swapChain, 0);                             // Renderview on the backbuffer                             renderView = new RenderTargetView(device, backBuffer);                             // Create the depth buffer                             depthBuffer = new Texture2D(device, new Texture2DDescription()                             {                                 Format = Format.D32_Float_S8X24_UInt,                                 ArraySize = 1,                                 MipLevels = 1,                                 Width = form.ClientSize.Width,                                 Height = form.ClientSize.Height,                                 SampleDescription = SamplerDesc,                                 Usage = ResourceUsage.Default,                                 BindFlags = BindFlags.DepthStencil,                                 CpuAccessFlags = CpuAccessFlags.None,                                 OptionFlags = ResourceOptionFlags.None                             });                             // Create the depth buffer view                             depthView = new DepthStencilView(device, depthBuffer);                             // Setup targets and viewport for rendering                             context.Rasterizer.SetViewport(new Viewport(0, 0, form.ClientSize.Width, form.ClientSize.Height, 0.0f, 1.0f));                             //context.OutputMerger.SetDepthStencilState(DSState);                             context.OutputMerger.SetTargets(depthView, renderView);                             // Setup new projection matrix with correct aspect ratio                             proj = Matrix.PerspectiveFovLH((float)Math.PI / 4.0f, form.ClientSize.Width / (float)form.ClientSize.Height, 0.1f, 100.0f);                             // We are done resizing                             userResized = false;                         }                         var time = clock.ElapsedMilliseconds / 1000.0f;                         var viewProj = Matrix.Multiply(view, proj);                 // Clear views                 context.ClearDepthStencilView(depthView, DepthStencilClearFlags.Depth, 1.0f, 0);                 context.ClearRenderTargetView(renderView, Color.WhiteSmoke);                 // Update WorldViewProj Matrix                 var worldViewProj = Matrix.RotationX(45) * Matrix.RotationY(0 * 2) * Matrix.RotationZ(0 * .7f) * viewProj;                 worldViewProj.Transpose();                 context.UpdateSubresource(ref worldViewProj, contantBuffer);                     //Update Camera Position                     Vector3 _camEye = camera.eye;                     Vector3 _camTarget = camera.target;                     if (IHandler.KeyW)                     {                         _camEye.Z+= 0.050f; _camTarget.Z += 0.050f;                     }                     if (IHandler.KeyS)                     {                         _camEye.Z -= 0.050f; _camTarget.Z -= 0.050f;                     }                     if (IHandler.KeyA)                     {                             _camEye.X -= 0.050f; _camTarget.X -= 0.050f;                     }                     if (IHandler.KeyD)                     {                         _camTarget.X += 0.050f;                         _camEye.X += 0.050f;                     }                     if (IHandler.KeyQ)                     {                     }                     camera.eye = _camEye;                     camera.target = _camTarget;                     camera.updateView();                     // Draw the cube                     foreach (Mesh __mesh in Meshes.MeshCollection)                     {                         if ( __mesh.IsSelected )                         {                             for (int i = 0; i <= __mesh.VerticesCount - 1; i++)                             {                                 if (IHandler.KeyRight) __mesh.Vertices[i].X += 0.050f;                                 if (IHandler.KeyLeft) __mesh.Vertices[i].X -= 0.050f;                                 if (IHandler.KeyUp) __mesh.Vertices[i].Y += 0.050f;                                 if (IHandler.KeyDown) __mesh.Vertices[i].Y -= 0.050f;                             }                     }                             var texture = TextureLoader.CreateTexture2DFromBitmap(device, TextureLoader.LoadBitmap(ImagingFactory2, __mesh.Texture_DiffuseMap));                             textureView = new ShaderResourceView(device, texture);                             context.PixelShader.SetShaderResource(0, textureView);                             texture.Dispose();                             textureView.Dispose();                             __mesh.VerticesBuffer = SharpDX.Direct3D11.Buffer.Create(device, BindFlags.VertexBuffer, __mesh.Vertices);                         //EnvironmentDisplayModes.SetDisplayMode(device, __mesh, EnvironmentDisplayModes.DisplayMode.Standart);                         __mesh.Render();                 }                     /*context.ClearDepthStencilView(depthView, DepthStencilClearFlags.Depth, 1.0f, 0);                     var view2 = Matrix.LookAtLH(new Vector3(0, 0, -10), new Vector3(0, 0, 0), Vector3.UnitY);                     var viewProj2 = Matrix.Multiply(view2, proj);                     var worldViewProj2 = Matrix.RotationX(0) * Matrix.RotationY(0) * Matrix.RotationZ(0) * viewProj2;                     worldViewProj2.Transpose();                     context.UpdateSubresource(ref worldViewProj2, contantBuffer);                     */                     /*for (int i = 0; i <= menu1.VerticesCount - 1; i++)                     {                         if (IHandler.KeyRight) menu1.Vertices[i].X -= 0.010f;                         if (IHandler.KeyLeft) menu1.Vertices[i].X += 0.010f;                         if (IHandler.KeyUp) menu1.Vertices[i].Y -= 0.010f;                         if (IHandler.KeyDown) menu1.Vertices[i].Y += 0.010f;                     }                     menu1.VerticesBuffer = SharpDX.Direct3D11.Buffer.Create(device, BindFlags.VertexBuffer, menu1.Vertices);                     menu1.Render();                     context.Draw(menu1.VerticesCount, 0);*/                 // Present!                 swapChain.Present(0, PresentFlags.None);                     }                 });                 // Release all resources                 foreach (Mesh msh in Meshes.MeshCollection)                 {                     msh.d3dDevice.Dispose();                     msh.VerticesBuffer.Dispose();                 }             DC.DisposeAndClear();             signature.Dispose();             vertexShaderByteCode.Dispose();             vertexShader.Dispose();             pixelShaderByteCode.Dispose();             pixelShader.Dispose();             layout.Dispose();             contantBuffer.Dispose();             depthBuffer.Dispose();             depthView.Dispose();             renderView.Dispose();             backBuffer.Dispose();             ImagingFactory2.Dispose();             //context.ClearState();             //context.Flush();                 device.Dispose();             context.Dispose();             swapChain.Dispose();             factory.Dispose();             adapter.Dispose();             DSState.Dispose();             samplerState.Dispose();             DC.Dispose();             form.Dispose();             })).Start();             /*new Thread(new ThreadStart(() =>             { ToolWindow tw = new ToolWindow(); })).Start();*/     }     } } Mesh.cs using ChamberLib.Content; using CubeApp.EngineTools; using SharpDX; using SharpDX.Direct3D; using SharpDX.Direct3D11; using SharpDX.DXGI; using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Runtime.InteropServices; using System.Text; using System.Threading.Tasks; using FBX = FbxSharp; using FBXCL = ChamberLib; namespace CubeApp {     public class Mesh : IDisposable     {         public string File;         public string Name;         public Vector4[] Vertices { get; set; }         public int VerticesCount=0;         public Vector3 Position; //BASED ON PIVOT         public Vector3 PivotPosition; //MOVE MESH BASED ON THIS POSITION         public Vector3 Rotation;         public double Weight;         public SharpDX.Direct3D11.Device d3dDevice;         public SharpDX.Direct3D11.Buffer VerticesBuffer;         public bool IsDisposed=false;         public bool IsSelected = false;         public int Triangles;         public string Texture_DiffuseMap;         public Vector2 [] UV=new Vector2[]         {            new Vector2(0f,0f),            new Vector2(1f,0f),            new Vector2(1f,1f),            new Vector2(0f,1f)             };         public Mesh(string _name, Vector4[] _vertices, string _file, SharpDX.Direct3D11.Device _device, string _Texture_DiffuseMap = "")         {             Vertices = new[]             {                 new Vector4(-1.0f, -1.0f, -1.0f, 1.0f), new Vector4(1.0f, 0.0f, 0.0f, 1.0f), // Front                 new Vector4(-1.0f,  1.0f, -1.0f, 1.0f), new Vector4(1.0f, 0.0f, 0.0f, 1.0f),                 new Vector4( 1.0f,  1.0f, -1.0f, 1.0f), new Vector4(1.0f, 0.0f, 0.0f, 1.0f),                 new Vector4(-1.0f, -1.0f, -1.0f, 1.0f), new Vector4(1.0f, 0.0f, 0.0f, 1.0f),                 new Vector4( 1.0f,  1.0f, -1.0f, 1.0f), new Vector4(1.0f, 0.0f, 0.0f, 1.0f),                 new Vector4( 1.0f, -1.0f, -1.0f, 1.0f), new Vector4(1.0f, 0.0f, 0.0f, 1.0f),                 new Vector4(-1.0f, -1.0f,  1.0f, 1.0f), new Vector4(0.0f, 1.0f, 0.0f, 1.0f), // BACK                 new Vector4( 1.0f,  1.0f,  1.0f, 1.0f), new Vector4(0.0f, 1.0f, 0.0f, 1.0f),                 new Vector4(-1.0f,  1.0f,  1.0f, 1.0f), new Vector4(0.0f, 1.0f, 0.0f, 1.0f),                 new Vector4(-1.0f, -1.0f,  1.0f, 1.0f), new Vector4(0.0f, 1.0f, 0.0f, 1.0f),                 new Vector4( 1.0f, -1.0f,  1.0f, 1.0f), new Vector4(0.0f, 1.0f, 0.0f, 1.0f),                 new Vector4( 1.0f,  1.0f,  1.0f, 1.0f), new Vector4(0.0f, 1.0f, 0.0f, 1.0f),                 new Vector4(-1.0f, 1.0f, -1.0f,  1.0f), new Vector4(0.0f, 0.0f, 1.0f, 1.0f), // Top                 new Vector4(-1.0f, 1.0f,  1.0f,  1.0f), new Vector4(0.0f, 0.0f, 1.0f, 1.0f),                 new Vector4( 1.0f, 1.0f,  1.0f,  1.0f), new Vector4(0.0f, 0.0f, 1.0f, 1.0f),                 new Vector4(-1.0f, 1.0f, -1.0f,  1.0f), new Vector4(0.0f, 0.0f, 1.0f, 1.0f),                 new Vector4( 1.0f, 1.0f,  1.0f,  1.0f), new Vector4(0.0f, 0.0f, 1.0f, 1.0f),                 new Vector4( 1.0f, 1.0f, -1.0f,  1.0f), new Vector4(0.0f, 0.0f, 1.0f, 1.0f),                 new Vector4(-1.0f,-1.0f, -1.0f,  1.0f), new Vector4(1.0f, 1.0f, 0.0f, 1.0f), // Bottom                 new Vector4( 1.0f,-1.0f,  1.0f,  1.0f), new Vector4(1.0f, 1.0f, 0.0f, 1.0f),                 new Vector4(-1.0f,-1.0f,  1.0f,  1.0f), new Vector4(1.0f, 1.0f, 0.0f, 1.0f),                 new Vector4(-1.0f,-1.0f, -1.0f,  1.0f), new Vector4(1.0f, 1.0f, 0.0f, 1.0f),                 new Vector4( 1.0f,-1.0f, -1.0f,  1.0f), new Vector4(1.0f, 1.0f, 0.0f, 1.0f),                 new Vector4( 1.0f,-1.0f,  1.0f,  1.0f), new Vector4(1.0f, 1.0f, 0.0f, 1.0f),                 new Vector4(-1.0f, -1.0f, -1.0f, 1.0f), new Vector4(1.0f, 0.0f, 1.0f, 1.0f), // Left                 new Vector4(-1.0f, -1.0f,  1.0f, 1.0f), new Vector4(1.0f, 0.0f, 1.0f, 1.0f),                 new Vector4(-1.0f,  1.0f,  1.0f, 1.0f), new Vector4(1.0f, 0.0f, 1.0f, 1.0f),                 new Vector4(-1.0f, -1.0f, -1.0f, 1.0f), new Vector4(1.0f, 0.0f, 1.0f, 1.0f),                 new Vector4(-1.0f,  1.0f,  1.0f, 1.0f), new Vector4(1.0f, 0.0f, 1.0f, 1.0f),                 new Vector4(-1.0f,  1.0f, -1.0f, 1.0f), new Vector4(1.0f, 0.0f, 1.0f, 1.0f),                 new Vector4( 1.0f, -1.0f, -1.0f, 1.0f), new Vector4(0.0f, 1.0f, 1.0f, 1.0f), // Right                 new Vector4( 1.0f,  1.0f,  1.0f, 1.0f), new Vector4(0.0f, 1.0f, 1.0f, 1.0f),                 new Vector4( 1.0f, -1.0f,  1.0f, 1.0f), new Vector4(0.0f, 1.0f, 1.0f, 1.0f),                 new Vector4( 1.0f, -1.0f, -1.0f, 1.0f), new Vector4(0.0f, 1.0f, 1.0f, 1.0f),                 new Vector4( 1.0f,  1.0f, -1.0f, 1.0f), new Vector4(0.0f, 1.0f, 1.0f, 1.0f),                 new Vector4( 1.0f,  1.0f,  1.0f, 1.0f), new Vector4(0.0f, 1.0f, 1.0f, 1.0f),             };             Texture_DiffuseMap = _Texture_DiffuseMap;             _vertices = Vertices;             d3dDevice = _device;             VerticesCount = Vertices.Count();             /* var _verticesBuffer = SharpDX.Direct3D11.Buffer.Create(_device, BindFlags.VertexBuffer, Vertices);              VerticesBuffer = _verticesBuffer;*/             Name = _name;             File = _file;             Meshes.Add(this);         }         // Other functions go here...         public void Dispose()         {             Dispose(true);             GC.SuppressFinalize(this);             IsDisposed = true;         }         protected virtual void Dispose(bool disposing)         {             if (disposing)             {                 Dispose();             }             // free native resources if there are any.             VerticesBuffer.Dispose();             IsDisposed = true;         }         public void Render()         {             d3dDevice.ImmediateContext.InputAssembler.PrimitiveTopology = PrimitiveTopology.TriangleList;             d3dDevice.ImmediateContext.InputAssembler.SetVertexBuffers(0, new VertexBufferBinding(VerticesBuffer, Utilities.SizeOf<Vector4>() * 2, 0));             d3dDevice.ImmediateContext.Draw(VerticesCount,0);                          VerticesBuffer.Dispose();         }     } } Is that about IndexBuffer. If that is how can I correclty set it ? I use Draw instead should I use DrawIndexed but if I do that I see nothing is rendered.
  14. I am using Direct3d11 and when I want to mix it with direct2d I face with error. I got that it has no support for 11 but why ? Am I missing something ? or Is there any simple trick to use it directly over 11 without 10 ?
  15. So I get from answer I will not able to mix direct 2d text drawing on 3d scene I will create textures from font files. Still, I will use 3d drawing but that will look like 2d.