Sign in to follow this  
ethiel

Error in CreateOffscreenPlainSurface

Recommended Posts

Hi, guys. I'm starting to programming Directx. I have an error on function CreateOffscreenPlainSurface. I have tried all I know, but my knowledge are quite limited. IDirect3DSurface9* surface = NULL; IDirect3DDevice9* g_pd3dDevice = NULL; D3DXIMAGE_INFO imageInfo; HRESULT hResult = D3DXGetImageInfoFromFile("C:\\image.jpg", &imageInfo); hResult =g_pd3dDevice->CreateOffscreenPlainSurface( 640, // the width of the surface to create 480, // the height of the surface to create D3DFMT_X8R8G8B8, // the surface format D3DPOOL_DEFAULT, // the memory pool to use &surface, // holds the resulting surface NULL); The error is located in CreateOffscreenPlainSurface. The error is: Unhandled exception at 0x0041165e in directXexample2.exe: 0xC0000005: Access violation reading location 0x00000000. What is my mistake?.

Share this post


Link to post
Share on other sites
Have you checked that the device (g_pd3dDevice) is already created? This kind of error happens most times if you try to use an object that isn’t created.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this