Jump to content
  • Advertisement

Albeoris

Member
  • Content Count

    17
  • Joined

  • Last visited

Community Reputation

125 Neutral

About Albeoris

  • Rank
    Member
  1. Albeoris

    The texture appears partially

      Unfortunately I need to use SharpDX.
  2. Hi there,   I have a legacy texture 2d in the one of these formats: 8bppIndexed, 16bppArgb1555, 16bppRgb555, 24bppRgb How I can use DirectX11 to show them?   Thank you for your attention.
  3. Solved! Thank you!         protected static DeviceCreationFlags GetDeviceCreationFlags()         {             DeviceCreationFlags flags = DeviceCreationFlags.BgraSupport; #if (DEBUG)             flags |= DeviceCreationFlags.Debug; #endif             return flags;         }
  4. Albeoris

    The texture appears partially

      I am not copying it from the one device to the other. I just sharing it. private ShaderResourceView GetShaderResourceView(Device device) { lock (_sharedViews) { IntPtr viewPointer; if (_sharedViews.TryGetValue(device.NativePointer, out viewPointer)) return new ShaderResourceView(viewPointer); using (SharpDX.DXGI.Resource resource = Texture.QueryInterface<SharpDX.DXGI.Resource>()) using (Resource sharedResource = device.OpenSharedResource<Resource>(resource.SharedHandle)) { ShaderResourceView shaderView = new ShaderResourceView(device, sharedResource); _sharedViews.Add(device.NativePointer, shaderView.NativePointer); return shaderView; } } } And yes. It chopping off the bottom of the texture. But I'm not to do that. It does not matter - there is clipping or not. If I just draw a texture 256x256 in 640x480 window, I can only see part of the texture. If I save it before - the whole texture.
  5. Hi there,   I am use SharpDX 2.6.3.0. My application is working fine for me (Windows 7) but fail for other man (WIndows 10): "The application requested an operation that depends on an SDK component that is missing or mismatched"   How to solve the issue? I How to unbind the application from a specific SDK and force it to use the redistributable?
  6. Albeoris

    The texture appears partially

    Yes.   Latest version is required Visual Studio 2015. Heaps of xaml errors are result of comiling errors of the other library.
  7. Albeoris

    The texture appears partially

      1) private void OnRenderControlPaint(object sender, PaintEventArgs e) https://github.com/Albeoris/Pulse/blob/b51b441814e9763f423ffeeff52e88a26ba4b9c3/Pulse.DriectX/UiDxControl.cs   2) add { DxControl.DrawSprites += (device, spriteBatch, clipRectangle) => value(device, spriteBatch, new Rectangle(X, Y, clipRectangle.Width, clipRectangle.Height)); } https://github.com/Albeoris/Pulse/blob/b51b441814e9763f423ffeeff52e88a26ba4b9c3/Pulse.UI/Controls/UiDxViewport.cs   3) private void DrawSprites(Device device, SpriteBatch spritebatch, Rectangle cliprectangle) https://github.com/Albeoris/Pulse/blob/b51b441814e9763f423ffeeff52e88a26ba4b9c3/Pulse.UI/Controls/UiDxTextureViewer.cs   4) public void Draw(Device device, SpriteBatch spriteBatch, Vector2 position, Rectangle? sourceRectangle, float layerDepth) https://github.com/Albeoris/Pulse/blob/b51b441814e9763f423ffeeff52e88a26ba4b9c3/Pulse.DriectX/DxTexture.cs   Done.     Sorry, but I need.
  8. Hi,   I have a DDS CubeMap texture in the memory: 64x64, depht: 1, mipmaps: 7, format: BC3_UNorm_SRgb.   It's stored as 6 * 7 data blocks.   I trying to create a texture: using (SafeUnmanagedArray array = new SafeUnmanagedArray(gtex.MipMapData.Sum(d => d.Length))) { DataBox[] rects = new DataBox[gtex.MipMapData.Length]; using (UnmanagedMemoryStream io = array.OpenStream(FileAccess.Write)) { byte[] buff = new byte[32 * 1024]; for (int index = 0; index < gtex.MipMapData.Length; index++) { GtexMipMapLocation mimMap = gtex.MipMapData[index]; Int32 rowPitch, depthPitch; GetPitch(descriptor, index % descriptor.MipLevels, out rowPitch, out depthPitch); rects[index] = CreateDataBox(array, io, rowPitch, depthPitch); input.SetPosition(mimMap.Offset); input.CopyToStream(io, mimMap.Length, buff); } } Texture3D texture = new Texture3D(_device, descriptor, rects); return new DxTexture(texture, descriptor); } But get an invalid MiscFlags exception (0x6). I think the problem in the wrong formation of DataCubes. Or invalid depthPitch.
  9. Albeoris

    The texture appears partially

    The first device is used to load the textures, convert it, and save it to the file. The second device is part of the preview control, which is used to display the texture. The third device used in the editor window. Preview window and editor window can be displayed at same time.
  10. Hello, I am trying to load a texture from memory in the one device and render to the other. If I'll save the texture to a file before drawing it's works fine. But if I will not to do that the texture will not be shown or appears partially.   http://i.imgur.com/ndngFHS.png   Crating of the texture: _device = new Device(DriverType.Hardware, DeviceCreationFlags.Debug); private static DxTexture Read2DTextureFromStream(GtexData gtex, Stream input) {     Texture2DDescription descriptor = Get2DTextureDescription(gtex);     using (SafeUnmanagedArray array = new SafeUnmanagedArray(gtex.MipMapData.Sum(d => d.Length)))     {         DataRectangle[] rects = new DataRectangle[gtex.MipMapData.Length];         using (UnmanagedMemoryStream io = array.OpenStream(FileAccess.Write))         {             byte[] buff = new byte[32 * 1024];             for (int index = 0; index < gtex.MipMapData.Length; index++)             {                 GtexMipMapLocation mimMap = gtex.MipMapData[index];                 Int32 pitch = GetPitch(descriptor, index);                 rects[index] = CreateDataRectangle(array, io, pitch);                 input.SetPosition(mimMap.Offset);                 input.CopyToStream(io, mimMap.Length, buff);             }         }                  Texture2D texture = new Texture2D(_device, descriptor, rects);         // Resource.ToFile(_device.ImmediateContext, texture, ImageFileFormat.Dds, "tmp.dds"); // <=== Workaround         return new DxTexture(texture, descriptor);     } } private static Texture2DDescription Get2DTextureDescription(GtexData gtex) {     if (gtex.Header.IsCubeMap)         throw new Exception("IsCubeMap: true");     return new Texture2DDescription     {         ArraySize = 1,         Width = gtex.Header.Width,         Height = gtex.Header.Height,         Format = GetDxFormat(gtex.Header.Format),                  MipLevels = gtex.Header.MipMapCount,                  BindFlags = BindFlags.ShaderResource,         OptionFlags = ResourceOptionFlags.Shared,                  Usage = ResourceUsage.Default,         CpuAccessFlags = CpuAccessFlags.None,         SampleDescription = new SampleDescription(1, 0)     }; } Rendering: public void Draw(Device device, SpriteBatch spriteBatch, Vector2 position, Rectangle? sourceRectangle, float layerDepth) {     ShaderResourceView shaderView = GetShaderResourceView(device);     spriteBatch.Draw(shaderView,         position,         sourceRectangle,         new Color(0xff, 0xff, 0xff, 0xff),         0,         Vector2.Zero,         Vector2.One,         SpriteEffects.None, layerDepth); } private ShaderResourceView GetShaderResourceView(Device device) {     lock (_sharedViews)     {         IntPtr viewPointer;         if (_sharedViews.TryGetValue(device.NativePointer, out viewPointer))             return new ShaderResourceView(viewPointer);         using (SharpDX.DXGI.Resource resource = Texture.QueryInterface<SharpDX.DXGI.Resource>())         using (Resource sharedResource = device.OpenSharedResource<Resource>(resource.SharedHandle))         {             ShaderResourceView shaderView = new ShaderResourceView(device, sharedResource);             _sharedViews.Add(device.NativePointer, shaderView.NativePointer);             return shaderView;         }     } } What did I do wrong?
  11. Oh... What the shame... It's my fault. Color4 used components in the range 0.0...1.0f. But I set from 0 to 255.   Without layers:
  12. Solved!   I do that over layers: using (Layer layer = new Layer(target2D)) {     LayerParameters layerParameters = new LayerParameters {ContentBounds = RectangleF.Infinite, MaskTransform = Matrix3x2.Identity, Opacity = 0.5f};     target2D.PushLayer(ref layerParameters, layer);     target2D.BeginDraw();     target2D.FillRectangle(rectangle, selectedColorBrush);     target2D.EndDraw();     target2D.PopLayer(); }   Please corret me if I wrong and other good way is exists.
  13. Hello,   I am trying to draw a rectangle over a texture: spriteBatch.Begin(); texture.Draw(device, spriteBatch, Vector2.Zero, new Rectangle(0,0, texture.Width, texture.Height), 0, clipRectangle); spriteBatch.End(); Brush selectedColorBrush = new SolidColorBrush(target2D, new Color4(new Color3(255,0,0), 50), null); target2D.BeginDraw(); target2D.FillRectangle(rectangle, selectedColorBrush); target2D.EndDraw(); But it drown without transparency:   What did I do wrong?   P.S. I cannot use a Bitmap class because "D2DERR_UNSUPPORTED_PIXEL_FORMAT/UnsupportedPixelFormat"   Thank you for your attention.
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!