direct3d retained mode: upgrading to IDirect3DRM3 from IDirect3DRM
My application uses the old direct3d retained mode system for a 3D GUI and the original interface objects (IDirect3DRM, IDirect3DRMDevice, IDirect3DRMFrame, and the others). I now have a need to use methods in IDirect3DRMMeshBuilder3, but to use the "3" version, the other objects have to be the "3" version. However, to start the process Direct3DRMCreate is used to create a IDirect3DRM object, which used to create other objects. The latest "3" version objects require an IDirect3DRM3 object for thier creation--the problem. Direct3DRMCreate can not create a IDirect3DRM3 object and I don't see a Direct3DRMCreate3 interface. What am I doing wrong?
Use QueryInterface() on the Direct3DRM object to obtain it's IDirect3DRM3 interface. Something like this:
IDirect3DRM *oldrmobj;
HRESULT hr = Direct3DRMCreate(&oldrmobj);
// check for error here
void *tmp;
hr = oldrmobj->QueryInterface(IID_IDirect3DRM3, &tmp);
// check for error here
IDirect3DRM3 *rmobj = (IDirect3DRM3 *) tmp;
oldrmobj->Release(); // no longer need old interface
Sorry, misunderstood the question. There is an interface / container IDirect3DRMFrameArray that can store pointers to IDirect3DRMFrame objects. However, there is not a container for the latest IDirect3DRMFrame3 objects.
Where my current problem is the IDirect3DRMViewport2::Pick(x, y, pickarray) method that requires "pickarray" to be IDirect3DRMPickedArray* array object, which contains pointers to IDirect3DRMFrame objects, not IDirect3DRMFrame3 objects. The scene contains nothing but IDirect3DRMFrame3 objects now.
When I cast the members of the IDirect3DRMPickedArray after the call to Pick, I get results, seemingly valid pointers, but when trying to compare them to my stored frame pointers, they are not valid frame objects.
Also during this "port" I have found that my scene lighting is not the same, which is most likely due to, in part, the light->SetEnableFrame(IDirect3DRMFrame*) call. And again, since I ported my frame objects to "3" and the SetEnableFrame() requests the old verion, the cast I have to make for the code to compile is evidently not going to work.
Any ideas?
If you want your code to still work next year, get rid of all your Retained mode code and port it to immediate mode. Microsoft has killed Retained Mode in Vista, since barely anyone was using it.