• 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
Multidimensional C array as method parameter (OBJ-C)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Multidimensional C array as method parameter (OBJ-C)


  • Subject: Multidimensional C array as method parameter (OBJ-C)
  • From: Bob Savage <email@hidden>
  • Date: Sat, 29 Dec 2001 14:57:10 -0600

Hi,

I am trying to use Cocoa (Obj-C) and OpenGL together. To create some vertex
lists I was hoping I could bypass the conversion to/from strings by NSPoints
(NSStringFromPoint) and etc. that is involved in passing arrays of NSPoints
around. I will be using quite a lot of points, and converting them between
an internal coordinate system (a hexagonal space) and the standard cartesion
coordinate system for display via OpenGL. I thought keeping everything in a
multidimensional C array as much as possible would make it easier for me
when I declare the GL vertex array.

I can easily pass a one dimensional array of NSPoints (using type
"NSPointArray"), in fact I use that to calculate the vertices of the hexagon
from a center.

I COULD create a function which accepts a multidimensional array, ( by
declaring the parameter like this: "NSPoint pArray[][6]" ) but then I lose
the benefits of OBJ-C (e.g. access to the class' namespace -- iVars, "self"
etc.

Unfortunately the compiler considers using a construct like
"funcName:(NSPoint)pARRAY[][6]" an illegal method declaration. It will
compile using "funcName:(NSPointArray *)pARRAY", but then it doesn't know
how to do the pointer arithmetic within the function.

Sorry if I'm not being clear, I'm feeling a bit under the weather today, and
it seems to be affecting my communication skills.

best to all,

Bob Savage


  • Prev by Date: Re: Lists as newsgroups (or: give chuq more work!)
  • Next by Date: Re: HTML Rendering
  • Previous by thread: drag&drop in a NSTableView
  • Next by thread: Re: HTML Rendering
  • Index(es):
    • Date
    • Thread