Jump to content
  • Advertisement

Archived

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

Random-Axess

DirectX8 SDK and the Clear function

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

Hey all! I''m running a Windows 98 (not SE) machine with no graphics accelarator and DirectX 8.0 SDK. I''m using the Visual C++ 6.0 Compiler. I haven''t, however, updated it with service packs. My main thing is this: when i created a DirectDraw Device (named m_pD3DDevice, i wanted to clear the screen and fill it blue. So i use the Clear function, like so: m_pD3DDevice ->Clear(0, NULL, D3DCLEAR_TARGET, D3DCOLORXRGB(0,0,255), 1.0f, 0); it compiles properly, but i get an error when i try to run it. When i open the Debug for it, it points to the last 0 that is passed to the Clear function. What''s wrong? I can''t seem to figure it out! Is it just a windows problem or what?

Share this post


Link to post
Share on other sites
Advertisement
What exactly does the error message say? The last 0 is for the stencil value - it doesn''t seem to make a difference if you are not specifying a stencil fill.

Share this post


Link to post
Share on other sites
the name of the window is D3d window
the error:
This program has performed an illegal operation and will be shut down.

I click debug, and i get this error, pointing to the last 0 in Clear:
Unhandled Exception in D3d Window.exe: 0xC0000005: Acess Violation.

at this point itried skipping over that but then
i get the same error on the next line, which is
m_pD3DDevice ->BeginScreen();

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
My dollar says that your D3d object pointer isn''t pointing at anything. Either check if it is using variable watch in debug or somthing.

Share this post


Link to post
Share on other sites
also: to fix this, how would i do it?
I''m currently following a book and i''ve checked with the code it shows in the book, and mine''s the exact same (minus the comment variations). Also, when i tried to use the Source Code off the book''s CD, i got the same error.

I''m beginning to think its a windows problem--both that it''s running Windows98 (non SE) and that i''m running it on (temporarily) on a laptop which has a crappy Chip Technologies video chipset.

However, if there is a way to solve this, and it isn''t the fault of the computer OR the compiler (rather a Code error) then someone please let me know!

Share this post


Link to post
Share on other sites
What AP is saying is that the m_pD3DDevice is not pointing to a device. Most likely you need to go back and make sure that there was not an error when it was created. it would be a line somthing like this...

D3D->CreateDevice(D3DADAPTER_DEFAULT,D3DDEVTYPE_HAL,Window,D3DCREATE_HARDWARE_VERTEXPROCESSING,&pp,&m_pD3DDevice);

the code you are using sounds like it's trying to create a device that your video card can't make...

try changing to something like this..

D3D->CreateDevice(D3DADAPTER_DEFAULT,D3DDEVTYPE_REF,Window,D3DCREATE_SOFTWARE_VERTEXPROCESSING,&pp,&m_pD3DDevice);

and check the return value..it should be D3D_OK if the device is created ok, otherewise it will point to garbage.


[edited by - dabx11 on July 2, 2002 2:44:16 AM]

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!