• 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: C to Objective-C
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: C to Objective-C


  • Subject: Re: C to Objective-C
  • From: Brent Gulanowski <email@hidden>
  • Date: Fri, 4 Oct 2002 14:22:14 -0400

On Friday, October 4, 2002, at 12:37 PM, Clark S. Cox III wrote:


On Friday, Oct 4, 2002, at 12:18 US/Eastern, Ondra Cada wrote:


On Friday, October 4, 2002, at 05:17 , Clark S. Cox III wrote:

void vertices(float xVert[], float yVert[], int TOTAL)
{
int i;
for(i=0; i < TOTAL; i++) {
glTranslatef(xVert[i], yVert[i], 0.0);
...
Or, even better:

- - (void)verticesX:(const float*)xVert Y:(const float*)yVert T:(size_t)TOTAL;

You sure? I don't know what and how glTranslate does, but it looks very like it wants to *change* them.

Yep, notice that the arrays are dereferenced (by the array subscript) before passing to glTranslate, that means that a plain ol' float is getting passed. Plus glTranslatef is a standard OpenGL function declared as (or close to):

void glTranslatef(float, float, float);

Uhhh, op was trying to pass a pair of arrays, not plain floats. You want him to call your method inside a loop?

I would personally question the logic of passing these data values from one file (read "object") to another in this way. Encapsulate those arrays into an object and tell that object to submit them instead of passing them around. You have to copy them into the object once when it's instantiated, but that's it. Then you just tell it [object submitVerts] every time you redraw the frame.

Otherwise, just stick with C.

--
Brent Gulanowski email@hidden

I bought some batteries... but they weren't included... so I had to buy them again. - Stephen Wright
_______________________________________________
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: C to Objective-C
      • From: "Clark S. Cox III" <email@hidden>
References: 
 >Re: C to Objective-C (From: "Clark S. Cox III" <email@hidden>)

  • Prev by Date: Re: C to Objective-C
  • Next by Date: Re: C to Objective-C
  • Previous by thread: Re: C to Objective-C
  • Next by thread: Re: C to Objective-C
  • Index(es):
    • Date
    • Thread