Re: [wx-discuss] Getting OpenGL Textures from DCs

16 views
Skip to first unread message

Vadim Zeitlin

unread,
Jun 9, 2008, 11:49:45 AM6/9/08
to wx-di...@lists.wxwidgets.org
On Mon, 9 Jun 2008 11:02:13 +0300 "Mokhtar M. Khorshid" <M...@Thunder-Power.com> wrote:

MMK> What I need is basically an RGB or RGBA array of bytes.

Look at contents of wx/rawbmp.h and example of using it in the image
sample.

Regards,
VZ

Mokhtar M. Khorshid

unread,
Jun 9, 2008, 4:02:13 AM6/9/08
to wx-di...@lists.wxwidgets.org

I am trying to quickly create OpenGL textures from a wxDC, is there a faster way than doing it manually? What I need is basically an RGB or RGBA array of bytes.

One way to do it would be to let the user do the conversion, but drawing to an array of bytes will be less convenient than drawing to a DC. On the other hand, if I have to copy the data from the DC then I am wasting CPU cycles.

 

I believe someone might have already tried something similar and may have a good solution for this.

 

Thanks

 

Mokhtar M. Khorshid

Mokhtar M. Khorshid

unread,
Jun 10, 2008, 5:02:06 AM6/10/08
to wx-di...@lists.wxwidgets.org
Thanks.
The code in rawbmp.h works for bitmaps not DCs, are you suggesting I do
something similar to this for DCs?

-Mokhtar M. Khorshid

Regards,
VZ

_______________________________________________
wx-discuss mailing list
wx-di...@lists.wxwidgets.org
http://lists.wxwidgets.org/mailman/listinfo/wx-discuss

Vadim Zeitlin

unread,
Jun 10, 2008, 7:12:36 AM6/10/08
to wx-di...@lists.wxwidgets.org
On Tue, 10 Jun 2008 12:02:06 +0300 "Mokhtar M. Khorshid" <M...@Thunder-Power.com> wrote:

MMK> The code in rawbmp.h works for bitmaps not DCs, are you suggesting I do
MMK> something similar to this for DCs?

wxMemoryDC is the class which allows you to treat wxDC contents as
wxBitmap. So you can Blit() the contents of your DC into a memory one
and then work with it as with bitmap.

Regards,
VZ

Julian Smart

unread,
Jun 10, 2008, 9:30:23 AM6/10/08
to wx-di...@lists.wxwidgets.org
Hi Mokhtar,

As I mentioned in private email, we would pass a memory DC to the app
class for rendering and then convert the resulting bitmap to a texture.
So no need to get data from a DC directly. It's worth a quick look at at
the wxMemoryDC documentation.

Regards,

Julian


--
Julian Smart, Anthemion Software Ltd.
28/5 Gillespie Crescent, Edinburgh, Midlothian, EH10 4HU
www.anthemion.co.uk | +44 (0)131 229 5306
Tools for writers: www.writerscafe.co.uk
wxWidgets RAD: www.anthemion.co.uk/dialogblocks

Reply all
Reply to author
Forward
0 new messages