Texture Loading Headaches
All right, I know this has been done to death on the boards, but I'm still having problems... I've tried the NeHe tutorials, and the QTValuePak, but to no avail. (They don't seem to work with Panther's XCode.)
I'm just trying to load a texture from file (format doesn't really matter to me at this stage, but I'm using Targa, since that seems to be the popular thing to do) and slap it on a quad. I'm writing in C++ and using GLUT.
Can anyone give me (or point me to) some sample code that ONLY loads a texture and displays it? Most samples I've seen do too many things at once, or are poorly commented. I still don't really have a handle on the OpenGL internal representation of a texture, and that's part of my problem at the moment.
I appreciate the help, and apologize for asking a newbie question.
I'm just trying to load a texture from file (format doesn't really matter to me at this stage, but I'm using Targa, since that seems to be the popular thing to do) and slap it on a quad. I'm writing in C++ and using GLUT.
Can anyone give me (or point me to) some sample code that ONLY loads a texture and displays it? Most samples I've seen do too many things at once, or are poorly commented. I still don't really have a handle on the OpenGL internal representation of a texture, and that's part of my problem at the moment.
I appreciate the help, and apologize for asking a newbie question.
If you're sure that your texture loading code is copied pretty much verbatim, you might not have a GL context set up when you're loading your textures?
Make sure you've already set up your GLUT / AGL / NSGL /CGL window before you try and load any textures or display lists.
Make sure you've already set up your GLUT / AGL / NSGL /CGL window before you try and load any textures or display lists.
Damn, QTValuePak doesn't work in Panther
Guess I've got some work to do... been procrastinating updating QTValuePak for ages now, might be a good thing 
The texture loading code should is fine though... Smiley Tag (source also available on iDevGames) uses a modified version of the QTValuePak code to load textures, and that works fine on Panther. It's probably also a more useful example, since you can just about cut-and-paste the function...
Guess I've got some work to do... been procrastinating updating QTValuePak for ages now, might be a good thing 
The texture loading code should is fine though... Smiley Tag (source also available on iDevGames) uses a modified version of the QTValuePak code to load textures, and that works fine on Panther. It's probably also a more useful example, since you can just about cut-and-paste the function...
Search our source code section. There are a few very small OpenGL samples that show things like that quite clearly.
Wow, thanks for all the advice, guys. Glad to find a place on the web that's friendly to dumb questions and newbies like me. 
I looked at the SmileyTag sample, but it's Obj-C and I only know C++ at the moment. I'm certainly not averse to learning Obj-C, but at this juncture I'd rather get the principle down in my native language so I can focus on just learning one thing at a time.
I really wish the source code library was searchable.... or is it and I'm just missing something obvious. Any other suggestions?

I looked at the SmileyTag sample, but it's Obj-C and I only know C++ at the moment. I'm certainly not averse to learning Obj-C, but at this juncture I'd rather get the principle down in my native language so I can focus on just learning one thing at a time.
I really wish the source code library was searchable.... or is it and I'm just missing something obvious. Any other suggestions?
The source code system is being revamped right now. A nice new set of features should be coming soon, I hope. Go, Griggs, Go!
Quote:Originally posted by napthali
I looked at the SmileyTag sample, but it's Obj-C and I only know C++ at the moment.
STLuaGraphics.m only has a couple of lines of ObjC; the rest is straight C (and mostly straight from QTValuePak). If you need help removing those couple of lines, either come to the iDevGames chat or email me personally.
Quote:Originally posted by OneSadCookieI have a similar problem but I'm not using QTValuePak. It appears to be a problem with glTexImage2D although I haven't figured out what's up yet. SmileyTag uses gluBuild2DMipmaps instead and that works just fine in place of glTexImage2D in Panther for right now. Must figure this one out.
Damn, QTValuePak doesn't work in PantherGuess I've got some work to do...
glTexImage2D is significantly improved in Panther... maybe you're running afoul of that somehow
The problem with QTValuePak is almost certainly to do with events or something. The QuickDraw image sample stopped working in Panther for event-handling reasons, I'm assuming something similar is going on here.
The problem with QTValuePak is almost certainly to do with events or something. The QuickDraw image sample stopped working in Panther for event-handling reasons, I'm assuming something similar is going on here.
Quote:Originally posted by OneSadCookieMaybe. But this works:
glTexImage2D is significantly improved in Panther... maybe you're running afoul of that somehow
Code:
gluBuild2DMipmaps( GL_TEXTURE_2D, GL_RGBA, imageBounds.right, imageBounds.bottom, GL_BGRA_EXT, GL_UNSIGNED_INT_8_8_8_8_REV, buffer );Code:
glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, imageBounds.right, imageBounds.bottom, 0, GL_BGRA_EXT, GL_UNSIGNED_INT_8_8_8_8_REV, buffer );
In what sense not work? White texture image? OpenGL error? Corrupt Texture Image?
Quote:Originally posted by napthaliIf you click the download file finder, you can search it. Unfortunately, the example I was thinking of is Cocoa, so it won't help you much...
I really wish the source code library was searchable.... or is it and I'm just missing something obvious. Any other suggestions?
Quote:Originally posted by OneSadCookieYeah, white texture image. Sorry about the lack of description. This is actually starting to tick me off a little now. My same exact texture loading library works perfectly in another app that I have so I suspect that the problem is not with glTexImage2D after all. It's gonna be a long night tracking this one down... Were there any significant changes to texturing/blending/??? in Panther that you can think of off the top of your head?
In what sense not work? White texture image? OpenGL error? Corrupt Texture Image?
Several of Apple's own GL demos have broken white textures in Panther, so you're not alone.
Maybe flooding Apple with bugs saying "don't break stuff, dumbasses" will fix it?
Maybe flooding Apple with bugs saying "don't break stuff, dumbasses" will fix it?
Possibly Related Threads...
| Thread: | Author | Replies: | Views: | Last Post | |
| iPhone texture loading issue | yotryu | 0 | 3,123 |
Mar 11, 2009 03:40 AM Last Post: yotryu |
|
| Texture Mapping: Loading a texture from a .bmp file? | ishrock | 5 | 5,007 |
Dec 13, 2008 09:27 AM Last Post: ThemsAllTook |
|
| OpenGL Texture Loading & Sprites | corporatenewt | 2 | 10,600 |
Jan 30, 2008 12:39 PM Last Post: ynda20 |
|
| Texture Loading in Cocoa... | dave05 | 3 | 7,669 |
Dec 11, 2007 03:12 AM Last Post: DoG |
|
| Cocoa Texture Loading Code Problem | Nick | 1 | 2,774 |
Oct 28, 2005 11:44 PM Last Post: OneSadCookie |
|

