PDA

View Full Version : c / opengl question



Rhyno
11-28-2007, 11:31 AM
C / opengl question:

Can i do this?





typedef struct
{
int i;
}widget;

display(void){
widget newWidget2;
newWidget2.i = 5;

newWidget1 = newWidget2; // Can i update widget1.i using this line?
}

void main(){
widget newWidget1;
...
glutDisplayFunc(display);
...

}


thanks!

ZbuffeR
11-28-2007, 05:02 PM
Sorry but this is pure plain simple C, and it is not related to OpenGL in any way.

You newWidget1 should be declared global if you want to access it from multiple functions without passing it in parameters.

widget newWidget1;

display(void){
...
newWidget1 = newWidget2;
}

void main(){
...
glutDisplayFunc(display);
...
}