Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
RE: from NSImage to a Texture
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: from NSImage to a Texture



Hi

I just created a tool to do exactly this thing. I can drag any image onto my app, and it make it into a texture.

My approach was to get a NSBitmapRep to gain access to such data as pixel dimensions. Then use [NSImage -lockFocus] and the function NSReadPixel to read each pixel onto a mulit-dimensional array of your choosing; something like GLubyte pm[height][width][depth].

I also made a function to translate between pixel formats, it works quite well.

Best,
Thomas Jahnsen
email@hidden


>Message: 1
>Date: Sun, 28 Sep 2003 00:42:45 +0800
>From: Aaron Boothello <email@hidden>
>To: email@hidden
>Subject: from NSImage to a Texture
>
>Alright, ive gone throught the sample code (OpenGL Image) and im upto the 'load an image into an NSImage ' stage. now what ? how do i get the info i need from the NSImage into a texture to use in OpenGL ?
>I had asked a similar question sometime back and i got responses asking me to check out NSImage and NSImageRep and the 'OpenGL Image' sample code. i've looked around at tutorials and im still unclear on how to get from an NSImage to a texture that i can use in OpenGL. please help :).
>
>Cheers,
>Aaron
>
>
>--__--__--
>

__________________________________________________________________
McAfee VirusScan Online from the Netscape Network.
Comprehensive protection for your entire computer. Get your free trial today!
http://channels.netscape.com/ns/computing/mcafee/index.jsp?promo=393397

Get AOL Instant Messenger 5.1 free of charge. Download Now!
http://aim.aol.com/aimnew/Aim/register.adp?promo=380455
_______________________________________________
mac-opengl mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/mac-opengl
Do not post admin requests to the list. They will be ignored.



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.