Results 1 to 2 of 2
Discuss Getting bitmap from local image C++/OpenGL at the Free Toolchain Software (Cydia App's) - Hackint0sh.org; Hello, Haven t found any forum for that so just try here. I want to ...
  1. #1
    Newbie Array

    Join Date
    Nov 2007
    Posts
    1
    Post Thanks / Like
    Downloads
    0
    Uploads
    0
    Rep Power
    0

    Default Getting bitmap from local image C++/OpenGL

    Hello,


    Haven t found any forum for that so just try here.

    I want to get the bitmap image from a local JPG or TIFF to use as an OpenGL texture in C++ on the iPhone.
    So normally the image is loaded with a UIImage or a UIImageView from the UIKit but I don t know how to get the bitmap buffer to create an OpenGL Texture.

    Thanks for any help, if any



  2. #2
    Newbie Array

    Join Date
    Nov 2007
    Posts
    7
    Post Thanks / Like
    Downloads
    0
    Uploads
    0
    Rep Power
    0

    Default

    Hey,

    I did exactly that. I used a UIImage to load something on a CGImageRef:

    UIImage* image = [UIImage imageNamed: fileName];
    CGImageRef inImage = image.imageRef;

    Then just create a context and use CGBitmapContextGetData to grab the raw data. THen it's just a matter of using glTexImage2D to create the GL texture.

    Works a treat for me!

    Cheers,
    Max

 

 

Similar Threads

  1. MacNN: Mac OS X 10.6.3 to use OpenGL 3.0?
    By hackint0sh in forum Latest Headlines
    Replies: 0
    Last Post: 01-12-2010, 05:20 PM
  2. [iPhone SDK] Can i use C++ and OpenGL ?
    By riruilo in forum iPhone Developer Exchange
    Replies: 14
    Last Post: 11-18-2009, 12:12 AM
  3. OpenGL games on MAC
    By xinos in forum Using Leopard
    Replies: 1
    Last Post: 03-08-2009, 04:49 PM
  4. [1.1.4] How to change carrier image and dock image?
    By TheSacredSoul in forum General
    Replies: 0
    Last Post: 02-28-2008, 12:36 PM
  5. Replies: 0
    Last Post: 09-14-2007, 05:50 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Powered by vBulletin®
Copyright © 2014 vBulletin Solutions, Inc. All rights reserved.
Search Engine Friendly URLs by vBSEO
(c) 2006-2012 Hackint0sh.org
All times are GMT +2. The time now is 02:52 AM.
twitter, follow us!