zbuffer

How to work around a very large 2d array in C++

I need to create a 2D int array of size 800x800. But doing so creates a stack overflow (ha ha). I'm new to C++, so should I do something like a vector of vectors? And just encapsulate the 2d array into a class? Specifically, this array is my zbuffer in a graphics program. I need to store a z value for every pixel on the screen (henc...

Flash CS4 3D Sprite Rotation Z Order Problem

I suspect this is a maths issue rather than a flash one. In a nutshell, I have two cubes that rotate around their common center point. So far so good. Using the appendTranslation and appendRotation matrix functions, I've managed to get the two cubes to rotate ok. The problem is the drawing order seems to have little effect on the Z Buf...

Why is duplicate text being rendered onto the Z buffer of a different texture when using D3DXFont::DrawText?

I've been stumbling over this for a while and was wondering if anyone has run into this problem before. The application I'm working on is divided into multiple data plots and a single timeline at the bottom of the screen. Each plot (which is actually multiple textures layered on top of each other) as well as the timeline is rendered to...

Perspective correct texture mapping; z distance calculation might be wrong

Hi, I'm making a software rasterizer, and I've run into a bit of a snag: I can't seem to get perspective-correct texture mapping to work. My algorithm is to first sort the coordinates to plot by y. This returns a highest, lowest and center point. I then walk across the scanlines using the delta's: // ordering by y is put here order[0...

How do I set up DirectX 9 so that backface culling is off, z-buffering is on, and gouraud shading works, for triangle meshes without normals data?

I've been having difficulty identifying the correct parameters for the PresentParameters and DirectX device, so that there can be both vertex-level gouraud shading and the use of a z buffer. Some triangle meshes work fine, others have background triangles appearing in front of triangles which are closer-to-camera. An example of this is ...

In DirectX 9, how to get zbuffer to work properly?

I've been unsuccessful at getting a simple cube geometry with shading turned on to display correctly. This is c# code, but the values are being passed through SlimDX directly to C++ code. pParams.BackBufferWidth = 0; pParams.BackBufferHeight = 0; pParams.BackBufferCount = 1; pParams.BackB...

DirectX meshes not being displayed properly after switching view and projection matrices

Hi, In my program, the meshes were being displayed properly, but when I change the device.transform.view and the device.transform.projection matrices from the left handed to the right handed system, the meshes are not displayed properly anymore, i.e the back faces are being illuminated and the front faces are transparent! Does anyone hav...

DirectX depth buffering not working

Hey, For some strange reason my depth buffer is not working, i.e. the triangles drawn later always overlap, regardless of their position. I have these presenter parameters D3DPRESENT_PARAMETERS d3dpp; ZeroMemory(&d3dpp, sizeof(d3dpp)); d3dpp.Windowed = TRUE; d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD; d3dpp.hDeviceWindow = mWindow; d3...