SharpDX is an open-source third-party managed DirectX wrapper.
12
votes
5answers
10k views
SharpDX and game engines, back to zero?
I'm a desktop developer (I mainly do WPF for a living) but I want to make games as a hobby.
So a few months ago, I started reading blogs, gamedevSE, you name it.
I understand in the C++ DirectX ...
10
votes
1answer
4k views
Is SharpDX mature enough to adopt yet or should I just start using SlimDX right now?
I'm about to stop my game-project in XNA because from what I can gather it's development is coming to an end (and it's already behind current technology). Therefore, I need to adopt a new framework or ...
6
votes
2answers
367 views
Best pathfinding for a 2D world made by CPU Perlin Noise, with random start- and destinationpoints?
I have a world made by Perlin Noise. It's created on the CPU for consistency between several devices (yes, I know it takes time - I have my techniques that make it fast enough).
Now, in my game you ...
6
votes
1answer
214 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 ...
5
votes
2answers
4k views
Is using SharpDX or SlimDX easier than using DirectX directly from C++? [closed]
I decided to learn to program in DirectX yesterday, and, not being a huge C++ fanatic, went looking for a .Net wrapper. After reading about SlimDX and SharpDX, I decided I liked what the SharpDX ...
5
votes
1answer
870 views
Rendering a Sprite with an Effect… how?
gettings tuck doing some 3d Rendering and I think you guys may have a lot more knowledge in it. I am tasked with basically rendering a texture onto a screen, preparing the way to apply graphical ...
4
votes
1answer
260 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 ...
4
votes
1answer
209 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: ...
3
votes
2answers
195 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:
...
3
votes
2answers
2k 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!
3
votes
2answers
401 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 {
...
3
votes
1answer
280 views
DirectX Unproject troubles
I have an orthographic projection and I try to unproject a point from screen space.
Following are the view and projection matrices:
var w2 = ScreenWidthInPixels/2;
var h2 = ScreenHeightInPixels/2;
...
3
votes
1answer
1k 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 ...
3
votes
1answer
693 views
Monogame/SharpDX - Shader parameters missing
I am currently working on a simple game that I am building in Windows 8 using MonoGame (develop3d). I am using some shader code from a tutorial (made by Charles Humphrey) and having an issue ...
3
votes
1answer
2k views
What are the valid DepthBuffer Texture formats in DirectX 11? And which are also valid for a staging resource?
I am trying to read the contents of the depth buffer into main memory so that my CPU side code can do Some Stuff™ with it.
I am attempting to do this by creating a staging resource which can be read ...
2
votes
2answers
2k views
Migration from XNA to SharpDX
My fear is that XNA has reached the end of the road. To keep up with the latest technology a shift to another game framework might be needed. We have many games in a large codebase, all based on XNA. ...
2
votes
1answer
1k views
Loading textures with SharpDX in Metro
I have converted my C# game from OpenTK (OpenGL) to SharpDX (DirectX) and have it up and running from Visual Studio 2010. I also have it up and running from Visual Studio 11 in Metro, in the Windows 8 ...
2
votes
2answers
135 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 ...
2
votes
1answer
1k views
Why can I not map a dynamic texture in D3D?
I am trying to map a Texture2D resource in DirectX11 via SharpDX.
The resource is declared as a ShaderResource, with Dynamic usage and the 'Write' CPU flag specified.
My call however fails with a ...
2
votes
1answer
93 views
Achieve anisotropic filtering
I want to set anisotropic filtering to my scene. I use SharpDX (DirectX 11) and C#.
How do i set up anisotropic filtering in my shader?
Currently i try that in the shader:
Texture2D tex;
sampler ...
2
votes
2answers
96 views
Properly rendering transparent areas of textures
I'm rendering a tree that contains branch meshes with partially transparent textures.
If I render it with AlphaTestEffect and set the ReferenceAlpha to something low, I'll get this.
I want to ...
2
votes
2answers
281 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 ...
2
votes
1answer
63 views
Camera roll has no effect
Consider my following (abstracted) C# w/ SharpDX code:
class Game
{
Camera _camera = new Camera();
private void Window_KeyDown(object sender, KeyEventArgs e)
{
// Roll
if ...
2
votes
1answer
151 views
Is there a penalty to using render targets versus textures?
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 ...
2
votes
2answers
116 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
1answer
638 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 ...
2
votes
2answers
543 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 ...
2
votes
1answer
535 views
SharpDx: using maximized RenderForm
I'm trying to learn DirectX via SharpDX, very new to this. What I want to do is be able to draw 2D shapes for a game I'm trying to make. So I started with the demo "MiniRect" that came with SharpDX. ...
2
votes
0answers
162 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 ...
2
votes
3answers
1k views
Tutorials for Managed DirectX development? [closed]
Are there any good tutorials, for someone new to DirectX development? I'd like to use the SharpDX library in a project, but am completely new to this sort of graphics programming. I'm looking for a ...
1
vote
2answers
224 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 ...
1
vote
2answers
151 views
What calls trigger a new batch?
I am finding my project is starting to show performance degradation and I need to optimize it. The answer to my previous question and this presentation from NVidia have helped greatly in understanding ...
1
vote
1answer
461 views
Determine the stride of a DirectX Texture2D line?
Is there a way to determine, or preferably calculate/predict, the the stride of a line of a DirectX 11 Texture2D resource when using SharpDX?
(E.g. Can we say the stride of a line is always a power ...
1
vote
2answers
217 views
Drawing cube in SharpDX, wrong perspective
I want to draw a cube. This is what i currently have:
As you can see, the perspective is VERY wrong. The the size in the z-direction is too small and the difference between the front and back size ...
1
vote
2answers
322 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 ...
1
vote
3answers
323 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 ...
1
vote
2answers
250 views
Doubling the DPI with a shader?
I'm developing a game where the map is generated with Perlin Noise, but on the CPU. I am generating some perlin noise onto a texture with a small size, and then I stretch it out to the whole screen to ...
1
vote
1answer
38 views
How can I create a buffer suitable for dynamic updates in SharpDX?
I want to set a buffer that is updated every frame but can't figure it out, what i have to do.
The only working thing i have is this:
mdexcription = new BufferDescription(Matrix.SizeInBytes * ...
1
vote
1answer
75 views
How do I create a camera?
I am trying to create a generic camera class for a game engine, which works for different types of cameras (Orbital, GDoF, FPS), but I have no idea how to go about it.
I have read about quaternions ...
1
vote
1answer
162 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
390 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 ...
1
vote
2answers
158 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 ...
1
vote
1answer
895 views
Pixel Shader, YUV-RGB Conversion failing
I am tasked with playing back a video hthat comes in in a YUV format as an overlay in a larger game. I am not a specialist in Direct3d, so I am struggling. I managed to get a shader working and am ...
1
vote
1answer
125 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 = ...
1
vote
1answer
121 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
...
1
vote
1answer
176 views
Direct2D gamma correction
I'm using direct2d and direct3d together and having an issue with gamma correction. My direct3d backbuffer is using an SRGB format and when I render images from direct2d onto the direct3d surface, ...
1
vote
0answers
63 views
Windows Phone 8.1 emulator for DirectX landscape
July 16, 2014 update: I have converted the SharpDX "MiniCube" sample project to a Universal 8.1 project. It is 100% self-contained. It will demonstrate this issue. There is a "READ ME.txt" file ...
1
vote
0answers
41 views
Anisotropic and trilinear filtering?
I'm confused about the usage of trilinear filtering and anisotropic filtering in SharpDX.
As far as i understood, trilinear filtering does linear filtering to the textures and in a case of LOD-change ...
1
vote
0answers
144 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 ...
1
vote
1answer
327 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 ...