• Advertisement
Sign in to follow this  

Error in CreateOffscreenPlainSurface

This topic is 3138 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

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
Advertisement
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
Ok, that's works. :D

I'm stupid¡¡. Two different variable names in a single letter, that was my mistake.
thank you very much for your quick response.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement