Re: NSOpenGLPixelFormatAttribute in ObjC++
Re: NSOpenGLPixelFormatAttribute in ObjC++
- Subject: Re: NSOpenGLPixelFormatAttribute in ObjC++
- From: email@hidden
- Date: Sat, 6 Jul 2002 13:09:33 +0200
On samedi, juillet 6, 2002, at 02:07 , Tommaso Pecorella wrote:
Hi, a stupid question:
I am trying to convert a ObjC code i have to an ObjC++ one (in order to
gain experience and to clean up the code).
In the code I have to build a NSOpenGLPixelFormat (in the ObjC part),
and, as usual, I have to create an NSOpenGLPixelFormatAttribute.
The "normal" code
----
NSOpenGLPixelFormatAttribute attribs[] =
{ NSOpenGLPFAAccelerated,
// NSOpenGLPFADepthSize, 24,
NSOpenGLPFAColorSize, 16,
NSOpenGLPFAMinimumPolicy,
NSOpenGLPFAMaximumPolicy,
// NSOpenGLPFAClosestPolicy,
0
};
----
raise an error that puzzles me (I have no idea about how to correct it):
---> conversion from `int' to `enum NSOpenGLPixelFormatAttribute'
What's the problem and how can I fix it ? It's an error, not a warning,
so I can't simply ignore it.
What you need to do is cast the integer to a
NSOpenGLPixelFormatAttribute so the following code will work:
NSOpenGLPixelFormatAttribute attribs[] =
{ NSOpenGLPFAAccelerated,
// NSOpenGLPFADepthSize, (NSOpenGLPixelFormatAttribute )24,
NSOpenGLPFAColorSize, (NSOpenGLPixelFormatAttribute )16,
NSOpenGLPFAMinimumPolicy,
NSOpenGLPFAMaximumPolicy,
// NSOpenGLPFAClosestPolicy,
0
};
Yes, it's stupid to have to make an explicit cast when you switch to
Obj-C++.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.