• 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: Redisplaying the Window
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Redisplaying the Window


  • Subject: Re: Redisplaying the Window
  • From: Adam <email@hidden>
  • Date: Fri, 15 Dec 2006 21:26:56 -0800


On Dec 15, 2006, at 9:03 PM, David Dunham wrote:
On 15 Dec 2006, at 20:39, Adam wrote:

"invalid types 'GLfloat[7][14][GLfloat]' for array subscript"

I know this has OpenGL code in it, but this isn't GL-specific, so I  
felt that these lists are more appropriate for this question.

This list is for the use of the Xcode development system, not really  
for specific development questions. (Those belong on Carbon or mac- 
games-dev or similar lists.)

But I'll take a stab at yours: you're using a floating point variable  
for an index. This isn't good C practice. Change your GLfloat to  
"int" and you'll probably get a happier result. (What would  
arr_tetris_screen[0.5][1.3] represent?)

David Dunham     A Sharp, LLC
Voice/Fax: 206 783 7404     http://a-sharp.com
"People seem to misinterpret complexity as sophistication" -- Niklaus  
Wirth

Whoops. I didn't know about the carbon list. I'll remember that in the future. See below for more...



On Dec 15, 2006, at 9:02 PM, Chris Espinosa wrote:


On Dec 15, 2006, at 8:39 PM, Adam wrote:

void redisplay()
{
for (GLfloat redisp = 0; redisp <= 7; redisp ++)
{
for (GLfloat redisp2 = 0; redisp2 <= 14; redisp ++)
{
switch (arr_tetris_screen [redisp] [redisp2])
{
case box:
{
glBegin(GL_QUADS);
glColor3f(1.0, 0.0, 0.0);
glVertex3f(redisp+1, redisp2+1, 0.0); glVertex3f(redisp, redisp2+1, 0.0);
glVertex3f(redisp, redisp2+1, 0.0); glVertex3f(redisp, redisp2, 0.0);
}
default: exit(1234);
}
}
}
glutPostRedisplay();
}

This gives me two errors: 
"jam exited with exit code 1"
"invalid types 'GLfloat[7][14][GLfloat]' for array subscript"

I know this has OpenGL code in it, but this isn't GL-specific, so I felt that these lists are more appropriate for this question. 

You should probably use integers, rather than floating-point values, for the array indicies, and for the array content as well.  The compiler does not like to index into arrays using floats.

Chris


Thank you both for your help. It works now. I will subscribe to the Carbon or Cocoa list (when I find one) and remember to use that next time. Thank you both again.



All help is appreciated and thanks in advance.

~ < [ / Adam-o \ ] > ~

+-------------------------------------------+
| My computer's Stats                      |
| Mac OS 10.4.8                               |
| 1 Ghz Apple Powerbook G4        |
| Xcode v. 2.4.1                                 |
+-------------------------------------------+

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Please keep your posts straight and 
to the point. Also please comment 
the code you use as I am still learning 
OpenGL and Xcode and may not yet 
understand the meaning of the command.
 Thank you.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Redisplaying the Window
      • From: Shawn Erickson <email@hidden>
    • Re: Redisplaying the Window
      • From: Adam <email@hidden>
References: 
 >Redisplaying the Window (From: Adam <email@hidden>)
 >Re: Redisplaying the Window (From: Chris Espinosa <email@hidden>)

  • Prev by Date: Re: Redisplaying the Window
  • Next by Date: Re: Redisplaying the Window
  • Previous by thread: Re: Redisplaying the Window
  • Next by thread: Re: Redisplaying the Window
  • Index(es):
    • Date
    • Thread