Joakim1234

Members
  • Content count

    8
  • Joined

  • Last visited

Community Reputation

111 Neutral

About Joakim1234

  • Rank
    Newbie
  1. Ok it seems I found the problem - for some reason XMMATRIX can't be used as extern XMMATRIX * testmatrix and it causes it to crash I had the habit of making a lot of things extern,guess I'll change them to normal now Edit: I am the original poster,but here I wasn't allowed to use Facebook when I wrote this thread.Does that violate some terms?If so,I apologize to the moderators for not remembering the rights and terms.
  2. Is gaming going downhill?

    It's because of profit expectation.In the old times not everyone had a computer and it wasn't all profit-oriented,so people did it more for the sake of fun,innovation and discovery and it was more of an art than an industry I guess.I mean when I ran Crysis 2 on max on my brother's computer it looked photorealistic and everything,but it got boring after 30 minutes of playing.Serious Sam The Second Encounter however always felt extremely fun and refreshing to play and the monsters looked very..uhm defined.In Crysis 2 the enemies are so packed with details,spikes,tentacles,lights,eyes,arms that I sometimes can't tell the different types apart.I hate to admit with what Blizzard said about Diablo 2,but they were right,it was something along the lines of "We don't focus so much on high definition graphics,but on a fresh and memorable art style,so we can create a graphics that will be acceptable even in 5 years from now.".
  3. Thanks for showing me this,I guess it's not such a good idea to have a buffer creator function anyway [img]http://public.gamedev.net//public/style_emoticons/default/smile.png[/img]
  4. [quote name='SamiHuutoniemi' timestamp='1343436192' post='4963816'] I always set it to 0 if I go with D3D11_USAGE_DEFAULT. I dont think you can use D3D11_CPU_ACCESS_READ for this. [/quote][quote name='SamiHuutoniemi' timestamp='1343436192' post='4963816'] I always set it to 0 if I go with D3D11_USAGE_DEFAULT. I dont think you can use D3D11_CPU_ACCESS_READ for this. [/quote] lol it actually worked,but what kind of access does 0 mean?READWRITE?
  5. [quote name='SamiHuutoniemi' timestamp='1343435910' post='4963813'] What are the default values for the bufferUsage and processorAccess parameters, since you dont specify them? 0 and 0? [/quote][quote name='SamiHuutoniemi' timestamp='1343435910' post='4963813'] What are the default values for the bufferUsage and processorAccess parameters, since you dont specify them? 0 and 0? [/quote] They are [CODE]void CreateVertexBuffer(ID3D11Buffer** buffer, unsigned int bufferSize, void * vertices, D3D11_USAGE bufferUsage = D3D11_USAGE_DEFAULT, D3D11_CPU_ACCESS_FLAG processorAccess = D3D11_CPU_ACCESS_READ);[/CODE] It should result in the same buffer creation that I saw in a tutorial which used to work with no problems.
  6. I'm using a little helper function to create vertex buffers: [CODE]void AssetManager::CreateVertexBuffer(ID3D11Buffer** buffer, unsigned int bufferSize, void* vertices, D3D11_USAGE bufferUsage, D3D11_CPU_ACCESS_FLAG processorAccess) { D3D11_BUFFER_DESC bufferDesc; D3D11_SUBRESOURCE_DATA subResData; bufferDesc.Usage = bufferUsage; bufferDesc.ByteWidth = bufferSize; bufferDesc.BindFlags = D3D11_BIND_VERTEX_BUFFER; bufferDesc.CPUAccessFlags = processorAccess; bufferDesc.MiscFlags = 0; bufferDesc.StructureByteStride = 0; subResData.pSysMem = vertices; subResData.SysMemPitch = 0; subResData.SysMemSlicePitch = 0; HR(gD3DDevice->CreateBuffer(&bufferDesc, &subResData, buffer)); } [/CODE]And it causes a [b]E_INVALIDARG [/b]error,but doesn't give a clue about which argument is the invalid one.Here is how the function is called in the program: [CODE] vertexBuffer = 0; VertexType* vertices = new VertexType[vertexCount];; vertices[0].position = XMFLOAT3(-1.0f, -1.0f, 0.0f); //just random values to see if it debugs at all vertices[0].texture = XMFLOAT2(0.0f, 1.0f); vertices[1].position = XMFLOAT3(0.0f, 1.0f, 0.0f); vertices[1].texture = XMFLOAT2(0.5f, 0.0f); vertices[2].position = XMFLOAT3(1.0f, -1.0f, 0.0f); vertices[2].texture = XMFLOAT2(1.0f, 1.0f); AssetManager->CreateVertexBuffer(&vertexBuffer,sizeof(VertexType)*vertexCount, &vertices); [/CODE] Could the problem be in "[i]bufferDesc.StructureByteStride = 0;[/i]"?Am I supposed to leave it at 0?Cause all the tutorial project files leave it at 0 and they compile just fine.But the problem can't be in the project itself,I linked all the needed libraries and the paths to the SDK.
  7. [quote name='L. Spiro' timestamp='1343417495' post='4963739'] The second-to-last parameter, to which you have passed NULL, is called “ppErrorMsgs”. It is not a coincidence that it also happens to be able to give you the actual error messages generated during compile time. You should use it. L. Spiro [/quote][quote name='L. Spiro' timestamp='1343417495' post='4963739'] The second-to-last parameter, to which you have passed NULL, is called “ppErrorMsgs”. It is not a coincidence that it also happens to be able to give you the actual error messages generated during compile time. You should use it. L. Spiro [/quote] Ah,thank you,it seems there were a lot of missing variables from the [i]SpriteEffect.ps [/i]file.Is there a program in existence that checks and highlights [i]HLSL [/i]code like [i]Visual Studio[/i] with [i]Intellisense [/i]highlights [i]C++[/i]?
  8. When I call [CODE]D3DX11CompileFromFile(pixelShaderPath, NULL, NULL, "SpritePixelShader", "vs_5_0", D3D10_SHADER_ENABLE_STRICTNESS, 0, NULL, &pixelShaderBuffer, NULL, NULL);[/CODE] I get the error message: [quote] Unexpected error encountered Error Code: E_FAIL(0x80004005) Calling: D3DX11CompileFromFile(pixelShaderPath, NULL, NULL, "SpritePixelShader", "vs_5_0", D3D10_SHADER_ENABLE_STRICTNESS, 0, NULL, &pixelShaderBuffer, NULL, NULL) [/quote] The [i]D3DX11CompileFromFile(vertexShaderPath, NULL, NULL, "SpriteVertexShader", "vs_5_0", D3D10_SHADER_ENABLE_STRICTNESS, 0, NULL, &vertexShaderBuffer, NULL, NULL) [/i]function doesn't cause an error,but on the next 2 lines where I call [i]CreateVertexShader [/i]and [i]CreatePixelShader[/i], [i]CreateVertexShader [/i]does cause an error: [quote] Unexpected error encountered Error Code: E_INVALIDARG(0x80070057) Calling: CreateVertexShader(vertexShaderBuffer->GetBufferPointer(), vertexShaderBuffer->GetBufferSize(), NULL, &vertexShader)) [/quote] Which brings me to believe,that [i]D3DX11CompileFromFile(vertexShaderPath, NULL, NULL, "SpriteVertexShader", "vs_5_0", D3D10_SHADER_ENABLE_STRICTNESS, 0, NULL, &vertexShaderBuffer, NULL, NULL) [/i]also didn't work out very well.All the pointers are initialized properly before calling these functions,so that can't be it: [CODE]vertexShader = 0; pixelShader = 0; vertexShaderBuffer = 0; pixelShaderBuffer = 0;[/CODE] And it can't be from not finding the [i]SpriteEffect.vs[/i] and [i]SpriteEffect.ps [/i]files,they're right next to the source files,I also copied them in the debug folder to be next to the .exe just in case.Could the problem be invalid code in the shader files themselves?They're just a simple instanced geometry/bump map effect: [CODE]cbuffer MatrixBuffer { matrix worldMatrix; matrix viewMatrix; matrix projectionMatrix; }; struct VertexInputType { float4 position : POSITION; float2 tex : TEXCOORD0; float3 normal : NORMAL; float3 tangent : TANGENT; float3 binormal : BINORMAL; float3 instancePosition : TEXCOORD1; }; struct PixelInputType { float4 position : SV_POSITION; float2 tex : TEXCOORD0; float3 normal : NORMAL; float3 tangent : TANGENT; float3 binormal : BINORMAL; }; PixelInputType SpriteVertexShader(VertexInputType input) { PixelInputType output; input.position.w = 1.0f; input.position.x += input.instancePosition.x; input.position.y += input.instancePosition.y; input.position.z += input.instancePosition.z; output.position = mul(input.position, worldMatrix); output.position = mul(output.position, viewMatrix); output.position = mul(output.position, projectionMatrix); output.tex = input.tex; output.normal = mul(input.normal, (float3x3)worldMatrix); output.normal = normalize(output.normal); output.tangent = mul(input.tangent, (float3x3)worldMatrix); output.tangent = normalize(output.tangent); output.binormal = mul(input.binormal, (float3x3)worldMatrix); output.binormal = normalize(output.binormal); return output; } [/CODE] Texture2D shaderTexture; SamplerState SampleType; struct PixelInputType { float4 position : SV_POSITION; float2 tex : TEXCOORD0; float3 normal : NORMAL; float3 tangent : TANGENT; float3 binormal : BINORMAL; }; float4 SpritePixelShader(PixelInputType input) : SV_TARGET { float4 textureColor; float4 bumpMap; float3 bumpNormal; float3 lightDir; float lightIntensity; float4 color; textureColor = shaderTextures[0].Sample(SampleType, input.tex); bumpMap = shaderTextures[1].Sample(SampleType, input.tex); bumpMap = (bumpMap * 2.0f) - 1.0f; bumpNormal = input.normal + bumpMap.x * input.tangent + bumpMap.y * input.binormal; bumpNormal = normalize(bumpNormal); lightDir = -lightDirection; lightIntensity = saturate(dot(bumpNormal, lightDir)); color = saturate(diffuseColor * lightIntensity); color = color * textureColor; return color; } I don't have syntax highlighting for HLSL,so it's possible that I missed something stupid.Any help would be appreciated.