Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 27 Mar 2006
Offline Last Active Oct 01 2015 08:28 AM

Topics I've Started

Dealing with D3DX____ functions being depricated.

22 September 2015 - 12:51 PM

I'm trying to upgrade my framework to DX11 in hopes of then upgrading it to 12 (right now it's on 10) but I was a little lazy when creating it in the first place and just used the helper utilities in D3DX even though they were deprecated a long time ago. So now I've got Windows 10 and it doesn't even ship with D3DX so I'm forced into switching. It's a lot of code and pretty laborious. I've managed to switch all my math to newer DirectXMath but what about effects? I can't find any references to effects in DirectX12 documentation and have no idea what happening there. It seems like .fx files are no longer used is that true? And without the D3DX lib how do I load the effects file now? Thanks.

How to control a wacom pen in software?

03 August 2015 - 02:11 PM

I would like to emulate a wacom pen in software in Windows 10. What I'm looking to do is have a program move the cursor and draw in photoshop, but I would like to use the wacom driver to do that. As in I want to send photoshop a message pen is touching screen at x,y with pressure p and tilt t without actually using the pen, everything should be done in software. I'm not sure how I can do that. I think windows 10 has a pen api and I will probably use that if I have no other choice but I was wondering if I can somehow use the wacom api or something similar. 

Why does this code work? (Drawing in screen space)

27 May 2015 - 07:07 PM

Hey all, I just wanted to run this code by because I don't fully understand it. I wrote this a while ago and never touched this part of my code till now. Here it is.

float aspectRatio = float(softObjPtr->clientRect.left) / float(softObjPtr->clientRect.bottom);
float planeXOrig = -1.0f, planeYOrig = -1.0f;
float planeWidth = 2.0f;
float planeHeight = 2.0f;

softObjPtr->pD3D10VertexBuffer->Map(D3D10_MAP_WRITE_DISCARD, 0, (void**)&v);
v[0] = DX10VERTEX(D3DXVECTOR3(planeXOrig, planeYOrig, 0), D3DXVECTOR4(1, 1, 1, 1), D3DXVECTOR2(0.0f, 1.0f));
v[1] = DX10VERTEX(D3DXVECTOR3(planeXOrig + planeWidth, planeYOrig, 0), D3DXVECTOR4(1, 1, 1, 1), D3DXVECTOR2(1.0f, 1.0f));
v[2] = DX10VERTEX(D3DXVECTOR3(planeXOrig + planeWidth, planeYOrig + planeHeight, 0), D3DXVECTOR4(1, 1, 1, 1), D3DXVECTOR2(1.0f, 0.0f));
v[3] = DX10VERTEX(D3DXVECTOR3(planeXOrig, planeYOrig + planeHeight, 0), D3DXVECTOR4(1, 1, 1, 1), D3DXVECTOR2(0.0f, 0.0f));

Why does my the code work flawlessly if I'm positioning my quad at -1, -1 with a width of 2? I guess I would understand this if I had a camera and it looked directly at the center then -1 to 1 would cover the entire region correclty, however I don't have a camera, or more correctly, I'm not multiplying this by any projection matrix. It goes straight to v. shader which doesn't modify it at all and gets passed into the pixel shader. Also I read that I have to account for the pixel center/cell center and subtract 0.5f from everything, but my textured quad is displayed correctly as it is? Why?

Full Screen Quad with Texture, looks off

29 July 2014 - 03:00 AM

I'm trying to convert my software rasterizer from ddraw to dx10. I like to at some point use the pixel shader to draw some elements while I do other elements on cpu. So I decided to just create a texture, lock it and draw directly on it, then use a quad to display it. It does work, and all my programs that I wrote under ddraw run just fine, most old functions have this declaration function(DWORD* video_mem, int lpitch32) so all I do is replace the locked texture memory into vid ram, and the stride of the texture into lptich32. Easy enough. The problem comes in when I try to do something like a dotted line, for example if I try to plot a pixel every 5 pixels.


for (int x = 0, x1 = 0; x < 50;x++, x1+=5)


        texture_buffer[x1 + y1*lpitch32] = COLOR_MAGENTA;



what I get is a line, but some pixels appear to be either merged with others or too far apart. I don't know what's causing it. To give you a run down of my setup, I create a texture the size of my back buffer, which is the same size as my screen. I create a quad with (-1,-1) to (1,1) coords, I leave it in clip-space and don't use any additional transforms in the vertex shader. My pixel shader just samples the texture. The sampler state filter is set to mip-min-mag or something like that. I thought it might be the filtering, but I didn't find an option how to specify no filter.


If needed ill post a picture of what I'm getting and just let me know which code you want me to show you.

D3DCreateEffectFromMemory Fails, everything is correct, why?

25 July 2014 - 12:04 AM

Hi, I'm trying to use a simple hlsl file in the rendering, so I compile my .fx with the fxc.exe as directed on msdn, it produces a clean object with no errors. I read it into memory using msdn's method, but for some reason this function still comes back with E_FAIL. Here's some of my code:


ifstream is(TEXT("DX10RendererEffect.fxo"), ios::binary);

is.seekg(0, ios_base::end);

streampos pos = is.tellg();

is.seekg(0, ios_base::beg);

char * effectBuffer = new char[pos];

is.read(effectBuffer, pos);


if (FAILED(hr = D3D10CreateEffectFromMemory((void*)effectBuffer, pos, 0, softObjPtr->pD3D10Device, NULL, &softObjPtr->pD3D10Effect))){



Also, I've created my device using the D3D10DEBUG_DEVICE flag (something like that), but the function doesn't say anything besides E_FAIL, that on msdn says that means the debug layer is not installed.


I don't know if this matters but I'm on a fresh in stall of Windows 7 and I just installed Windows 8.1 SDK. It's a hassle because all the D3DX helper functions are removed, so I can't compile from file, and must use a build rule on visual studio to compile my fx files manually. And the D3D sdk is completely merged with Windows SDK, so I can't tell if the debug layer was installed or not, it should have been right? Any suggestions?