SharpDX is an open-source third-party managed DirectX wrapper.

learn more… | top users | synonyms

0
votes
2answers
57 views

SharpDX.Toolkit setting constant buffer

I am trying to use a constant buffer in a program using SharpDX.Toolkit. I use the Toolkit because it has nice font support for writing on the screen. The problem I face is in assigning data to the ...
0
votes
0answers
34 views

class instance issue

Currently, i am working on a project which deals with several parts. First, I want to interface with a Sidewinder Force Feedback 2 joystick in Unity using SharpDX and SharpDX.DirectInput libraries. ...
2
votes
1answer
95 views

How do I convert a .dds texture to .png bitmap in C#?

This question is from someone who has not written a line of code for games, but several Game Save editors and other game tools. I'm working on a Save Editor and would like to display icons of some of ...
1
vote
0answers
72 views

How do i define array in shader's constant buffer with C#?

I am using SharpDX to render 3D graphics and i cannot get to work constant buffer in my shader since it contains an array. Currently it looks like this: cbuffer cb0 : register(b0) { matrix ...
4
votes
1answer
104 views

How to debug DXGI_ERROR_INVALID_CALL errors?

I am developping an application using SharpDX and on one of my machines the call _swapChain = new SwapChain(factory, _device, desc); fails with the error message HRESULT: [0x887A0001], Module: ...
0
votes
0answers
48 views

Sorting 3D particles by depth

This is a general particles question, but I use XNA/MonoGame so I looked at: http://xbox.create.msdn.com/en-US/education/catalog/sample/particle_3d for Particles 3D. I found the example not to ...
0
votes
2answers
105 views

SharpDX/D3D: How to implement and draw fonts/text

I am playing with SharpDX (Direct3D for .NET) without using "Toolkit", already finished with basic rendering 3D models. But now i am wondering how to program/create fonts for game (2D), or how to ...
1
vote
0answers
53 views

Efficient scaling of images for multiple resolutions

I figured that the best way to ship 2D art for multiple resolutions is to instruct my artist to create the fullscreen background images sized for the highest resolution and then scale them down during ...
0
votes
1answer
214 views

From Position/Target to Orientation/Elevation

I have an orbit camera class that calculates the camera position from Orientation/Elevation and distance from target. I decided to replace these initial values for the camera instantiation with simply ...
1
vote
1answer
93 views

How to set shader global variable in sharpdx without using Effect class

I am working with SharpDX, i thinking to try using (uniform) global variables for HLSL constants instead of constant buffers. But, in my code SharpDX's Effect class is not used: i use PixelShader ...
1
vote
1answer
59 views

Read part of texture using SharpDX

I have a Texture3D. I want to read a part of it from CPU side. (I'm using the SharpDX toolkit (v2.5.1).) My data is always 0, but the output shows no errors. This is the source texture: testTex = ...
0
votes
1answer
140 views

Instancing with the SharpDX toolkit

I am starting on the graphical portion of my project and before I begin I need to get Instancing working. I can do instancing with SharpDX, but not with the Toolkit Models. The main reason I want to ...
0
votes
1answer
102 views

Rendering Textured Terrain With SharpDX Toolkit [closed]

So i recently moved from XNA to SharpDX Toolkit and started with some basics. The 2d part was easy since nearly nothing has changed but im really struggeling with the 3d part. For example i wanted to ...
0
votes
0answers
40 views

IndexedInstanced logic

I'm using SharpDX.Toolkit with three buffers: two vertex and one index buffer. The first vertex buffer is bound to slot 0 for per-vertex data with following data: static VertexPosition[] vertexData = ...
1
vote
2answers
172 views

Anti-aliasing a sphere

I render everything in my game in 2D with SpriteBatch with the exception of a spherical entity (orb) that I render as a spinning and dynamically lit (custom effect) sphere in 3D. I capture the sphere ...
0
votes
1answer
114 views

Why divide by w makes the pixel shader look better?

I'm writing a shader in HLSL (Direct3D11 with SharpDX) and after some computations I was trying to make a test and print the depth z of a specific point in my pixel shader, like this: myZ = ...
-1
votes
1answer
104 views

SharpDX instancing with D3D11

Could anybody provide working code using SharpDX with D3D11, which does instancing and uses SharpDX's content pipeline? I have several problems there. I came to understand that one should use a ...
1
vote
1answer
91 views

ShaderBytecode Compiler one technique multiple passes

I have an effect code with a basic structure like technique TechniqueName { pass FirstPass { Profile = fx_4_0 VertexShader = RenderFirstVS GeometryShader = null ...
0
votes
1answer
61 views

How do I upscale my scene to a larger viewport?

I want to: Render my scene to a small viewport (some divisor of the full screen size). Stretch the rendered image to cover the full screen size. For example I want to render a complex, very slow ...
0
votes
0answers
89 views

When should I set a texture as a shader resource in order to read it?

I'm writing a Direct3D 11 HLSL shader with SharpDX. What I want to do is write the depth to a texture in one pass and read it in the next one. After declaring the texture, do I have to set the depth ...
1
vote
2answers
251 views

What is the depth that a pixel shader may output? Is it necessary to write Depth?

In DirectX11, what does the depth that a Pixel Shader can output mean? Does a pixel shader need to output a depth so that we "write" the depth? If not, why would we output it? For any doubts, I'm ...
0
votes
1answer
162 views

How to print Depth to a Texture2D and then read it in the next pass on a shader in DirectX11

I'm programming a two-pass effect in DirectX 11 (SharpDX). It's supposed to write the depth to a texture in the first pass and then use that texture to extract data on the second one in the pixel ...
0
votes
1answer
117 views

Difference between texture.Load() and texture.Sample() methods in DirectX?

The question is simply that: What is the difference between texture.Load() and texture.Sample() in DirectX? I've used a Texture2D to store the depth in a pass of a DirectX Shader (with SharpDX), and ...
0
votes
2answers
82 views

Alpha interpolation in a pixel shader

How does the interpolation in a fragment shader work when it comes to the alpha parameter? I'm programming a shader with SharpDX, DirectX11. My idea is to interpolate 2 3d points of a segment, so ...
1
vote
0answers
321 views

SharpDX: Render to bitmap using Direct2D 1.1

I have a command line application that I am currently using SharpDX (Direct2D 1.0) to render to PNG files. This is a window-less application. It's currently creating a SharpDX.WIC.WicBitmap, a ...
0
votes
3answers
204 views

Loaded Images are upside down

I'm using SharpDX Toolkit and load a png file with SharpDX.Toolkit.Graphics.Texture.Load(GraphicsDevice, Stream) If I apply the texture to another texture it's drawn upside down. The texture is: and ...
1
vote
3answers
236 views

Error on running exe, build using SharpDX

I have developed a windows application to read gamepad using SharpDx (XInput) and C# (VS 2008). The application is running smoothly in my development environment. But when i move to some other machine ...
3
votes
2answers
292 views

Memory Leak in SharpDX

one Thing I found out: Windows 7 produces a memory leak while using certain methods to access rendertargets. Why doesn't Windows 8 leak at this method? public class Game : SharpDX.Toolkit.Game { ...
2
votes
2answers
108 views

Orthographic (0,0) center

I want to display coordinates from 0 to n, where n is int > 0. The map is displayed correctly heaving it's center in the middle of the screen pointing top right. I would like to have it pointing ...
0
votes
0answers
95 views

Custom SpriteBatch on SharpDX

I'm using SharpDX.DirectWrite and SharpDX.Direct2D to get a SpriteBatch (or FontBatch because I won't use spritefonts). The only thing which is stopping me is the implementation. I want to load a ...
0
votes
2answers
436 views

SharpDx how to detect if Mouse Button is pressed?

I'm wondering how it's possible to detect if a mousebutton is pressed or released. var di = new DirectInput(); _mouse = new Mouse(di); _mouse.Acquire(); _mouseState = _mouse.GetCurrentState() All I ...
0
votes
1answer
127 views

Monogame/SharpDX Texture2D doesn't hold value

The problem I have discovered is most likely between classes, so I dont really have much option but to post the whole code here: https://www.dropbox.com/sh/smyw9t1ap3by2vd/pBX-aJJ-Qx I have been ...
6
votes
1answer
201 views

Measuring GPU time from managed code

To measure CPU code, I use a Stopwatch. Using a Stopwatch in the Draw method is meaningless for the GPU side of things since the CPU and the GPU run asynchronously. The questions is simple: Is it ...
2
votes
2answers
98 views

How is the result returned in SharpDX.DirectInput.Device.Acquire()?

The documentation of IDirectInputDevice8::Acquire says: Return Value If the method succeeds, the return value is DI_OK, or S_FALSE if the device was already acquired. If the method fails, ...
2
votes
0answers
139 views

Chunk Texture3D GPU generated vertices

I read GPU Gems 3 from NVidia about procedural terrain. It's quite interesting but not applicable for me because I only read the online version without the shipped DVD so I'm not able to download the ...
0
votes
1answer
245 views

Chunks - Drawing in a randomly generated and infinite world

I am working on a platformer that is going to have a map that is randomly generated and infinite in 3 directions: left, right, and down. I've figured out that I will need to separate this world into ...
2
votes
2answers
153 views

How to correctly Dispose a SourceVoice once its finished

i am starting to play a sound with XAudio2 and SourceVoice and once its finished, it should be correctly disposed to not have any leaks. i was expecting it to be something like this: ...
0
votes
0answers
230 views

Deferred Shading - Toolkit

I recently managed to get some lights rendered in a scene by using a buffer and a for-loop. The problem with this method is the performance drop if more lights are used. I tried to convert Deferred ...
1
vote
1answer
145 views

SharpDX - How do I write multiple streams to Texture2D?

I'm working on a 3D map that is cut as a simple grid of textures. The idea is to draw only one object with all those textures, instead of having a tile object for each of them. Correct me if I'm ...
1
vote
1answer
474 views

DirectX11 Gamma Correction

I am writing a game using SharpDX with DirectX11 and I have been reading that it is important to apply gamma correction to my engine in order to perform correct linear lighting calculations. So I ...
0
votes
1answer
192 views

Sharp DX Identity Matrix, Matrix.Forward vector pointing at negative Z

I'm trying to take a steady grip on Sharp DX. Already done some work like translating, scaling and rotating objects. Now i have to calculate the rotation matrix using only direction vector and ...
2
votes
2answers
241 views

Error instantiating Texture2D in MonoGame for Windows 8 Metro Apps

I have an game which builds for WindowsGL and Windows8. The WindowsGL works fine, but the Windows8 build throws an error when trying to instantiate a new Texture2D. The Code: var texture = new ...
0
votes
1answer
170 views

XNA's SetData in a SharpDX Texture2D object in DirectX 11?

I'm trying to load a texture given a swap chain, and then populate that texture with data. I already have some bitmap data (although not sure if it is in the correct format) that I want to populate ...
0
votes
1answer
93 views

Weird rendering issue when applying lightmap through HLSL

I have a weird issue when trying to render the lightmaps in my game. Please see the following screenshots. Note how the scene looks up close with the lightmaps enabled. Note how that same part of ...
1
vote
1answer
278 views

Can not enable IME to capture Chinese characters in SharpDX

Just found that direct integration of IME is blocked in Windows 8, moving on to TSF now. By now, there is lack of Microsoft's Document about TSF, this will be hard. I am using SharpDX and the ...
2
votes
2answers
484 views

Camera frustum calculation coming out wrong

I'm trying to calculate a view/projection/bounding frustum for the 6 directions of a point light and I'm having trouble with the views pointing along the Y axis. Our game uses a right-handed, Y-up ...
1
vote
2answers
152 views

One or multiple VertexBuffers

I'm currently working on a personal project where I'm trying to load the levels and all of the geometry from the game "Medal of Honor Allied Assault" into my own C# code-base based on SharpDX. I ...
3
votes
1answer
870 views

Proper use of Dynamic Vertex Buffers for rapid update

I am creating a C#/SharpDx/DirectX10 application to plot line charts in a fast way. I have a prototype which uses Dynamic Vertex Buffers and fills a fixed-size buffer, say 1M vertices, with new data ...
0
votes
2answers
372 views

SharpDX (DirectX) - possible to measure Frame time?

I'm trying to benchmark various ways to draw 2D lines and have a snag. A D3D10Device that I draw with (and flush) doesn't appear to block, so I can't accurately measure frame rate (or time to render 1 ...
3
votes
2answers
1k views

Does Monogame on Windows Desktop use OpenGL or DirectX by default?

if i use monogame 3.0 beta on windows desktop, does it use the directx renderer (sharpdx) or the opengl renderer by default? if it uses directx is there away to make sharpdx call directly? thanks!