Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 29 Oct 2008
Offline Last Active Private

Posts I've Made

In Topic: Can't get anything to draw using GLFW.

15 December 2015 - 09:47 AM

mColors->PopulateData(colors, sizeof(GLbyte) * 9)

The variable colors is an array of GLfloats and you use sizeof(GLbyte) here.

glm::mat4 modelMatrix = glm::translate(glm::mat4(1.0f), glm::vec3(0.0f, 0.0f, -8.0f));
glm::mat4 viewMat = glm::lookAt(glm::vec3(0.0f, 0.0f, -8.0f), glm::vec3(0.0f, 0.0f, -2.0f), glm::vec3(0.0f, 1.0f, 0.0f));

Triangle and view are both placed at the same location.

In Topic: Render problem (depth?)

16 August 2012 - 03:03 PM

I made a depth buffer (see code below) and checked if it is the same size as the render target. Unless I'm making a huge mistake somewhere it is. The result of adding in the depth buffer like this is that I do not see any model at all.

The code for creating the buffer is straight below the part where I create the render target. It's probably something simple, but I cannot see what it is. When I have some more time and still cannot fix the problem I might try remaking the project from step 1.
[source lang="csharp"] Texture2DDescription depthBufferDes = new Texture2DDescription() { ArraySize = 1, BindFlags = BindFlags.DepthStencil, Format = Format.D32_Float, Height = form.ClientSize.Height, Width = form.ClientSize.Width, CpuAccessFlags = CpuAccessFlags.None, MipLevels = 1, OptionFlags = ResourceOptionFlags.None, SampleDescription = new SampleDescription(1, 0), Usage = ResourceUsage.Default }; var depthBuffer = new Texture2D(dx11Device, depthBufferDes); DepthStencilViewDescription dsViewDes = new DepthStencilViewDescription() { ArraySize = 0, FirstArraySlice = 0, Dimension = DepthStencilViewDimension.Texture2D, Flags = DepthStencilViewFlags.None, Format = Format.D32_Float, MipSlice = 0 }; var depthView = new DepthStencilView(dx11Device, depthBuffer, dsViewDes); DepthStencilStateDescription dsStateDes = new DepthStencilStateDescription() { IsDepthEnabled = true, DepthWriteMask = DepthWriteMask.All, DepthComparison = Comparison.LessEqual, //IsStencilEnabled = false, /*FrontFace = new DepthStencilOperationDescription(){FailOperation = StencilOperation.Keep, Comparison = Comparison.Always, DepthFailOperation = StencilOperation.Increment, PassOperation = StencilOperation.Keep}, BackFace = new DepthStencilOperationDescription(){FailOperation = StencilOperation.Keep, Comparison = Comparison.Always, DepthFailOperation = StencilOperation.Decrement, PassOperation = StencilOperation.Keep}*/ //FrontFace = StencilOperation StencilFailOp/DepthFailOp/PassOp/Func }; var depthState = DepthStencilState.FromDescription(dx11Device, dsStateDes); context.OutputMerger.DepthStencilState = depthState; context.OutputMerger.SetTargets(depthView, renderTarget);[/source]