Magnar Harestad

Member
  • Content count

    6
  • Joined

  • Last visited

Community Reputation

99 Neutral

About Magnar Harestad

  • Rank
    Newbie
  1. DirectX Tutorial.com - App crashes

    This is the shader code. And, to be honest, this is straight off from the tutorial. [font="Consolas"][size="2"][font="Consolas"][size="2"]struct VOut[/size][/font][/size][/font] [font="Consolas"][size="2"][font="Consolas"][size="2"]{[/size][/font][/size][/font] [font="Consolas"][size="2"][font="Consolas"][size="2"]float4 position : SV_POSITION;[/size][/font][/size][/font] [font="Consolas"][size="2"][font="Consolas"][size="2"]float4 color : COLOR;[/size][/font][/size][/font] [font="Consolas"][size="2"][font="Consolas"][size="2"]};[/size][/font][/size][/font] [font="Consolas"][size="2"][font="Consolas"][size="2"]VOut VShader(float4 position : POSITION, float4 color : COLOR)[/size][/font][/size][/font] [font="Consolas"][size="2"][font="Consolas"][size="2"]{[/size][/font][/size][/font] [font="Consolas"][size="2"][font="Consolas"][size="2"]VOut output;[/size][/font][/size][/font] [font="Consolas"][size="2"][font="Consolas"][size="2"]output.position = position;[/size][/font][/size][/font] [font="Consolas"][size="2"][font="Consolas"][size="2"]output.color = color;[/size][/font][/size][/font] [font="Consolas"][size="2"][font="Consolas"][size="2"]return output;[/size][/font][/size][/font] [font="Consolas"][size="2"][font="Consolas"][size="2"]}[/size][/font][/size][/font] [font="Consolas"][size="2"][font="Consolas"][size="2"]?[/size][/font][/size][/font] [font="Consolas"][size="2"][font="Consolas"][size="2"]float4 PShader(float4 position : SV_POSITION, float4 color : COLOR) : SV_TARGET[/size][/font][/size][/font] [font="Consolas"][size="2"][font="Consolas"][size="2"]{[/size][/font][/size][/font] [font="Consolas"][size="2"][font="Consolas"][size="2"]return color;[/size][/font][/size][/font] [font="Consolas"][size="2"][font="Consolas"][size="2"]}[/size][/font][/size][/font]
  2. DirectX Tutorial.com - App crashes

    [quote name='Bacterius' timestamp='1335512761' post='4935317'] You should be putting a breakpoint in your application's entry and stepping until you encounter the crash (or just spam printf's everywhere), it's probably not DirectX that's failing here but StdAfx.h, since you said previous examples work. [/quote] I also had to put in #include <StdAfx.h> on the other examples (the white screen and the blue screen), and both of those examples worked. So I kind of think that the StdAfx.h is just needed for Visual Studio itself to easier rebuild the headers etc. And that part works fine. The problems seems to me to be either the load of the shaders.hlsl file doesn't work as intended, or there is something else that does work with the shader function invoked. Very strange, though?
  3. DirectX Tutorial.com - App crashes

    Hi again, It seems to be a issue on the shader load. On the last line of the code in the text-cut below is where the debugger crashes. [font="Consolas"][size="2"][color="#008000"][font="Consolas"][size="2"][color="#008000"][font="Consolas"][size="2"][color="#008000"]// this function loads and prepares the shaders[/color][/size][/font][/color][/size][/font][/color][/size][/font] [font="Consolas"][size="2"][color="#0000ff"][font="Consolas"][size="2"][color="#0000ff"][font="Consolas"][size="2"][color="#0000ff"]void[/color][/size][/font][/color][/size][/font][/color][/size][/font][font="Consolas"][size="2"][font="Consolas"][size="2"] InitPipeline()[/size][/font][/size][/font] [font="Consolas"][size="2"][font="Consolas"][size="2"]{[/size][/font][/size][/font] [font="Consolas"][size="2"][color="#008000"][font="Consolas"][size="2"][color="#008000"][font="Consolas"][size="2"][color="#008000"]// load and compile the two shaders[/color][/size][/font][/color][/size][/font][/color][/size][/font] [font="Consolas"][size="2"][font="Consolas"][size="2"]ID3D10Blob *VS, *PS;[/size][/font][/size][/font] [font="Consolas"][size="2"][font="Consolas"][size="2"]D3DX11CompileFromFile(L[/size][/font][/size][/font] [font="Consolas"][size="2"][color="#a31515"][font="Consolas"][size="2"][color="#a31515"][font="Consolas"][size="2"][color="#a31515"]"shaders.hlsl"[/color][/size][/font][/color][/size][/font][/color][/size][/font][font="Consolas"][size="2"][font="Consolas"][size="2"], 0, 0, [/size][/font][/size][/font][font="Consolas"][size="2"][color="#a31515"][font="Consolas"][size="2"][color="#a31515"][font="Consolas"][size="2"][color="#a31515"]"VShader"[/color][/size][/font][/color][/size][/font][/color][/size][/font][font="Consolas"][size="2"][font="Consolas"][size="2"], [/size][/font][/size][/font][font="Consolas"][size="2"][color="#a31515"][font="Consolas"][size="2"][color="#a31515"][font="Consolas"][size="2"][color="#a31515"]"vs_5_0"[/color][/size][/font][/color][/size][/font][/color][/size][/font][font="Consolas"][size="2"][font="Consolas"][size="2"], 0, 0, 0, &VS, 0, 0);[/size][/font][/size][/font] [font="Consolas"][size="2"][font="Consolas"][size="2"]D3DX11CompileFromFile(L[/size][/font][/size][/font] [font="Consolas"][size="2"][color="#a31515"][font="Consolas"][size="2"][color="#a31515"][font="Consolas"][size="2"][color="#a31515"]"shaders.hlsl"[/color][/size][/font][/color][/size][/font][/color][/size][/font][font="Consolas"][size="2"][font="Consolas"][size="2"], 0, 0, [/size][/font][/size][/font][font="Consolas"][size="2"][color="#a31515"][font="Consolas"][size="2"][color="#a31515"][font="Consolas"][size="2"][color="#a31515"]"PShader"[/color][/size][/font][/color][/size][/font][/color][/size][/font][font="Consolas"][size="2"][font="Consolas"][size="2"], [/size][/font][/size][/font][font="Consolas"][size="2"][color="#a31515"][font="Consolas"][size="2"][color="#a31515"][font="Consolas"][size="2"][color="#a31515"]"ps_5_0"[/color][/size][/font][/color][/size][/font][/color][/size][/font][font="Consolas"][size="2"][font="Consolas"][size="2"], 0, 0, 0, &PS, 0, 0);[/size][/font][/size][/font] [font="Consolas"][size="2"][color="#008000"][font="Consolas"][size="2"][color="#008000"][font="Consolas"][size="2"][color="#008000"]// encapsulate both shaders into shader objects[/color][/size][/font][/color][/size][/font][/color][/size][/font] [font="Consolas"][size="2"][font="Consolas"][size="2"]dev->CreateVertexShader(VS->GetBufferPointer(), VS->GetBufferSize(), NULL, &pVS);[/size][/font][/size][/font] [font="Consolas"][size="2"][font="Consolas"][size="2"]The Debugger error is:[/size][/font][/size][/font] [font="Consolas"][size="2"][font="Consolas"][size="2"]Unhandled exception at 0x771115de in DirectX_Test.exe 0xc0000005: Access violation reading location 0x00000000.[/size][/font][/size][/font] [font="Consolas"][size="2"][font="Consolas"][size="2"]The shaders.hlsl file is part of the project together with the cpp file. And the shaders file includes the code that is on the tutorial webpage. [/size][/font][/size][/font] [font="Consolas"][size="2"][font="Consolas"][size="2"]Why is it crashing on the dev->CreateVertexShader line?[/size][/font][/size][/font]
  4. DirectX Tutorial.com - App crashes

    I might add to say that all examples before the triangle is to be drawn works fine. So the first example of the "white screen" works. Also the "blue screen" example works. But not the example where it draws the triangle.
  5. DirectX Tutorial.com - App crashes

    Hi, I've tried to use the code example from DirectX Tutorial.com to create a basic triangle in a DirectX win32 application. Project built in Visual Studio, library paths fixed etc. Tried to change driver specification from HARDWARE to REFENCE, didn't solve crash issue. Tutorial code I tried to use was: [url="http://www.directxtutorial.com/Tutorial11/B-A/BA5.aspx#still"]http://www.directxtu.../BA5.aspx#still[/url] Picture of crash: [url="http://www.harestad.info/pictures/DirectX3d_Crash.jpg"]http://www.harestad....ctX3d_Crash.jpg[/url] I also had to add #include <StdAfx.h> at start of project, otherwise the build would not work in Visual Studio. Which wasn't mentioned in the code example on the tutorial place. When I add it, build goes ok, but a Error comes that says it cannot find it. 1 IntelliSense: cannot open source file "StdAfx.h" c:\users\administratör\documents\visual studio 2010\projects\directx_test\directx_test\directx_test.cpp 2 2 DirectX_Test [font=Consolas][size=1][font=Consolas][size=1]1>------ Build started: Project: DirectX_Test, Configuration: Debug Win32 ------[/size][/font][/size][/font] [font=Consolas][size=1][font=Consolas][size=1]1> DirectX_Test.cpp[/size][/font][/size][/font] [font=Consolas][size=1][font=Consolas][size=1]1> DirectX_Test.vcxproj -> C:\Users\Administratör\documents\visual studio 2010\Projects\DirectX_Test\Debug\DirectX_Test.exe[/size][/font][/size][/font] [font=Consolas][size=1][font=Consolas][size=1]========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========[/size][/font][/size][/font] Anyone able to figure out why my application after build doesn't work? And why I need to put that include of StdAfx.h - that Visual Studio cannot even find? Cheers Magnar
  6. direct x9 project

    Guys, how did you make the examples work from that tutorial site? All that happens when I build that project is that the build goes OK - but when I run the file the application itself crashes. Regardless if I use reference or hardware mode on the driver settings... Any ideas why it crashes? The white window with the DirectX application do turn up on the screen - but it crashes direct after. Magnar