# Directx 9 Surfaces

## Recommended Posts

I am trying to learn DX9 and have been working through some books to start getting things happening. I can create a window and set up the device and everything is all well. Next I wanted to display a jpg as a background so I have been using
LPDIRECT3DSURFACE9* surface;
HRESULT hResult = pD3D9->CreateOffscreenPlainSurface(800,600,D3DFMT_UNKNOWN,D3DPOOL_DEFAULT,&surface,NULL);

but when I compile i get the error (82): error C2039: 'CreateOffscreenPlainSurface' : is not a member of 'IDirect3D9' I create the device like so
LPDIRECT3DDEVICE9 pD3DDevice = NULL;
D3DDEVTYPE_HAL, hWnd,
D3DCREATE_SOFTWARE_VERTEXPROCESSING,
&D3Dpp, &pD3DDevice)))

Is there something simple i am doing wrong here? Thanks for looking

##### Share on other sites
From what I can see (sorry at work)-- it looks like your trying to create the surface from IDirect3D9, not the device

Example:
// WrongHRESULT hResult =    pD3D9->CreateOffscreenPlainSurface(800,600,D3DFMT_UNKNOWN,D3DPOOL_DEFAULT,&surface,NULL);// RightHRESULT hResult =    pD3DDevice->CreateOffscreenPlainSurface(800,600,D3DFMT_UNKNOWN,D3DPOOL_DEFAULT,&surface,NULL);

##### Share on other sites
Yep, that was it thanks very much. Perhaps this will teach me to take more breaks away from the screen.

## Create an account

Register a new account

• ### Forum Statistics

• Total Topics
627701
• Total Posts
2978702

• 21
• 14
• 12
• 10
• 12