| version 1.3, 2006/03/08 04:58:14 |
version 1.4, 2018/10/18 04:59:45 |
|
|
| #import "MyOpenGLController.h" |
#import "MyOpenGLController.h" |
| |
|
| // MyOpenGL window id (gid) is an indeger. |
// MyOpenGL window id (gid) is an indeger. |
| static MyOpenGLController *oglWindow[GID_MAX]; // gid --> MyOpenGLController instance. |
static MyOpenGLController *oglWindow[MY_GID_MAX]; // gid --> MyOpenGLController instance. |
| static MyDocument *oglParent[GID_MAX]; // gid --> parent MyDocument. |
static MyDocument *oglParent[MY_GID_MAX]; // gid --> parent MyDocument. |
| static int MyOpenGLControllerInitialized = 0; |
static int MyOpenGLControllerInitialized = 0; |
| static int Gid=0; |
static int Gid=0; |
| |
|
| Line 19 static int Gid=0; |
|
| Line 19 static int Gid=0; |
|
| +(void) initMyOpenGLController { |
+(void) initMyOpenGLController { |
| int i; |
int i; |
| if (MyOpenGLControllerInitialized) return; |
if (MyOpenGLControllerInitialized) return; |
| for (i=0; i<GID_MAX; i++) { oglWindow[i] = nil; oglParent[i] = nil; } |
for (i=0; i<MY_GID_MAX; i++) { oglWindow[i] = nil; oglParent[i] = nil; } |
| MyOpenGLControllerInitialized = 1; |
MyOpenGLControllerInitialized = 1; |
| } |
} |
| +(MyOpenGLController *)getOglWindow: (int) tid { |
+(MyOpenGLController *)getOglWindow: (int) tid { |
| Line 31 static int Gid=0; |
|
| Line 31 static int Gid=0; |
|
| |
|
| +(int) myOpenGLControllerOwnedBy: (MyDocument *) owner with: (int) tid { |
+(int) myOpenGLControllerOwnedBy: (MyDocument *) owner with: (int) tid { |
| MyOpenGLController *ogl; |
MyOpenGLController *ogl; |
| if ((tid >= 0) && (tid <GID_MAX)) { |
if ((tid >= 0) && (tid <MY_GID_MAX)) { |
| if (oglWindow[tid]) return tid; |
if (oglWindow[tid]) return tid; |
| else { |
else { |
| ogl = [[MyOpenGLController allocWithZone:[MyOpenGLController zone]] init]; |
ogl = [[MyOpenGLController allocWithZone:[MyOpenGLController zone]] init]; |
| Line 50 static int Gid=0; |
|
| Line 50 static int Gid=0; |
|
| |
|
| [MyOpenGLController initMyOpenGLController]; |
[MyOpenGLController initMyOpenGLController]; |
| tid = Gid; |
tid = Gid; |
| if (tid < GID_MAX) { |
if (tid < MY_GID_MAX) { |
| Gid++; |
Gid++; |
| return [MyOpenGLController myOpenGLControllerOwnedBy: owner with: tid]; |
return [MyOpenGLController myOpenGLControllerOwnedBy: owner with: tid]; |
| }else{ |
}else{ |
| Line 60 static int Gid=0; |
|
| Line 60 static int Gid=0; |
|
| +(void) removeMyOpenGLControllerOwnedBy: (MyDocument *) owner { |
+(void) removeMyOpenGLControllerOwnedBy: (MyDocument *) owner { |
| int i; |
int i; |
| [MyOpenGLController initMyOpenGLController]; |
[MyOpenGLController initMyOpenGLController]; |
| for (i=0; i<GID_MAX; i++) { |
for (i=0; i<MY_GID_MAX; i++) { |
| if (oglParent[i] == owner) { |
if (oglParent[i] == owner) { |
| [MyOpenGLController removeMyOpenGLControllerWithGid: i]; |
[MyOpenGLController removeMyOpenGLControllerWithGid: i]; |
| } |
} |
| Line 84 static int Gid=0; |
|
| Line 84 static int Gid=0; |
|
| */ |
*/ |
| |
|
| +(void) addOglComm: (NSString *)comm to: (int) tid from: (MyDocument *) owner { |
+(void) addOglComm: (NSString *)comm to: (int) tid from: (MyDocument *) owner { |
| if ((0<=tid) && (tid<GID_MAX)) { |
if ((0<=tid) && (tid<MY_GID_MAX)) { |
| if (oglWindow[tid] == nil) { |
if (oglWindow[tid] == nil) { |
| tid = [MyOpenGLController myOpenGLControllerOwnedBy: owner with: tid]; |
tid = [MyOpenGLController myOpenGLControllerOwnedBy: owner with: tid]; |
| } |
} |
| Line 92 static int Gid=0; |
|
| Line 92 static int Gid=0; |
|
| }else ; |
}else ; |
| } |
} |
| +(void) addOglInitComm: (NSString *)comm to: (int) tid from: (MyDocument *) owner { |
+(void) addOglInitComm: (NSString *)comm to: (int) tid from: (MyDocument *) owner { |
| if ((0<=tid) && (tid<GID_MAX)) { |
if ((0<=tid) && (tid<MY_GID_MAX)) { |
| if (oglWindow[tid] == nil) { |
if (oglWindow[tid] == nil) { |
| tid = [MyOpenGLController myOpenGLControllerOwnedBy: owner with: tid]; |
tid = [MyOpenGLController myOpenGLControllerOwnedBy: owner with: tid]; |
| } |
} |