00001 #include <GL/gl.h>
00002 #include <GL/glu.h>
00003 #include <SDL/SDL.h>
00004
00005 #include "drawTest.H"
00006 #include "defineConj.H"
00007
00008 int target_Pt3[2] = {4,6};
00009 int target_Pt2[4] = {1,2,3,5};
00010 int BO_L[2][2] = {{1,3},{0,2}};
00011 int BO_Sq[2][2] = {{0,2},{1,3}};
00012 int BO_Pt2[2][2] = {{0,2},{1,3}};
00013 int BO_Shapes[2][12] = {{0,1,2,3,7,8,9,10,15,16,19,20},
00014 {4,5,6,11,12,13,14,17,18,21,22,23}};
00015 int target_dir;
00016
00017 int msleep(int ms)
00018 {
00019 struct timeval timeout;
00020
00021 timeout.tv_sec = ms / 1000;
00022 timeout.tv_usec = (ms % 1000) * 1000;
00023 if (select(0, (fd_set *) 0, (fd_set *) 0, (fd_set *) 0, &timeout) < 0) {
00024 perror("usleep");
00025 return -1;
00026 }
00027 return 0;
00028 }
00029
00030 int search(int tar)
00031 {
00032 int i,j;
00033
00034 for(i=0;i<2;i++){
00035 for(j=0;j<12;j++){
00036 if(tar == BO_Shapes[i][j]){
00037 return(i);
00038 }
00039 }
00040 }
00041 printf("Error\n tar = %d\n", tar);
00042 exit(0);
00043 }
00044
00045
00046 int selection(int tar)
00047 {
00048 if(tar >= 0 && tar < 4)return 0;
00049 else if(tar >=4 && tar < 8)return 1;
00050 else return 2;
00051 }
00052
00053 void shuffle (int array[],int count)
00054 {
00055 int i,tmp,change,array2[400];
00056
00057 srand((unsigned int)time(NULL));
00058
00059 for (i = 0; i < count; ++i)
00060 array2[i]=array[i];
00061
00062 for (i = 0; i < count; ++i) {
00063 change = rand() % count;
00064 tmp = array2[i];
00065 array2[i] = array2[change];
00066 array2[change] = tmp;
00067
00068 }
00069
00070 for( i = 0; i < count; i++ ){
00071 array[i]=array2[i];
00072 }
00073 }
00074
00075 void fragStimuli(int stimuli[],int target_stim,int target_BO)
00076 {
00077
00078 if(target_stim >= 0 && target_stim < 4){
00079
00080 if (target_BO == 0){
00081 target_dir = 0;
00082 stimuli[1]=3;
00083 stimuli[3]=3;
00084 }else{
00085 target_dir = 1;
00086 stimuli[0]=3;
00087 stimuli[2]=3;
00088 }
00089 }
00090
00091 else if(target_stim == 4){target_dir = 1;stimuli[9]=3;}
00092 else if(target_stim == 5){target_dir = 0;stimuli[8]=3;}
00093 else if(target_stim == 6){target_dir = 3;stimuli[11]=3;}
00094 else if(target_stim == 7){target_dir = 2;stimuli[10]=3;}
00095 else if(target_stim == 8){target_dir = 0;stimuli[5]=3;}
00096 else if(target_stim == 9){target_dir = 1;stimuli[4]=3;}
00097 else if(target_stim == 10){target_dir = 2;stimuli[7]=3;}
00098 else if(target_stim == 11){target_dir = 3;stimuli[6]=3;}
00099 stimuli[target_stim] = 1;
00100 }
00101
00102 void SelectStimuli(int stimuli, float Lcolor, float x, float y, float times)
00103 {
00104 float Newcolor;
00105
00106 if(Lcolor ==1.0) Newcolor = 0.0;
00107 else Newcolor = 1.0;
00108
00109 switch (stimuli){
00110 case 0:
00111 {
00112 draw_dist(1,x,y,Newcolor,times);
00113 }break;
00114 case 1:
00115 {
00116 draw_dist(0,x,y,Newcolor,times);
00117 }break;
00118 case 2:
00119 {
00120 draw_dist(3,x,y,Newcolor,times);
00121 }break;
00122 case 3:
00123 {
00124 draw_dist(2,x,y,Newcolor,times);
00125 }break;
00126 case 4:
00127 {
00128 draw_L1(1,x,y,Newcolor,times);
00129 draw_New1(1,x,y,Lcolor,times);
00130 }break;
00131 case 5:
00132 {
00133 draw_L1(0,x,y,Newcolor,times);
00134 draw_New1(0,x,y,Lcolor,times);
00135 }break;
00136 case 6:
00137 {
00138 draw_L1(3,x,y,Newcolor,times);
00139 draw_New1(3,x,y,Lcolor,times);
00140 }break;
00141 case 7:
00142 {
00143 draw_L1(2,x,y,Newcolor,times);
00144 draw_New1(2,x,y,Lcolor,times);
00145 }break;
00146 case 8:
00147 {
00148 draw_Square1(0,x,y,Newcolor,times);
00149 draw_L1(0,x,y,Lcolor,times);
00150 }break;
00151 case 9:
00152 {
00153 draw_Square1(1,x,y,Newcolor,times);
00154 draw_L1(1,x,y,Lcolor,times);
00155 }break;
00156 case 10:
00157 {
00158 draw_Square1(2,x,y,Newcolor,times);
00159 draw_L1(2,x,y,Lcolor,times);
00160 }break;
00161 case 11:
00162 {
00163 draw_Square1(3,x,y,Newcolor,times);
00164 draw_L1(3,x,y,Lcolor,times);
00165 }break;
00166 default:
00167 {
00168 }break;
00169 }
00170
00171 }
00172
00173 void Display_TargetShape(int target,int type)
00174 {
00175 glPushMatrix();
00176
00177 switch (target){
00178 case 0:
00179 {
00180 shape_Sq(type, 0.0, 0.0, 1.0, 2.0/(4.0*4.0));
00181 }break;
00182 case 1:
00183 {
00184 shape_New(type, 0.0, 0.0, 1.0, 2.0/(4.0*4.0));
00185 }break;
00186 case 2:
00187 {
00188 shape_L(type, 0.0, 0.0, 1.0, 2.0/(4.0*4.0));
00189 }break;
00190 }
00191
00192 glPopMatrix();
00193 }
00194
00195 void Display_TargetCon(int BO, int target,int type)
00196 {
00197 glPushMatrix();
00198
00199 if(BO == 0){
00200 switch (target){
00201 case 0:
00202 {
00203 blue_Sq(type, 0.0, 0.0, 1.0, 2.0/(4.0*4.0));
00204 }break;
00205 case 1:
00206 {
00207 blue_New(type, 0.0, 0.0, 1.0, 2.0/(4.0*4.0));
00208 }break;
00209 default:
00210 {
00211 blue_L(type, 0.0, 0.0, 1.0, 2.0/(4.0*4.0));
00212 }break;
00213 }
00214 }else {
00215 switch (target){
00216 case 0:
00217 {
00218 red_Sq(type, 0.0, 0.0, 1.0, 2.0/(4.0*4.0));
00219 }break;
00220 case 1:
00221 {
00222 red_New(type, 0.0, 0.0, 1.0, 2.0/(4.0*4.0));
00223 }break;
00224 default:
00225 {
00226 red_L(type, 0.0, 0.0, 1.0, 2.0/(4.0*4.0));
00227 }break;
00228 }
00229 }
00230
00231 glPopMatrix();
00232 }
00233
00234 void Display_Blank(void)
00235 {
00236 glPushMatrix();
00237
00238 glPopMatrix();
00239 }
00240
00241 void Display_Con_L(int target_BO, int target_Shape,int target_stim,int target_type,int target_location,
00242 int stimuli[], int array[], int place[][16], int trial, float hor[],float ver[],float color[])
00243
00244 {
00245 time_t timer;
00246 struct tm *t_st;
00247 int x;
00248 float noise_x,noise_y;
00249 int wait,anti_BO;
00250 int dist_location,dist_stim,dist_stim1,dist_stim2,dist_stim3;
00251
00252 dist_stim1 = 0;dist_stim2 = 0;dist_stim3 = 0;
00253
00254 time(&timer);
00255 t_st = localtime(&timer);
00256
00257 if(target_BO == 0)anti_BO = 1;
00258 else anti_BO = 0;
00259
00260
00261 glClearColor(BGC, BGC, BGC, 0);
00262 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
00263 Display_TargetCon(target_BO,target_Shape,target_dir);
00264 SDL_GL_SwapBuffers();
00265
00266
00267 for(wait = 0 ; wait < 5 ; wait++){
00268 glClearColor(BGC, BGC, BGC, 0);
00269 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
00270 Display_TargetCon(target_BO,target_Shape,target_dir);
00271 SDL_GL_SwapBuffers();
00272 msleep(H_SLEEP);
00273 glClearColor(BGC, BGC, BGC, 0);
00274 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
00275 Display_Blank();
00276 SDL_GL_SwapBuffers();
00277 msleep(H_SLEEP);
00278 }
00279
00280
00281 noise_x = ((t_st->tm_sec+rand())%11-5.0)/100.0;
00282 noise_y = ((t_st->tm_sec+rand())%11-5.0)/100.0;
00283
00284 glClearColor(BGC, BGC, BGC, 0);
00285 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
00286 SelectStimuli(target_stim,color[target_location],hor[target_location]+noise_x,ver[target_location]+noise_y,2.0/(4.0*4.0));
00287
00288 switch (target_stim){
00289 case (8):
00290 {
00291 dist_stim1 = 1;
00292 dist_stim2 = 5;
00293 dist_stim3 = 10;
00294 }break;
00295 case (9):
00296 {
00297 dist_stim1 = 0;
00298 dist_stim2 = 4;
00299 dist_stim3 = 11;
00300 }break;
00301
00302 case (10):
00303 {
00304 dist_stim1 = 3;
00305 dist_stim2 = 7;
00306 dist_stim3 = 8;
00307 }break;
00308 case (11):
00309 {
00310 dist_stim1 = 2;
00311 dist_stim2 = 6;
00312 dist_stim3 = 9;
00313 }break;
00314 }
00315
00316 for(x=0;x<4;x++){
00317 for(;;){
00318 dist_location = (t_st->tm_sec+rand())%16;
00319 if(array[dist_location]==0){
00320 noise_x = ((t_st->tm_sec+rand())%11-5.0)/100.0;
00321 noise_y = ((t_st->tm_sec+rand())%11-5.0)/100.0;
00322 SelectStimuli(dist_stim1,color[dist_location],hor[dist_location]+noise_x,ver[dist_location]+noise_y,2.0/(4.0*4.0));
00323 array[dist_location]=2;
00324 place[trial][dist_location]=dist_stim1;
00325 break;
00326 }
00327 }
00328 }
00329
00330 for(x=0;x<2;x++){
00331 for(;;){
00332 dist_location = (t_st->tm_sec+rand())%16;
00333 if(array[dist_location]==0){
00334 noise_x = ((t_st->tm_sec+rand())%11-5.0)/100.0;
00335 noise_y = ((t_st->tm_sec+rand())%11-5.0)/100.0;
00336 SelectStimuli(dist_stim2,color[dist_location],hor[dist_location]+noise_x,ver[dist_location]+noise_y,2.0/(4.0*4.0));
00337 array[dist_location]=2;
00338 place[trial][dist_location]=dist_stim2;
00339 break;
00340 }
00341 }
00342 }
00343
00344 for(x=0;x<2;x++){
00345 for(;;){
00346 dist_location = (t_st->tm_sec+rand())%16;
00347 dist_stim = ((t_st->tm_sec+rand())%4)+4;
00348
00349 if(array[dist_location]==0 && stimuli[dist_stim]==0 && dist_stim%2 == target_BO){
00350 noise_x = (((t_st->tm_sec+rand())%11)-5.0)/100.0;
00351 noise_y = (((t_st->tm_sec+rand())%11)-5.0)/100.0;
00352 SelectStimuli(dist_stim,color[dist_location],hor[dist_location]+noise_x,ver[dist_location]+noise_y,2.0/(4.0*4.0));
00353 array[dist_location]=2;
00354 place[trial][dist_location]=dist_stim;
00355 break;
00356 }
00357 }
00358 }
00359
00360 for(x=0;x<4;x++){
00361 for(;;){
00362 dist_location = (t_st->tm_sec+rand())%16;
00363 dist_stim = ((t_st->tm_sec+rand())%4)+8;
00364
00365 if(array[dist_location]==0 && stimuli[dist_stim]==0 ){
00366 noise_x = (((t_st->tm_sec+rand())%11)-5.0)/100.0;
00367 noise_y = (((t_st->tm_sec+rand())%11)-5.0)/100.0;
00368 SelectStimuli(dist_stim3,color[dist_location],hor[dist_location]+noise_x,ver[dist_location]+noise_y,2.0/(4.0*4.0));
00369 array[dist_location]=2;
00370 place[trial][dist_location]=dist_stim;
00371 break;
00372 }
00373 }
00374 }
00375
00376 for(x=0;x<3;x++){
00377 for(;;){
00378 dist_location = (t_st->tm_sec+rand())%16;
00379 dist_stim = (t_st->tm_sec+rand())%4;
00380
00381 if(array[dist_location]==0 && stimuli[dist_stim]==0 && dist_stim%2 != target_BO){
00382 noise_x = (((t_st->tm_sec+rand())%11)-5.0)/100.0;
00383 noise_y = (((t_st->tm_sec+rand())%11)-5.0)/100.0;
00384 SelectStimuli(dist_stim,color[dist_location],hor[dist_location]+noise_x,ver[dist_location]+noise_y,2.0/(4.0*4.0));
00385 array[dist_location]=2;
00386 place[trial][dist_location]=dist_stim;
00387 break;
00388 }
00389 }
00390 }
00391
00392 SDL_GL_SwapBuffers();
00393 }
00394
00395 void Display_Con_Sq(int target_BO, int target_Shape,int target_stim,int target_type,int target_location,
00396 int stimuli[], int array[], int place[][16], int trial, float hor[],float ver[],float color[])
00397
00398 {
00399 time_t timer;
00400 struct tm *t_st;
00401 int x;
00402 float noise_x,noise_y;
00403 int wait;
00404 int dist_location,dist_stim,anti_BO;
00405
00406
00407 time(&timer);
00408 t_st = localtime(&timer);
00409
00410 if(target_BO == 0)anti_BO = 1;
00411 else anti_BO = 0;
00412
00413
00414 glClearColor(BGC, BGC, BGC, 0);
00415 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
00416 Display_TargetCon(target_BO,target_Shape,target_type);
00417 SDL_GL_SwapBuffers();
00418
00419
00420
00421 for(wait = 0 ; wait < 5 ; wait++){
00422 glClearColor(BGC, BGC, BGC, 0);
00423 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
00424 Display_TargetCon(target_BO,target_Shape,target_type);
00425 SDL_GL_SwapBuffers();
00426 msleep(H_SLEEP);
00427 glClearColor(BGC, BGC, BGC, 0);
00428 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
00429 Display_Blank();
00430 SDL_GL_SwapBuffers();
00431 msleep(H_SLEEP);
00432 }
00433
00434
00435 noise_x = ((t_st->tm_sec+rand())%11-5.0)/100.0;
00436 noise_y = ((t_st->tm_sec+rand())%11-5.0)/100.0;
00437
00438 glClearColor(BGC, BGC, BGC, 0);
00439 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
00440 SelectStimuli(target_stim,color[target_location],hor[target_location]+noise_x,ver[target_location]+noise_y,2.0/(4.0*4.0));
00441
00442
00443 for(x=0;x<5;x++){
00444 for(;;){
00445 dist_location = (t_st->tm_sec+rand())%16;
00446 dist_stim = (t_st->tm_sec+rand())%4;
00447
00448 if(array[dist_location]==0 && stimuli[dist_stim]==0){
00449 noise_x = (((t_st->tm_sec+rand())%11)-5.0)/100.0;
00450 noise_y = (((t_st->tm_sec+rand())%11)-5.0)/100.0;
00451 SelectStimuli(dist_stim,color[dist_location],hor[dist_location]+noise_x,ver[dist_location]+noise_y,2.0/(4.0*4.0));
00452 array[dist_location]=2;
00453 place[trial][dist_location]=dist_stim;
00454 break;
00455 }
00456 }
00457 }
00458
00459 for(x=0;x<5;x++){
00460 for(;;){
00461 dist_location = (t_st->tm_sec+rand())%16;
00462 dist_stim = ((t_st->tm_sec+rand())%4)+4;
00463
00464 if(array[dist_location]==0 && stimuli[dist_stim]==0){
00465 noise_x = (((t_st->tm_sec+rand())%11)-5.0)/100.0;
00466 noise_y = (((t_st->tm_sec+rand())%11)-5.0)/100.0;
00467 SelectStimuli(dist_stim,color[dist_location],hor[dist_location]+noise_x,ver[dist_location]+noise_y,2.0/(4.0*4.0));
00468 array[dist_location]=2;
00469 place[trial][dist_location]=dist_stim;
00470 break;
00471 }
00472 }
00473 }
00474
00475 for(x=0;x<5;x++){
00476 for(;;){
00477 dist_location = (t_st->tm_sec+rand())%16;
00478 dist_stim = ((t_st->tm_sec+rand())%4)+8;
00479
00480 if(array[dist_location]==0 && stimuli[dist_stim]==0 && dist_stim%2 == target_BO){
00481 noise_x = (((t_st->tm_sec+rand())%11)-5.0)/100.0;
00482 noise_y = (((t_st->tm_sec+rand())%11)-5.0)/100.0;
00483 SelectStimuli(dist_stim,color[dist_location],hor[dist_location]+noise_x,ver[dist_location]+noise_y,2.0/(4.0*4.0));
00484 array[dist_location]=2;
00485 place[trial][dist_location]=dist_stim;
00486 break;
00487 }
00488 }
00489 }
00490
00491
00492 SDL_GL_SwapBuffers();
00493 }
00494
00495 void Display_Con_New(int target_BO, int target_Shape,int target_stim,int target_type,int target_location,
00496 int stimuli[], int array[], int place[][16],int trial,float hor[],float ver[],float color[])
00497
00498 {
00499 time_t timer;
00500 struct tm *t_st;
00501 int x;
00502 float noise_x,noise_y;
00503 int i,wait;
00504 int dist_location,dist_stim1,dist_stim2,anti_BO;
00505
00506 dist_stim1 = 0;dist_stim2 = 0;
00507
00508 time(&timer);
00509 t_st = localtime(&timer);
00510
00511 if(target_BO == 0)anti_BO = 1;
00512 else anti_BO = 0;
00513
00514
00515 glClearColor(BGC, BGC, BGC, 0);
00516 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
00517 Display_TargetCon(target_BO,target_Shape,target_dir);
00518 SDL_GL_SwapBuffers();
00519
00520
00521 for(wait = 0 ; wait < 5 ; wait++){
00522 glClearColor(BGC, BGC, BGC, 0);
00523 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
00524 Display_TargetCon(target_BO,target_Shape,target_dir);
00525 SDL_GL_SwapBuffers();
00526 msleep(H_SLEEP);
00527 glClearColor(BGC, BGC, BGC, 0);
00528 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
00529 Display_Blank();
00530 SDL_GL_SwapBuffers();
00531 msleep(H_SLEEP);
00532 }
00533
00534
00535 noise_x = ((t_st->tm_sec+rand())%11-5.0)/100.0;
00536 noise_y = ((t_st->tm_sec+rand())%11-5.0)/100.0;
00537 glClearColor(BGC, BGC, BGC, 0);
00538 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
00539 SelectStimuli(target_stim,color[target_location],hor[target_location]+noise_x,ver[target_location]+noise_y,2.0/(4.0*4.0));
00540
00541
00542 switch (target_stim){
00543 case (4):
00544 {
00545 dist_stim1 = 9;
00546 }break;
00547 case (5):
00548 {
00549 dist_stim1 = 8;
00550 }break;
00551 case (6):
00552 {
00553 dist_stim1 = 11;
00554 }break;
00555 case (7):
00556 {
00557 dist_stim1 = 10;
00558 }break;
00559 }
00560
00561 for(i = 0 ;i < 4; i++){
00562 for(;;){
00563 dist_location = (t_st->tm_sec+rand())%16;
00564 if(array[dist_location]==0){
00565 noise_x = (((t_st->tm_sec+rand())%11)-5.0)/100.0;
00566 noise_y = (((t_st->tm_sec+rand())%11)-5.0)/100.0;
00567 SelectStimuli(dist_stim1,color[dist_location],hor[dist_location]+noise_x,ver[dist_location]+noise_y,2.0/(4.0*4.0));
00568 array[dist_location]=2;
00569 place[trial][dist_location]=dist_stim1;
00570 break;
00571 }
00572 }
00573 }
00574
00575 for(x=0;x<4;x++){
00576 for(;;){
00577 dist_location = (t_st->tm_sec+rand())%16;
00578 dist_stim2 = 4+(t_st->tm_sec+rand())%4;
00579
00580 if(array[dist_location]==0 && stimuli[dist_stim2]==0 && dist_stim2%2 != target_BO){
00581 noise_x = (((t_st->tm_sec+rand())%11)-5.0)/100.0;
00582 noise_y = (((t_st->tm_sec+rand())%11)-5.0)/100.0;
00583 SelectStimuli(dist_stim2,color[dist_location],hor[dist_location]+noise_x,ver[dist_location]+noise_y,2.0/(4.0*4.0));
00584 array[dist_location]=2;
00585 place[trial][dist_location]=dist_stim2;
00586 break;
00587 }
00588 }
00589 }
00590
00591 for(x=0;x<3;x++){
00592 for(;;){
00593 dist_location = (t_st->tm_sec+rand())%16;
00594 dist_stim2 = 8+(t_st->tm_sec+rand())%4;
00595
00596 if(array[dist_location]==0 && stimuli[dist_stim2]==0 && dist_stim2 != dist_stim1){
00597 noise_x = (((t_st->tm_sec+rand())%11)-5.0)/100.0;
00598 noise_y = (((t_st->tm_sec+rand())%11)-5.0)/100.0;
00599 SelectStimuli(dist_stim2,color[dist_location],hor[dist_location]+noise_x,ver[dist_location]+noise_y,2.0/(4.0*4.0));
00600 array[dist_location]=2;
00601 place[trial][dist_location]=dist_stim2;
00602 break;
00603 }
00604 }
00605 }
00606
00607 for(x=0;x<4;x++){
00608 for(;;){
00609 dist_location = (t_st->tm_sec+rand())%16;
00610 dist_stim2 = (t_st->tm_sec+rand())%4;
00611
00612 if(array[dist_location]==0 && stimuli[dist_stim2]==0 && dist_stim2 != dist_stim1){
00613 noise_x = (((t_st->tm_sec+rand())%11)-5.0)/100.0;
00614 noise_y = (((t_st->tm_sec+rand())%11)-5.0)/100.0;
00615 SelectStimuli(dist_stim2,color[dist_location],hor[dist_location]+noise_x,ver[dist_location]+noise_y,2.0/(4.0*4.0));
00616 array[dist_location]=2;
00617 place[trial][dist_location]=dist_stim2;
00618 break;
00619 }
00620 }
00621 }
00622
00623 SDL_GL_SwapBuffers();
00624 }
00625
00626 void Display_Conjunction(int target_BO, int target_Shape,int target_stim,int target_type,
00627 int target_location, int stimuli[], int array[], int place[][16], int trial,
00628 float hor[],float ver[],float color[])
00629 {
00630 if(target_Shape == 0){
00631 Display_Con_Sq(target_BO, target_Shape,target_stim,target_type,target_location,stimuli,
00632 array,place,trial,hor,ver,color);
00633 }else if(target_Shape == 1){
00634 Display_Con_New(target_BO, target_Shape,target_stim,target_type,target_location,stimuli,
00635 array,place,trial,hor,ver,color);
00636 }else if(target_Shape == 2){
00637 Display_Con_L(target_BO, target_Shape,target_stim,target_type,target_location,stimuli,
00638 array,place,trial,hor,ver,color);
00639 }
00640 }
00641
00642 void Display_Calibration(int state_calib, int calib[9])
00643 {
00644 int i,check;
00645 time_t timer;
00646 struct tm *t_st;
00647
00648 time(&timer);
00649 t_st = localtime(&timer);
00650
00651
00652 if(state_calib == 0 || state_calib == 2){
00653
00654 glClearColor(BGC, BGC, BGC, 0);
00655 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
00656 Display_Fixation();
00657 SDL_GL_SwapBuffers();
00658 }
00659 else if(state_calib == 1){
00660 glClearColor(BGC, BGC, BGC, 0);
00661 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
00662
00663 Display_Fixation();
00664 SDL_GL_SwapBuffers();
00665 msleep(F_SLEEP);
00666 glClearColor(BGC, BGC, BGC, 0);
00667 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
00668 Display_CalibPoints();
00669 SDL_GL_SwapBuffers();
00670 }else if(state_calib >= 3 && state_calib <= 11){
00671 for(;;){
00672 check = ((t_st->tm_sec+rand())%9);
00673 if(calib[check]==0){
00674 calib[check]=1;
00675 break;
00676 }
00677 }
00678
00679 for(i=0;i<5;i++){
00680 msleep(CALIB);
00681 glClearColor(BGC, BGC, BGC, 0);
00682 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
00683 Display_Blank();
00684 SDL_GL_SwapBuffers();
00685 msleep(CALIB);
00686 glClearColor(BGC, BGC, BGC, 0);
00687 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
00688 Display_Fixation();
00689 SDL_GL_SwapBuffers();
00690 }
00691
00692 switch (check){
00693 case 0:{
00694 for(i=0;i<5;i++){
00695
00696 glClearColor(BGC, BGC, BGC, 0);
00697 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
00698
00699 Display_Calib1();
00700 SDL_GL_SwapBuffers();
00701 msleep(CALIB);
00702 glClearColor(BGC, BGC, BGC, 0);
00703 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
00704 Display_Blank();
00705
00706 SDL_GL_SwapBuffers();
00707 msleep(CALIB);
00708 }
00709 break;
00710 }
00711 case 1:{
00712 for(i=0;i<5;i++){
00713
00714 glClearColor(BGC, BGC, BGC, 0);
00715 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
00716 Display_Calib2();
00717
00718 SDL_GL_SwapBuffers();
00719 msleep(CALIB);
00720 glClearColor(BGC, BGC, BGC, 0);
00721 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
00722 Display_Blank();
00723
00724 SDL_GL_SwapBuffers();
00725 msleep(CALIB);
00726 }
00727 break;
00728 }
00729 case 2:{
00730 for(i=0;i<5;i++){
00731
00732 glClearColor(BGC, BGC, BGC, 0);
00733 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
00734 Display_Calib3();
00735
00736 SDL_GL_SwapBuffers();
00737 msleep(CALIB);
00738 glClearColor(BGC, BGC, BGC, 0);
00739 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
00740 Display_Blank();
00741
00742 SDL_GL_SwapBuffers();
00743 msleep(CALIB);
00744 }
00745 break;
00746 }
00747 case 3:{
00748 for(i=0;i<5;i++){
00749
00750 glClearColor(BGC, BGC, BGC, 0);
00751 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
00752 Display_Calib4();
00753
00754 SDL_GL_SwapBuffers();
00755 msleep(CALIB);
00756 glClearColor(BGC, BGC, BGC, 0);
00757 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
00758 Display_Blank();
00759
00760 SDL_GL_SwapBuffers();
00761 msleep(CALIB);
00762 }
00763 break;
00764 }
00765 case 4:{
00766 for(i=0;i<5;i++){
00767
00768 glClearColor(BGC, BGC, BGC, 0);
00769 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
00770 Display_Calib5();
00771
00772 SDL_GL_SwapBuffers();
00773 msleep(CALIB);
00774 glClearColor(BGC, BGC, BGC, 0);
00775 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
00776 Display_Blank();
00777
00778 SDL_GL_SwapBuffers();
00779 msleep(CALIB);
00780 }
00781 break;
00782 }
00783 case 5:{
00784 for(i=0;i<5;i++){
00785
00786 glClearColor(BGC, BGC, BGC, 0);
00787 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
00788 Display_Calib6();
00789
00790 SDL_GL_SwapBuffers();
00791 msleep(CALIB);
00792 glClearColor(BGC, BGC, BGC, 0);
00793 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
00794 Display_Blank();
00795
00796 SDL_GL_SwapBuffers();
00797 msleep(CALIB);
00798 }
00799 break;
00800 }
00801 case 6:{
00802 for(i=0;i<5;i++){
00803
00804 glClearColor(BGC, BGC, BGC, 0);
00805 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
00806 Display_Calib7();
00807
00808 SDL_GL_SwapBuffers();
00809 msleep(CALIB);
00810 glClearColor(BGC, BGC, BGC, 0);
00811 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
00812 Display_Blank();
00813
00814 SDL_GL_SwapBuffers();
00815 msleep(CALIB);
00816 }
00817 break;
00818 }
00819 case 7:{
00820 for(i=0;i<5;i++){
00821
00822 glClearColor(BGC, BGC, BGC, 0);
00823 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
00824 Display_Calib8();
00825
00826 SDL_GL_SwapBuffers();
00827 msleep(CALIB);
00828 glClearColor(BGC, BGC, BGC, 0);
00829 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
00830 Display_Blank();
00831
00832 SDL_GL_SwapBuffers();
00833 msleep(CALIB);
00834 }
00835 break;
00836 }
00837 case 8:{
00838 for(i=0;i<5;i++){
00839
00840 glClearColor(BGC, BGC, BGC, 0);
00841 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
00842 Display_Calib9();
00843
00844 SDL_GL_SwapBuffers();
00845 msleep(CALIB);
00846 glClearColor(BGC, BGC, BGC, 0);
00847 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
00848 Display_Blank();
00849
00850 SDL_GL_SwapBuffers();
00851 msleep(CALIB);
00852 }
00853 break;
00854 }
00855 default:break;
00856 }
00857 glClearColor(BGC, BGC, BGC, 0);
00858 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
00859
00860 Display_Fixation();
00861 SDL_GL_SwapBuffers();
00862 }else if(state_calib == 12){
00863 glClearColor(BGC, BGC, BGC, 0);
00864 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
00865
00866 Display_Fixation();
00867 SDL_GL_SwapBuffers();
00868 msleep(F_SLEEP);
00869 glClearColor(BGC, BGC, BGC, 0);
00870 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
00871 Display_PointsF();
00872 SDL_GL_SwapBuffers();
00873 }
00874 }