• Advertisement

Archived

This topic is now archived and is closed to further replies.

ZBuffer in class

This topic is 6392 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

d:\dx\gameproject\main\c3dmesh.cpp(474) : error C2664: ''EnumZBufferFormats'' : cannot convert parameter 2 from ''long (struct _DDPIXELFORMAT *,void *)'' to ''long (__stdcall *)(struct _DDPIXELFORMAT *,void *)'' So my EnumZBufferFormats-function doesn''t work in my class. Why? It''s used in my D3D Initialize function like this: lpD3D->EnumZBufferFormats( IID_IDirect3DTnLHalDevice, EnumZBufferFormatsCallback, (VOID*)&m_ddpfZBuffer); Then I just use zbuf_flag variable to determine which zbuffer to use like this: if (zbuf_flag) { zbuf_format=1; } else { lpD3D->EnumZBufferFormats(IID_IDirect3DHALDevice, EnumZBufferFormatsCallback, (VOID*)&m_ddpfZBuffer ); if (zbuf_flag) { zbuf_format=2; } else { . . . } // Enumerate the ZBuffer HRESULT WINAPI C3DMesh::EnumZBufferFormatsCallback( DDPIXELFORMAT* ddpf, VOID* pddpfDesired ) { // If parameters == NULL, don''t enumerate more if( NULL==pddpf || NULL==pddpfDesired ) return D3DENUMRET_CANCEL; // If the current pixel format''s match the desired ones (DDPF_ZBUFFER and // possibly DDPF_STENCILBUFFER), lets copy it and return. This function is // not choosy...it accepts the first valid format that comes along. if( pddpf->dwFlags == ((DDPIXELFORMAT*)pddpfDesired)->dwFlags ) { memcpy( pddpfDesired, pddpf, sizeof(DDPIXELFORMAT) ); // Set flag to TRUE, since we got a valid z-buffer format. zbuf_flag=TRUE; return D3DENUMRET_CANCEL; } return D3DENUMRET_OK; }

Share this post


Link to post
Share on other sites
Advertisement

  • Advertisement