View Full Version : OpenGl, load and display 2D image example?
06-30-2010, 01:56 PM
Hey I'm having trouble finding good examples of OpenGl for loading an image and displaying it. Anyone have any examples or code to help me out?
This is what I have so far:
It's an Apple source that I've been cutting up to form what I need. So far it works fine but when I try and display a picture that's not a power of 2 it doesn't display.
Could anyone help?
06-30-2010, 02:29 PM
(...)when I try and display a picture that's not a power of 2 it doesn't display.
On what hardware?
Does it support GL_ARB_texture_non_power_of_two extension?
(or at least GL_ARB_texture_rectangle)
06-30-2010, 02:37 PM
Newish iMac. I'm not sure if it supports that structure, my knowledge of OpenGl is actually relatively low but I can manipulate it.
Using an image sized at 1024x768 works but when I use a smaller size like 200x150 then it shows nothing...
06-30-2010, 02:54 PM
check the output of
char* extensions = glGetString( GL_EXTENSIONS );
See if 'extensions' string contains mentioned extensions.
I don't use Mac's so I do not know how it is with drivers,
You have to install them from card vendor (I have never seen download for mac), or they come with OS?
Make sure You are using latest drivers.
Have You tried loading small POT image? (64x64, or 128x64)
06-30-2010, 03:23 PM
I have the latest drivers and such though... a 64x64 image wouldn't work. I'm not sure why...
07-01-2010, 04:31 AM
It's obviously something wrong with your loader code, I've read it,
but I don't understand this strange programming language (Objective-C?)
Fix loader, or use some other library.
Powered by vBulletin® Version 4.2.0 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.