• Create Account

### #ActualArgusMaker

Posted 10 February 2013 - 01:20 PM

Hi there.

I would like to optimize the double buffer rendering system I made in win32 c++ programming with gdi+.

So far I created an offscreen static bitmap surface and a global Graphics object to draw onto it.
The problem is, every time I want to update the HDC of my window i need to create a new Graphic object and destroy it at the end of the event, like this:

...
case WM_PAINT:
hdc = BeginPaint(hWnd,&ps);
graphics = Graphics(hdc);
graphics.DrawImage(backbuffer,0,0,width,height);
EndPaint(hWnd,&ps);
break;
...
//graphics gets destroyed at the end of WndProc


Since this operation is repeated almost 40 times per second, i was wondering wether creating and destroying every time that object would somehow slow down my program.
Maybe this solution would be better:

- using a new compatible HDC as the backbuffer instead of the BMP
- inside WM_PAINT, copy that with BitBlt instead of creating a Graphics object

What do you think?

### #3ArgusMaker

Posted 10 February 2013 - 10:26 AM

Hi there.

I would like to optimize the double buffer rendering system I made in win32 c++ programming with gdi+.

So far I created an offscreen static bitmap surface and a global Graphics object to draw onto it.
The problem is, everytime I want to update the scene to the original HDC of my window i need to create a new Graphic object and destroy it at the end of the event, like this:

...
case WM_PAINT:
hdc = BeginPaint(hWnd,&ps);
graphics = Graphics(hdc);
graphics.DrawImage(backbuffer,0,0,width,height);
EndPaint(hWnd,&ps);
break;
...
//graphics gets destroyed at the end of WndProc


Since this operation is repeated almost 40 times per second, i was wondering wether creating and destroying every time that object would somehow slowing down my program.
Maybe this solution would be better:

- using a new compatible HDC as the backbuffer instead of the BMP
- inside WM_PAINT, copy that with BitBlt instead of creating a Graphics object

What do you think?

### #2ArgusMaker

Posted 10 February 2013 - 10:26 AM

Hi there.

I would like to optimize the double buffer rendering system I made in win32 c++ programming with gdi+.

So far I created an offscreen static bitmap surface and a global Graphics object to draw onto it.
The problem is, everytime I want to update the scene to the original HDC of my window i need to create a new Graphic object and destroy it at the end of the event, like this:

...
case WM_PAINT:
hdc = BeginPaint(hWnd,&ps);
graphics = Graphics(hdc);
graphics.DrawImage(backbuffer,0,0,width,height);
EndPaint(hWnd,&ps);
break;
...
//graphics gets destroyed at the end of WndProc


Since this operation is repeated almost 40 times per second, i was wondering wether creating and destroying every time that object is somehow slowing down my program.
Maybe this solution would be better:

- using a new compatible HDC as the backbuffer instead of the BMP
- inside WM_PAINT, copy that with BitBlt instead of creating a Graphics object

What do you think?

### #1ArgusMaker

Posted 10 February 2013 - 08:27 AM

Hi there.

I would like to optimize the double buffer rendering system I made in win32 c++ programming with gdi+.

So far I created an offscreen static bitmap surface and a global Graphics object to draw onto it.
The problem is, anytime I want to update the scene to the original HDC of my window i need to create a new Graphic object and destroy it at the end of the event, like this:

...
case WM_PAINT:
hdc = BeginPaint(hWnd,&ps);
graphics = Graphics(hdc);
graphics.DrawImage(backbuffer,0,0,width,height);
EndPaint(hWnd,&ps);
break;
...
//graphics gets destroyed at the end of WndProc


Since this operation is repeated almost 40 times per second, i was wondering wether creating and destroying every time that object is somehow slowing down my program.
Maybe this solution would be better:

- using a new compatible HDC as the backbuffer instead of the BMP
- inside WM_PAINT, copy that with BitBlt instead of creating a Graphics object

What do you think?

PARTNERS