changing mouse icon in cocoa

Say that I have an inventory window(opengl view) with pictures (textures quads really)of the player's inventory items. I want to be able to click the item and then change the mouse(or at least make it appear that way) to the newly clicked inventory item. What's the simplest way to achieve this in cocoa?

Maybe I'm wrong but if I'm not this should make my question more specific. I would assume that I would need to create a new cursor with an image of the inventory item. If this is the case, then I guess my question would be, while creating an image and after calling [image lockFocus], would I be able to draw directly into the image using a textured quad through opengl?

But you're loading your textures into OpenGL somehow, right? Are you not using Quartz (via CoreGraphics/ImageIO/Cocoa/whatever) for that already?

I'm only using opengl. The item that I want to draw is in a texture sprite sheet in opengl.

I just assumed that the only to do it was to initialize a new cursor with an image, but I don't know how to write texture data directly into the image file (I mean I can see how you could do it that way but there must be something easier). But if there is some totally different path I'm overlooking, please let me know.

if( texture->width <=0 || // Is The Width Less Than Or Equal To Zero
texture->height <=0 || // Is The Height Less Than Or Equal To Zero
(header[4]!=24 && header[4]!=32)) // Is The TGA 24 or 32 Bit?
{
fclose(file); // If Anything Failed, Close The File
return FALSE; // Return False
}

Leroy Wrote:I don't believe I can do that because I have a view for the actual game, and then another view(two totally different sublasses of nsopenglview) for the inventory.

Having two different views shouldn't make any difference.

Quote:What's the downside to using tgas? Anyways if you can suggest a better format and(or) refer me to some better code I would appreciate it.

TGAs don't compress well. PNGs and JPEGs are widely recommended here. You can use either their respective libs which will be cross-platform, or you can use one of the many code suggestions and resources found here on the forums (a simple forum search will likely yield lots of results). Among them you will find either Quicktime or Quartz being the most popular Mac-only approaches. There seems to be a nice cross-platform image loading lib floating around lately, but I don't recall the name, nor have I looked at it (yet), sorry.

AnotherJake Wrote:Having two different views shouldn't make any difference.

If my game view is in the left edge of the screen and my inventory view is in the right edge of the screen, then when I drag an item from the inventory view over to the game view (and in the process cross over the center of the screen which has no opengl view at all) how could I possible use opengl to draw the cursor image over this middle space?

Ah! I see what you're saying. I didn't think about that at all... I didn't realize you'd be dragging and needing the cursor in-between the two. Yeah, pretty-much nixes the whole OpenGL cursor drawing idea.