• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSOpenGLPixelFormatAttribute in ObjC++
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.
  • Follow-Ups:
    • Re: NSOpenGLPixelFormatAttribute in ObjC++
      • From: Tommaso Pecorella <email@hidden>
References: 
 >NSOpenGLPixelFormatAttribute in ObjC++ (From: Tommaso Pecorella <email@hidden>)

  • Prev by Date: Accessing NSTextView from a thread (locking problem)
  • Next by Date: Re: NSURL + proxy or firewall
  • Previous by thread: NSOpenGLPixelFormatAttribute in ObjC++
  • Next by thread: Re: NSOpenGLPixelFormatAttribute in ObjC++
  • Index(es):
    • Date
    • Thread