Re: Quick question: easy way to draw bitmap?
Re: Quick question: easy way to draw bitmap?
- Subject: Re: Quick question: easy way to draw bitmap?
- From: "Jeff Bland" <email@hidden>
- Date: Sat, 14 Jul 2007 01:04:33 +0900
Ye,p I have the issue solved with OpenGL already. Except even easier than
binding it to a texture, I used glDrawPixels (using
GL_UNSIGNED_SHORT_5_5_5_1 like you suggested), and I have my bitmap being
displayed and updated nicely.
Although two relatively unimportant questions remain in my mind regarding
efficiency.
First is that I had to create my own opengl context, and I'm wondering if
there's a glcontext already there that I could draw. Since there's other
views in the window, and the window itself, that do drawing - what context
are they drawing and would it be more efficient to grab a pointer to that
context and draw directly to it (ie might save a bit of memory and a copy
when everything gets composited together and put on the screen).
Also, I don't really need to double buffer my current glcontext, as im
literally only doing one very fast call to drawPixels call that takes up the
whole viewport, so in the name of efficiency i told it not to double buffer
- except that now it does update unless I drag a window over it and then off
(forcing it to redraw). Calling [my_window display] or [my_opengl_view
display] or [my_opengl_context display] doesn't update the view on the
screen. I'm wondering how to make it update from the program. It's not big
deal though, I can always double buffer and it probably wont matter at all
ever, but at least in the name of curiosity I'd like to get it working
single buffered.
Thanks much,
- Jeff Bland
On 7/14/07, Erik Buck <email@hidden> wrote:
Sorry, I was out of my mind. You actually want a line like the
following:
glTexImage2D(GL_TEXTURE_2D, 0, 3, imgWidth, imgHeight, 0, GL_RGB,
GL_UNSIGNED_SHORT_5_5_5_1, dataPtr);
Any you want to reference <http://developer.apple.com/documentation/
GraphicsImaging/Conceptual/OpenGL-MacProgGuide/opengl_texturedata/
chapter_10_section_5.html>
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden