• Advertisement

Archived

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

Direct draw clippers...

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

Ok, I have my DDraw clipper, and I''m trying to use the function SetHWnd. I tried that, but then my program told me that I hadn''t initalized it yet, so I fire up the help, and check it out. I come across the functiond CreateClipper. This seems to be a good thing, so I put it into my program. I compile, and I get the error that CreateClipper cannot convert parameter 2 from ''struct IDirectDrawClipper*'' to ''struct IDirectDrawClipper**'' Here is all the clipper code that I have, and I think I''m missing some:
  
//in the ddraw_wrapper header file:

LPDIRECTDRAWCLIPPER clipper;

// in the constructor:

clipper = NULL;

// in the init_ddraw function

hRet = ddraw_obj->CreateClipper(0, clipper, NULL);
/*...*/
hRet = clipper->SetHWnd(0, hWnd);
  
thanks in advance!! ___________________ ~Analazon

Share this post


Link to post
Share on other sites
Advertisement
note: if I make clipper a pointer, it gives me an error on clipper->SetHWnd. Says it must point to a class/struct/union...

___________________
~Analazon

Share this post


Link to post
Share on other sites
*bump*

I know that this has been asked a million times...and I would use the search if I could...

___________________
~Analazon

Share this post


Link to post
Share on other sites
I typecasted it as an LPDIRECTDRAWCLIPPER* and it appeared to work. I''m not sure if this is right tho.

___________________
~Analazon

Share this post


Link to post
Share on other sites
humm...you need to:

1) Create the Clipper
2) fill out a LPRGNDATA structure
3) Set the Clip list.

You did the first one...the rest is too mush to explain here...click the "For Beginners" thing above and it should say in there somewhere.

Share this post


Link to post
Share on other sites
I revised a bit of my code so that instead of doing the SetHWnd, I used the one RGNDATA structure. Should work now...

___________________
~Analazon

Share this post


Link to post
Share on other sites
Hmm...a bit of debuging later...

if I use ddraw_obj->CreateClipper(0, (LPDIRECTDRAWCLIPPER*)clipper, NULL); it tells me invalid params. This is getting rather annoying, so if someone could tell me the proper way of doing this, I would appreciate it.

Share this post


Link to post
Share on other sites
Use (LPDIRECTDRAWCLIPPER*)&clipper, since the function returns the pointer to the newly created clipper.

Share this post


Link to post
Share on other sites
dangit...ok, new problem now...

Whenever I use the function BltFast with a RECT structure passed to it, it tells me that it is an invalid rect. If I blt the whole thing, then it works fine (pass NULL for the rectangle), but whenever I use a rectangle, then it return DDERR_INVALID RECT.


  
RECT rcRect;
rcRect.top = 0;
rcRect.bottom = 40;
rcRect.right = 0;
rcRect.bottom = 80;
hRet = back_buffer->BltFast(0,0, thenode->image, &rcRect, DDBLTFAST_NOCOLORKEY);


if NULL is passed instead of rcRect, then it doesn''t work. This is rather annoying, as I have gotten it to work before in another app. Note: thenode->image is a 240*200 image.

GRRR!!!

Share this post


Link to post
Share on other sites
someone please tell me I did something stupid...and tell me how to fix it...

___________________
~Analazon

Share this post


Link to post
Share on other sites
The clipper part still isn''t working. I would really really really like some help on this. It says that it is initalizing properly, but it isn''t doing anything.


  

hRet = ddraw_obj->CreateClipper(0, &clipper, NULL);
switch(hRet)
{
case DDERR_INVALIDOBJECT:
MessageBox(hWnd, "Invalid object", "Invalid object", MB_OK);
break;
case DDERR_INVALIDPARAMS:
MessageBox(hWnd, "Invalid params", "Invalid params", MB_OK);
break;
case DDERR_NOCOOPERATIVELEVELSET:
MessageBox(hWnd, "no cooperative level set", "no cooperative level set", MB_OK);
break;
case DDERR_OUTOFMEMORY:
MessageBox(hWnd, "out of memory", "out of memory", MB_OK);
break;
}

rgnData.rdh.dwSize = sizeof(RGNDATAHEADER);
rgnData.rdh.rcBound.top = 0;
rgnData.rdh.rcBound.bottom = 600;
rgnData.rdh.rcBound.left = 0;
rgnData.rdh.rcBound.right = 800;
rgnData.rdh.iType = RDH_RECTANGLES;
rgnData.rdh.nCount = 1;
rgnData.rdh.nRgnSize = 0;

//hRet = clipper->SetHWnd(0, hWnd);

hRet = clipper->SetClipList(&rgnData, 0);
if(hRet != DD_OK)
{
switch(hRet)
{
case DDERR_CLIPPERISUSINGHWND:
return 0;
case DDERR_INVALIDCLIPLIST:
return 0;
case DDERR_INVALIDOBJECT:
return 0;
case DDERR_INVALIDPARAMS:
return 0;
}
}

hRet = primary->SetClipper(clipper);
if(hRet != DD_OK)
return 0;


primary is my primary surface, clipper is my clipper. I am running in 800*600 w/ 16 bit color. I have tried using regular Blt, and BltFast, and if I draw it outside of the 800*600 zone, then it tells me that it is an invalid rect.

If you can''t tell me how to answer my question here, could you at least point me at a good example?

Share this post


Link to post
Share on other sites
I believe BltFast does not work if you try to use it on a surface that has a clipper attached to it. Also, most of your Blts are probably going to the backbuffer which probably doesn''t have a clipper attached to it so when you blt stuff to that surface and some part of the image exceeds the boundaries none of the image is displayed which really sucks. I got extremely confused reading about clippers and trying to get them to work so I fudged it by passing a modified source rect to the Blt/BltFast functions. I think, but am not positive, that a clipper is mostly for use with windowed mode and for drawing using GDI onto the primary buffer. I am somewhat new to this too and would be most thankful if someone could help out so I don''t have to fudge the source rects anymore

Share this post


Link to post
Share on other sites

  • Advertisement