SharpDX is an open-source third-party managed DirectX wrapper.
1
vote
0answers
8 views
XNA/MonoGame/SharpDX: Pixel shader with sprite sheet
I've searched around for two days now on the internet but cannot find a solution. I've also read up on Pixel Shaders on MSDN with no luck.
I'm trying to apply a simple pixel shader to a sprite batch ...
1
vote
1answer
20 views
MonoGame SharpDX Error 'The Parameter is Incorrect' when using graphics.DrawUserPrimitives
Below is a small section of code that is meant to draw a multicolored triangle to the middle of the screen in a MonoGame game. This uses the basic function DrawUserPrimitives to draw the triangle. ...
2
votes
1answer
32 views
Vertex definitions and shaders
I noticed that from looking at other examples like say .. riemers tutorials he takes a buffer with a bunch of vector3's in it and ties it to a shader which expects a float4 ... why does this work in ...
3
votes
1answer
37 views
How do I output a webcam stream to a 2D canvas with SharpDX in C#?
I'm writing an application for the Oculus Rift using the SharpOVR library to access HMD position data. I decided it is reasonable to use SharpDX to also output webcamera streams.
Unfortunately, all ...
0
votes
0answers
41 views
SharpDx from Nuget
I'm trying to get the SharpDx DLLs from Nuget instead of accessing the DLLs directly, and it is a nightmare for me - I've spent several hours on this task already.
If I do this:
Create a clean ...
0
votes
0answers
18 views
Animating colors in a Direct2D Linear or Radial GradientBrush
Is it possible to change colors in a Direct2D brush once created? For example, if I create a LinearGradientBrush can I interpolate the value of the color in one GradientStop to a target color over ...
0
votes
1answer
70 views
HLSL - can't get texture to wrap or mirror
I'm currently converting an app from XNA to SharpDx and I'm therefore upgrading my shaders to version 4 (vs_4_0/ps_4_0).
When using this sampler:
SamplerState MySampler
{
Filter = ...
1
vote
1answer
54 views
Why does this no longer render the “test tri”? [closed]
So I got this code about rendering a shaded tri using sharpDX ...
var vertexShaderByteCode = ShaderBytecode.CompileFromFile("MiniTri.fx", "VS", "vs_4_0", ShaderFlags.None, EffectFlags.None);
var ...
1
vote
0answers
160 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
1answer
76 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
0answers
54 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 ...
0
votes
0answers
52 views
Pixel Shader : Backbuffer is 'Black'
After Fiddling around I am pretty sure this is not a Shader issue.
Edit 4:
The only diference I can see is that BasicEffect calls these methods before drawing:
// Make sure that domain, hull and ...
1
vote
1answer
128 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 ...
2
votes
1answer
108 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 ...
0
votes
1answer
103 views
Multiple joysticks event handling
I want to make a game which is totally same idea as "Who pressed the button answers the question".
I have 2 joysticks and both are connected to a pc. My application will be Winforms and I will ...
1
vote
1answer
174 views
How do I set up a depth buffer in SharpDX?
I draw some instanced cubes, but when i rotate the camera (or the world) some cubes that should be behind other cubes are drawn before the cubes.
I already had this issue a long time before and i ...
1
vote
2answers
307 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 ...
2
votes
2answers
113 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
1answer
79 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 ...
0
votes
2answers
264 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
89 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.
...
4
votes
1answer
420 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
260 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
278 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
81 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 ...
2
votes
3answers
468 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 ...
2
votes
1answer
169 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 ...
0
votes
1answer
232 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
551 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
156 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
307 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
178 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
256 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
133 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
179 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
146 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
70 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
148 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
370 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
283 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
306 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
114 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
592 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
350 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
385 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
451 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
149 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
2answers
816 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
180 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 ...