neeker

Members
  • Content count

    41
  • Joined

  • Last visited

Community Reputation

228 Neutral

About neeker

  • Rank
    Member
  1. Hi,   I'm working on porting a graphics application from OpenGL 2.1 to GLES 3.0.  I have a sky dome which renders fine on OSX, but will not render on Android unless I reverse the culling mode (i.e. switch to GL_FRONT).  However, if I do this the sky dome will no longer render on OSX.   Since my understanding is that both of these systems should have the same default culling behavior, I'm wondering if I missed something in initialization?  Or is there something else that can cause this behavior?
  2. Hi,   I'm pretty new to OpenGL, so I'm curious as to what the performance hit might be for enabling a buffer and the not using it.  For example, what if I were to enable GL_TEXTURE_COORD_ARRAY and then never use textures?   My guess is very little and I plan on profiling it when I get the chance, but it'll be a little bit before I can do that and google hasn't helped me dig up an answer yet.   Cheers!
  3. Hi,   Just a general question.  In my PS 2.0 shader I was using discard on certain pixels and noticed a bunch of other pixels being discarded as well.  When I used PIX to try to determine what was happening, it didn't show the shader being ran for these pixels.  I know the problem was in the shader (because I've fixed the problem), but I'm wondering if this is normal behavior for PIX (or a bug)?
  4. Stencil Buffer

      MSDN says zfail is for when the stencil passes but depth fails.  Is this correct?   Anyways, what I want to accomplish (going back to the first post) is for the terrain pixels inside the cardboard box to be discarded.  If there are terrain pixels in between the camera and the box top, they need to be rendered (this is currently where I'm struggling).  If terrain pixels behind the box get discarded, that's fine because the box would over write them anyway.  I hope that makes things a little more clear?
  5. Stencil Buffer

      This isn't quite what I want.  I need to draw everywhere that the "mask" failed the depth test.  For instance, there may be terrain in between the camera and the "mask" that should be drawn.  I was assuming this is what the D3DRS_STENCILZFAIL op was for, but it doesn't seem to be working how I expected it to.
  6. Stencil Buffer

      I've tried this and the opposite affect occurs.  I.e. The terrain is rendered everywhere except for the stencil mask, which is always not rendered (everything is always rendered with D3DCMP_GREATEREQUAL).  So, that would seem to point to my pass/fail/zfail settings, but changes to those do not do anything at all.
  7. Hi,   Here's a greatly simplified version of what I'm trying to accomplish:    Imagine I have a gently sloping terrain (triangle strip).  At an arbitrary position on the terrain I want to put a cardboard box (with no lid).  The box will live at the base-Y position of the terrain, but the terrain might be slightly higher at this point, making the box appear to be partially buried.  This is exactly what I want.  Now imagine the camera looks down into the box.  I want to show the box contents, or simply just the bottom of the box.   I thought the best way to accomplish this would be with a stencil buffer, however I'm struggling to get it to work (following Chapter 13 in Introduction to 3D Game Programming).  Here's what I'm doing:   Step 1:  Set up the stencil buffer gpDeviceInterface->SetRenderState(D3DRS_STENCILENABLE, true); gpDeviceInterface->SetRenderState(D3DRS_STENCILFUNC, D3DCMP_ALWAYS); gpDeviceInterface->SetRenderState(D3DRS_STENCILREF, 0x1); gpDeviceInterface->SetRenderState(D3DRS_STENCILMASK, 0xFFFFFFFF); gpDeviceInterface->SetRenderState(D3DRS_STENCILWRITEMASK, 0xFFFFFFFF); gpDeviceInterface->SetRenderState(D3DRS_ZWRITEENABLE, false); gpDeviceInterface->SetRenderState(D3DRS_ALPHABLENDENABLE, true); gpDeviceInterface->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_ZERO); gpDeviceInterface->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_ONE); Step 2:  Build a polygon to represent the top plane of the box.  Render the polygon.   Step 3:  Render the terrain. // According to Luna, the stencil buffer should be filled with 0x1 where the box "top" was // rendered and 0x0 everywhere else. So, LESSEQUAL should perform the stencil test on // the entire scene/target gpDeviceInterface->SetRenderState(D3DRS_STENCILFUNC, D3DCMP_LESSEQUAL); // If the test failed, replace the 0x0 with 0x1 so the terrain pixel will render gpDeviceInterface->SetRenderState(D3DRS_STENCILFAIL, D3DSTENCILOP_REPLACE); // If the test passed, keep the pixel gpDeviceInterface->SetRenderState(D3DRS_STENCILPASS, D3DSTENCILOP_KEEP); // If the depth test failed, the pixel is behind the stencil, so reject it gpDeviceInterface->SetRenderState(D3DRS_STENCILZFAIL, D3DSTENCILOP_ZERO); // Draw the terrain and reset D3DRS_STENCILENABLE... I don't think I'm grokking Luna, because at this point the only terrain that renders is what's under the box "lid" (i.e. the stencil mask).  Can anyone spot what might be going on?
  8. atan2 inconsistencies

      Good idea with the casting; that revealed that there are (very slight) differences.
  9. atan2 inconsistencies

    Logf("vEyePosition = %g, %g, %g", vEyePosition.x, vEyePosition.y, vEyePosition.z); Logf("vStartLookAt = %g, %g, %g", vStartLookAt.x, vStartLookAt.y, vStartLookAt.z); fViewRotY = atan2(vEyePosition.y - vStartLookAt.y, vStartLookAt.z - vEyePosition.z); fViewRotX =atan2(vStartLookAt.x - vEyePosition.x, vStartLookAt.z - vEyePosition.z); Logf("Post fVeiwRotX = %g", fViewRotX); The log messages are:   vEyePosition = 1.57361e-007, 50, 9.7 vStartLookAt = 1.57361e-007, 0, 9.7 fVeiwRotX = -9.68575e-008   ...and...   vEyePosition = 1.57361e-007, 50, 9.7 vStartLookAt = 1.57361e-007, 0, 9.7 fVeiwRotX = 3.14159 respectively.   
  10. Hi,   I'm using atan2 from math.h and I'm getting weird results.  I call it once using a set of parameters and I get the result of 0 degrees (which is correct), but when I call it again with the exact same parameters I get the result of -180 or +180 degrees.  Is this a known issue and are there work arounds?
  11. It seems like the commit in that link was a little garbled.  You can find the same commit here in original form.
  12.   That's exactly what I was looking for Necrolis!  I can't use any extensions of DirectX (DXMath, D3DX, etc.) due to project requirements, so mostly I've been copying the wine implementations of the D3DX functions I've needed.  I didn't realize there was a version implemented in D3DX.  Kudos.
  13. Hi,   I need to transform an object's world coordinate vertex into screen coordinates.  It seems like XMVector3Project would do this, but unfortunately I can't use DXMath so I have to come up with the implementation by hand.   My linear-algebra-mojo isn't that strong, so I'm having a difficult time figuring out exactly what this function does.  Anyone know for sure?  
  14. Hi,   I have terrain that I want to display with a grid.  I thought multitexturing would be a good way to apply the grid (basically, have one texture that is a square outline), but I run into problems when zooming the camera out because of minification.  I want the grid lines to be a consistent width no matter the zoom.   I thought the solution would be to build my own mipmaps in a graphics editor so the texture contains each LOD.  I did something similar in OpenGL a while ago, but I'm not having any luck finding out how to do it in DX.  Can someone point me to where I can (if it's possible) implement this?   Also, if this is possible:  My base texture is 256x256 and when the camera is fully zoomed out the texture size would be 16x16.  Would I just stub out the remaining LODs or just leave them out entirely?
  15. Hi,   I'm trying to figure out how to render text to a D3D9 scene without using D3DXFont or any other extensions.  Unfortunately, all of the googleverse examples seem to rely on that.  What would be a good strategy for doing so?   I thought about rendering to a texture with DrawText, but that seems a little clunky.  Not sure if there is something better.