Getting OpenGL Textures from DCs

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Getting OpenGL Textures from DCs

Mokhtar M. Khorshid

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


_______________________________________________
wx-discuss mailing list
[hidden email]
http://lists.wxwidgets.org/mailman/listinfo/wx-discuss
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Getting OpenGL Textures from DCs

Vadim Zeitlin-4
On Mon, 9 Jun 2008 11:02:13 +0300 "Mokhtar M. Khorshid" <[hidden email]> 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

_______________________________________________
wx-discuss mailing list
[hidden email]
http://lists.wxwidgets.org/mailman/listinfo/wx-discuss
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

RE: Getting OpenGL Textures from DCs

Mokhtar M. Khorshid
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

-----Original Message-----
From: [hidden email]
[mailto:[hidden email]] On Behalf Of Vadim Zeitlin
Sent: Monday, June 09, 2008 6:50 PM
To: [hidden email]
Subject: Re: [wx-discuss] Getting OpenGL Textures from DCs

On Mon, 9 Jun 2008 11:02:13 +0300 "Mokhtar M. Khorshid"
<[hidden email]> 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

_______________________________________________
wx-discuss mailing list
[hidden email]
http://lists.wxwidgets.org/mailman/listinfo/wx-discuss

_______________________________________________
wx-discuss mailing list
[hidden email]
http://lists.wxwidgets.org/mailman/listinfo/wx-discuss
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re[2]: Getting OpenGL Textures from DCs

Vadim Zeitlin-4
On Tue, 10 Jun 2008 12:02:06 +0300 "Mokhtar M. Khorshid" <[hidden email]> 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

_______________________________________________
wx-discuss mailing list
[hidden email]
http://lists.wxwidgets.org/mailman/listinfo/wx-discuss
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Getting OpenGL Textures from DCs

Julian Smart
In reply to this post by Mokhtar M. Khorshid
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

Mokhtar M. Khorshid wrote:

> 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
>
> -----Original Message-----
> From: [hidden email]
> [mailto:[hidden email]] On Behalf Of Vadim Zeitlin
> Sent: Monday, June 09, 2008 6:50 PM
> To: [hidden email]
> Subject: Re: [wx-discuss] Getting OpenGL Textures from DCs
>
> On Mon, 9 Jun 2008 11:02:13 +0300 "Mokhtar M. Khorshid"
> <[hidden email]> 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
>
> _______________________________________________
> wx-discuss mailing list
> [hidden email]
> http://lists.wxwidgets.org/mailman/listinfo/wx-discuss
>
> _______________________________________________
> wx-discuss mailing list
> [hidden email]
> http://lists.wxwidgets.org/mailman/listinfo/wx-discuss
>
>
>  


--
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

_______________________________________________
wx-discuss mailing list
[hidden email]
http://lists.wxwidgets.org/mailman/listinfo/wx-discuss
Loading...