Skip to main content
GameDev.net gamedev.net
🔒 Locked

Invisible bitmaps ?

Started by risko Jul 5, 2004 at 4:50 AM 17 replies 3.2k views
Original Post
risko
risko
Hello, there.

// normal        // here is my bitmap invisible, why?
------------     -------------
|          |     |           |
|    BBB   |     |         BBB
|    BBB   |     |         BBB
|    BBB   |     |         BBB
|          |     |           |
------------     -------------
On this "screen" you can see my bitmap (BBB...). I have following problem. If any part of my bitmap touchs the side of screen the bitmap makes invisible itself. Why? I tried to use clipper but no changes. Why ? [Edited by - risko on July 6, 2004 3:58:04 AM]
themadhacker
themadhacker
Try posting some source code buddy or people can't/won't help you out.
risko
risko
Here, this is my drawing function.
// resolution is 640x480, 16b colors// lpBitmap1/2's size is 64x64, 16b colors// clearing of back bufferDDBLTFX fx;ZeroMemory(&fx,sizeof(fx));fx.dwSize = siezof(fx);fx.dwFillColor = 0;lpBackBuffer->Blt(NULL,NULL,NULL,DDBLT_WAIT|DDBLT_COLORFILL,&fx);// drawing of bitmap/* here it is all OK */lpBackBuffer->BltFast(100,100,lpBitmap1,NULL,DDBLTFAST_WAIT|DDBLTFAST_NOCOLORKEY);/* here I can't see bitmap */lpBackBuffer->BltFast(600,100,lpBitmap2,NULL,DDBLTFAST_WAIT|DDBLTFAST_NOCOLORKEY);// drawing to front buffer, respectively on screenwhile (FAILED(lpFBuffer->Flip(0,DDFLIP_WAIT)));
DrunkenHyena
DrunkenHyena
This is what the documentation says about BltFast:
This method works only on display memory surfaces and cannot clip when blitting. If you use this method on a surface with an attached clipper, the call fails, and the method returns DDERR_UNSUPPORTED.


You need to read the documentation for the methods you are using if you want to understand why things are the way they are. You also have to start checking for error conditions. As you can see from the above snippet, the call was failing with a DDERR_UNSUPPORTED error.
Stay Casual,KenDrunken Hyena</FON
risko
risko
The call was not failing with error DDERR_UNSUPPORTED. The call was returning DD_OK everytime. I tried to use Blt but everything is the same than before, only framerate is a bit lower.
RECT src_rect  = {0,0,iSpriteWidth,iSpriteHeight},     dst_rect1 = {100,100,100+iSpriteWidth,100+iSpriteWidth},     dst_rect2 = {640,100,100+iSpriteWidth,100+iSpriteWidth};// all OKlpBackBuffer->Blt(&dst_rect1,lpBitmap,src_rect,DDBLT_WAIT,NULL);// bitmap is invisiblelpBackBuffer->Blt(&dst_rect2,lpBitmap,src_rect,DDBLT_WAIT,NULL);

Please help. What is the problem? I tried to use clipper but no succes. Where is the faul?
Pipo DeClown
Pipo DeClown
Well, I think you do have to set a clipper for Blt() to use.

// Clipper objectLPDIRECTDRAWCLIPPER lpClipper;/* Initialize the clipper object */lpClipper->Initialize( lpDirectDraw, 0 );/* Set window to clip */lpClipper->SetHWnd( 0, my_window_handle );/* Give clipper to backbuffer */lpBackBuffer->SetClipper( lpClipper );
risko
risko
It is working! It is really working! Yehaaa. Thank you very much Pipo DeClown. However, I don't understand why wasn't it working when I tried to do it (?).
Pipo DeClown
Pipo DeClown
Well, there are a few possibilities:

1) You didn't set the clipper up correctly.
2) You didn't set the clipper to the BACKBUFFER.

Shit happens.. a lot in programming. =D
risko
risko
Hopps, my clipping is working good but upper right corner is pixelating all the time. It is not a big area, only 2*10 pixel but it is there.
risko
risko
I made a screeshot but there is no pixelating. Can it be slow drawing, if not, what then? I am crazy from this. I never had this problem before. When I placed the bitmap on place of pixelating to find out when pixelating is doing, I found out it is after drawing of bitmap.

[Edited by - risko on July 6, 2004 9:52:29 AM]
risko
risko
I tried only to initialize DDraw, frontbuffer, backbuffer and clipper. When I am not using clipper the page flipping is good, no pixelating. If I set clipper, pixelating strikes back. The code with which I set clipper is:
LPDIRECTDRAW7 lpDDraw;...LPDIRECTDRAWCLIPPER lpClipper;lpDDraw     ->CreateClipper(0,&lpClipper,NULL);lpClipper   ->SetHWnd(0,hMain_Window);lpBackBuffer->SetClipper(lpClipper);

Btw, I am running in fullscreen mode. All is OK when I run my program in windowed mode with using of clipper. Is there any another way to set the clipper? If yes, how can I do it.

[Edited by - risko on July 6, 2004 10:31:32 AM]
Pipo DeClown
Pipo DeClown
Maybe it's something with VSync. It's been a long while since I used DirectDraw, but I see you're using a backbuffer, so instead of lpBackBuffer->Flip(NULL,0); use lpBackBuffer->Flip(NULL,DDFLIP_WAIT);

Else you should read on the difference between windowed mode and fullscreen mode. (There's something about it here!)
risko
risko
Instead of lpBackBuffer->Flip(0,DDBLT_WAIT) you should use
lpFrontBuffer->Flip(0,DDBLT_WAIT) ;) and I am using it. I read that article but it didn'd help :(
risko
risko
I have fixed my problem. DAMN, DAMN, DAMN, I was so blind.
Pipo DeClown
Pipo DeClown
Quote:
Original post by risko
I have fixed my problem. DAMN, DAMN, DAMN, I was so blind.


What was it???
risko
risko
I absolutly forgot that everytimes I am using clipper I can't set window style to WS_POPUPWINDOW but only to WS_POPUP. I don't know why is that so, but it is working so on my computer.
risko
risko
Yeah, sorry, but I have next question.
If I am running in fullscreen with using of a clipper and window style is:
WS_POPUPWINDOW - on upper-right (sometimes on upper-left) part of screen is small pixelating :(
WS_POPUP - everything is OK :)
Any ides how can this be possible?
Pipo DeClown
Pipo DeClown
WS_POPUP
Creates a pop-up window. This style cannot be used with the WS_CHILD style.

WS_POPUPWINDOW
Creates a pop-up window with WS_BORDER, WS_POPUP, and WS_SYSMENU styles. The WS_CAPTION and WS_POPUPWINDOW styles must be combined to make the window menu visible.

A popup is just the area where you draw (without the Graphics User Interface of your Operating System).
A popupwindow comes with the Windows-GUI (WS_BORDER,WS_CAPTION). The big difference is, that the drawing area of a popup is width by height, but with a popupwindow the totalwidth and totalheight is the same (thus the drawing area is smaller since it makes place for the WindowsGUI).

For fullscreen you want the popup to cover the whole screen, so you use WS_POPUP.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.