• 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: "Clark S. Cox III" <email@hidden>
  • Date: Fri, 4 Oct 2002 14:27:40 -0400

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


On Friday, Oct 4, 2002, at 14:22 US/Eastern, Brent Gulanowski wrote:


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.

Look again at the OP's function call:

glTranslatef(xVert[i], yVert[i], 0.0);

xVert is an array of floats, therefore xVert[i] is *a single float*
yVert is an array of floats, therefore yVert[i] is *a single float*

The OP is not passing any arrays to glTranslatef(), he was passing three floats, nothing more, nothing less.

You want him to call your method inside a loop?

No, the method (and the function it is based on) already contains the loop.

- -- http://homepage.mac.com/clarkcox3/
email@hidden
Clark S. Cox, III
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (Darwin)

iEYEARECAAYFAj2d3aIACgkQd6STocYT1xXFUACgl4cwnAoy2v/f/Qjb3dKduCSG
6aMAnRrLcySFMKlsFKhDRtM2rFmkA64O
=knAw
-----END PGP SIGNATURE-----
_______________________________________________
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.

References: 
 >Re: C to Objective-C (From: Brent Gulanowski <email@hidden>)

  • Prev by Date: Re: C to Objective-C
  • Next by Date: Class used in Interface Builder not being linked?
  • Previous by thread: Re: C to Objective-C
  • Next by thread: Re: C to Objective-C
  • Index(es):
    • Date
    • Thread