loading textures - cocoa openGL
Hello everybody. This is my first post, so I apologize to you if I get something wrong. I also apologize to you because my english is not good, and so I'm surely going to say something wrong. 
I was looking for help in loading a texture in a cocoa application I was developing: I 've already looked some old threads, but none of these help me.
So: How can I do to load an image ( .bmp ) in cocoa and use it as an openGL texture?
I've alredy tried all these:
http://www.idevgames.com/forum/showthrea...ad+texture (I tried the code suggested from OSC and the one suggested from kelvin)
but the only result I have is a blue texture(with the OSC's code) or nothing (with kelvin's code).
Thanks to everybody for the help.

I was looking for help in loading a texture in a cocoa application I was developing: I 've already looked some old threads, but none of these help me.
So: How can I do to load an image ( .bmp ) in cocoa and use it as an openGL texture?
I've alredy tried all these:
http://www.idevgames.com/forum/showthrea...ad+texture (I tried the code suggested from OSC and the one suggested from kelvin)
but the only result I have is a blue texture(with the OSC's code) or nothing (with kelvin's code).
Thanks to everybody for the help.
If you're on an intel machine, you need to remove the _REV.
The usual way to do this is
The usual way to do this is
Code:
#if defined(__BIG_ENDIAN__)
GL_UNSIGNED_INT_8_8_8_8_REV,
#else
GL_UNSIGNED_INT_8_8_8_8
#endif
thanks for the answer!
I tried what you suggested me, and worked, I saw my texture!
But when I compiled again my project everything stopped and in the Log window appared this error message:
ZeroLink: unknown symbol '_GetGraphicsImporterForFile'
the_paolometro has exited due to signal 6 (SIGABRT).
It seems that the system doesn't recognise QuickTime functions, in spite of I imported the QuickTime library in the haeder file
Have you any idea?
I tried what you suggested me, and worked, I saw my texture!
But when I compiled again my project everything stopped and in the Log window appared this error message:
ZeroLink: unknown symbol '_GetGraphicsImporterForFile'
the_paolometro has exited due to signal 6 (SIGABRT).
It seems that the system doesn't recognise QuickTime functions, in spite of I imported the QuickTime library in the haeder file
Have you any idea?
oh I forget that you're right, I'm on an intel machine, and so removing the _REV everything works. But now I've that error and I don't know how to proceed.
Make sure QuickTime.framework is referenced from your project file. Also, turning off ZeroLink and/or doing a release build might give you a more informative error.
I'm still here. I was reading for the umpteenth time the OSC's code, when I thought that the problem could be the DisposeGWorld() that he suggests to call. So I tried to know something more about this function and the only thing I founded is that the function parameter whe have to pass it is a pointer to a offscreenGWorld variable...but I don't know what this one is and what this function should do!! I also founded out that this function is deprecated. Now the questions are:
1) Have I to call the DisposeGWorld() funtion? If so, when have I to call it and what is the parametr I have to pass it?
2) Why is this function deprecated? Is there a function that sobstitutes the DisposeGWorld()?
3) Is the call of this function the solution of my problem?
4) Why the first time I compile and build my project everything works, and the problem is came out later?
Or...what have I to do???
Thanks everybody
1) Have I to call the DisposeGWorld() funtion? If so, when have I to call it and what is the parametr I have to pass it?
2) Why is this function deprecated? Is there a function that sobstitutes the DisposeGWorld()?
3) Is the call of this function the solution of my problem?
4) Why the first time I compile and build my project everything works, and the problem is came out later?
Or...what have I to do???
Thanks everybody
Ok, thanks a lot, I'll try!
Great!..Everything works, I was missing the framework!
Let me know if I also need the DisposeGWorld(), but now seems that everything works perfectly also without it.
Thanks to everybody!
Marco
Let me know if I also need the DisposeGWorld(), but now seems that everything works perfectly also without it.
Thanks to everybody!
Marco
Without DisposeGWorld, you're probably leaking memory. If you want to get around the deprecation warning, you can do this:
The function still works, and there isn't a non-deprecated replacement, so that's your best bet if you're using QuickTime to load stuff.
Code:
#define DisposeGWorld DeprecatedDisposeGWorld
#include <QuickTime/QuickTime.h>
#undef DisposeGWorld
extern void DisposeGWorld(GWorldPtr offscreenGWorld);The function still works, and there isn't a non-deprecated replacement, so that's your best bet if you're using QuickTime to load stuff.
Ok, so I have to call the DisposeGWorld()! I suppose that the GWorldPtr parameter I have to pass to the function is the GWorldPtr variable that I use when I create the GWorld with the function QTNewGWorldFromPtr. Am I wrong?
But when have I to call the DisposeGWorld()? After or before the QTNewGWorldFromPtr?
And also: what does the DisposeGWorld do?
Thanks
But when have I to call the DisposeGWorld()? After or before the QTNewGWorldFromPtr?
And also: what does the DisposeGWorld do?
Thanks
I tried to use the DisposeGWorld() and it works only if I call it before the QTNewGWorldFromPtr. The deprecation warning is still here, but it's not a problem, surely I've not placed in the right position the code you suggested me. I think that the DisposeGWorld() is used to allocate the memory that is necessary to create the offscreen graphic ambient that we need to load the bitmap (and because of that we have to call it before the QTNewGWorldFromPtr). Let me know if I'm wrong! I'm here to learn!
thanks again
thanks again
DisposeGWorld frees the GWorld. Use it when you're finished with the GWorld. Just after the free() of the buffer should be good.
eheh, the opposite of what I was thinking..
..done, after the free() everything works..thanks
Marco
..done, after the free() everything works..thanks
Marco
I thought GWorlds are being depreciated? Before when I was building universal in my project I would get compiler warnings about it.
I saw on another thread a reference to FreeImage. I use FreeImage in my project now and it works well! So simple to use too and cross platform.
http://freeimage.sourceforge.net/
I saw on another thread a reference to FreeImage. I use FreeImage in my project now and it works well! So simple to use too and cross platform.
http://freeimage.sourceforge.net/
NewGWorld is deprecated. QTNewGWorld is not deprecated. But... DisposeGWorld is deprecated, but they didn't leave any way to get rid of a QTGWorld... Such is life.
QT is not in any remote danger of being deprecated so it's hard (impossible) to recommend against using it for image loading. Unfortunately that means having to put up with DisposeGWorld for now. I would imagine they'll get this straightened out by Leopard.
QT is not in any remote danger of being deprecated so it's hard (impossible) to recommend against using it for image loading. Unfortunately that means having to put up with DisposeGWorld for now. I would imagine they'll get this straightened out by Leopard.
Possibly Related Threads...
| Thread: | Author | Replies: | Views: | Last Post | |
| Opengl/Cocoa text rendering | tesil | 15 | 14,405 |
Mar 20, 2012 11:16 AM Last Post: OneSadCookie |
|
| [SOLVED]OpenGL edges of textures | mk12 | 2 | 3,620 |
Sep 2, 2010 08:07 PM Last Post: mk12 |
|
| OpenGL ES Loading images | techy | 4 | 3,358 |
Dec 24, 2009 02:01 PM Last Post: techy |
|
| OpenGL Image Textures | mikey | 52 | 19,968 |
Jun 30, 2009 10:42 AM Last Post: AnotherJake |
|
| Dealing with inverted textures in OpenGL | johncmurphy | 7 | 5,851 |
Jun 15, 2009 08:11 AM Last Post: Skorche |
|

