[BACK]Return to MyOpenGLView.m CVS log [TXT][DIR] Up to [local] / OpenXM / src / cfep

Diff for /OpenXM/src/cfep/MyOpenGLView.m between version 1.2 and 1.7

version 1.2, 2006/03/07 11:15:23 version 1.7, 2018/10/18 04:59:45
Line 6 
Line 6 
 //  Copyright 2006 OpenXM.org. All rights reserved.  //  Copyright 2006 OpenXM.org. All rights reserved.
 //  //
   
   #import <OpenGL/OpenGL.h>
   #import <OpenGL/gl.h>
   #import <OpenGL/glu.h>
   #import <GLUT/glut.h>
   
 #import "MyOpenGLView.h"  #import "MyOpenGLView.h"
 #import "MyOpenGLController.h"  #import "MyOpenGLController.h"
 #include "mygl.h"  #include "mygl.h"
   
   
   
 @implementation MyOpenGLView  @implementation MyOpenGLView
 -(id) initWithFrame: (NSRect) frame {  -(id) initWithFrame: (NSRect) frame {
   NSLog(@"initWithFrame\n");    NSLog(@"initWithFrame\n");
Line 21 
Line 28 
   yeye = 0.0;    yeye = 0.0;
   zeye = 2.0;    zeye = 2.0;
   initGl = 1;    initGl = 1;
     myfont = [ NSFont systemFontOfSize: 10];
   [super initWithFrame: frame];    [super initWithFrame: frame];
   if (self) {    if (self) {
     NSOpenGLPixelFormatAttribute attributes[]={      NSOpenGLPixelFormatAttribute attributes[]={
Line 81 
Line 88 
   glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
   [self drawOglInitComm];    [self drawOglInitComm];
 }  }
   -(void) setInitGL: (id) sender { initGl = 1; }
 // It was for a test.  // It was for a test.
 -(void) drawRectSimple: (NSRect) rect withColor: (double) c {  -(void) drawRectSimple: (NSRect) rect withColor: (double) c {
   glClearColor(1.0,1.0,1.0,1.0);    glClearColor(1.0,1.0,1.0,1.0);
Line 122 
Line 130 
   
 -(NSMutableArray *)getListOfOglComm { return oglComm; }  -(NSMutableArray *)getListOfOglComm { return oglComm; }
 -(NSMutableArray *)getListOfOglInitComm { return oglInitComm; }  -(NSMutableArray *)getListOfOglInitComm { return oglInitComm; }
   -(int) getOglCommSize { return oglCommSize; }
   -(int) getOglInitCommSize { return oglInitCommSize; }
 -(int) countOfOglComm { return [oglComm count]; }  -(int) countOfOglComm { return [oglComm count]; }
 -(int) countOfOglInitComm { return [oglInitComm count];}  -(int) countOfOglInitComm { return [oglInitComm count];}
 -(int) removeLastOfOglComm { if ([oglComm count]>0) [oglComm removeLastObject]; return [self countOfOglComm];}  -(int) removeLastOfOglComm { if ([oglComm count]>0) [oglComm removeLastObject]; [self updateOglCommSize]; return [self countOfOglComm];}
 -(int) removeLastOfOglInitComm {if ([oglInitComm count]>0) [oglInitComm removeLastObject]; return [self countOfOglInitComm];}  -(int) removeLastOfOglInitComm {if ([oglInitComm count]>0) [oglInitComm removeLastObject]; [self updateOglInitCommSize]; return [self countOfOglInitComm];}
 -(int) removeAllOfOglComm { if ([oglComm count]>0) [oglComm removeAllObjects]; return 0; }  -(int) removeAllOfOglComm { if ([oglComm count]>0) [oglComm removeAllObjects]; oglCommSize = 0; return 0; }
 -(int) removeAllOfOglInitComm {if ([oglInitComm count]>0) [oglInitComm removeAllObjects]; return 0; }  -(int) removeAllOfOglInitComm {if ([oglInitComm count]>0) [oglInitComm removeAllObjects]; oglInitCommSize = 0; return 0; }
   -(void) updateOglCommSize {
     int n,i;
     MyOpenGLCommand *cc;
     n = [oglComm count];
     for (i=n-1; i>=0; i--)  {
       cc = [oglComm objectAtIndex: i];
           if ([cc isEndGroup]) { oglCommSize = i+1; return ; }
     }
     oglCommSize = 0;
   }
   -(void) updateOglInitCommSize {
     int n,i;
     MyOpenGLCommand *cc;
     n = [oglInitComm count];
     for (i=n-1; i>=0; i--)  {
       cc = [oglInitComm objectAtIndex: i];
           if ([cc isEndGroup]) { oglInitCommSize = i+1; return ; }
     }
     oglInitCommSize = 0;
   }
   
 -(void) drawOglInitComm {  -(void) drawOglInitComm {
   int i,n;    int i,n;
Line 166 
Line 196 
   ii = [gc getI4];    ii = [gc getI4];
   x = v[0]; y = v[1]; z = v[2]; c = v[3];    x = v[0]; y = v[1]; z = v[2]; c = v[3];
   p = ii[0]; q=ii[1]; r=ii[2];  s=ii[3];    p = ii[0]; q=ii[1]; r=ii[2];  s=ii[3];
   // NSLog(@"opCode=%d, (x,y,z,c)=(%f,%f,%f,%f), (p,q,r,s)=(%d,%d,%d,%d)\n",op,x,y,z,c,p,q,r,s);  //  NSLog(@"opCode=%d, (x,y,z,c)=(%f,%f,%f,%f), (p,q,r,s)=(%d,%d,%d,%d)\n",op,x,y,z,c,p,q,r,s);
   switch(op) {    switch(op) {
   case CFEPglBegin:    case CFEPglBegin:
     glBegin(p);      glBegin(p);
Line 179 
Line 209 
     glClearDepth(x); break;      glClearDepth(x); break;
   case CFEPglColor4f:    case CFEPglColor4f:
     glColor4f(x,y,z,c); break;      glColor4f(x,y,z,c); break;
     case CFEPglDisable:
       glDisable(p); break;
     case CFEPglEnable:
       glEnable(p); break;
   case CFEPglEnd:    case CFEPglEnd:
     glEnd(); break;      glEnd(); break;
   case CFEPglFlush:    case CFEPglFlush:
     glFlush(); [self setNeedsDisplay: YES]; break;      glFlush(); [self setInitGL: nil]; [self setNeedsDisplay: YES]; break;
     case CFEPglLineStipple:
       glLineStipple(p,q); break;
     case CFEPglLineWidth:
       glLineWidth(x); break;
     case CFEPglNormal3f:
       glNormal3f(x,y,z); break;
   case CFEPglPointSize:    case CFEPglPointSize:
     glPointSize(x); break;      glPointSize(x); break;
   case CFEPglRectf:    case CFEPglRectf:
         glRectf(x,y,z,c); break;          glRectf(x,y,z,c); break;
   case CFEPglVertex3f:    case CFEPglVertex3f:
     glVertex3f(x,y,z); break;      glVertex3f(x,y,z); break;
     case CFEPglVertex2f:
       glVertex2f(x,y); break;
   
   case CFEPglib_line:    case CFEPglib_line:
     glib_line(x,y,z,c,p); break;      glib_line(x,y,z,c,p); break;
   case CFEPglib_putpixel:    case CFEPglib_putpixel:
     glib_putpixel(x,y,p); break;      glib_putpixel(x,y,p); break;
   case CFEPglib_flush:    case CFEPglib_flush:
         [self setNeedsDisplay: YES];          [self setInitGL: nil]; [self setNeedsDisplay: YES];
         // [[MyOpenGLController getOglWindow: gid] showCount];          // [[MyOpenGLController getOglWindow: gid] showCount];
         break;          break;
   
Line 225 
Line 267 
 -(void) glib3_std_scene0 {  -(void) glib3_std_scene0 {
   glib3_std_scene0(xeye,yeye,zeye);    glib3_std_scene0(xeye,yeye,zeye);
 }  }
   -(void) mouseDown: (NSEvent *) theEvent {
     NSLog(@"Mouse is down\n");
   }
 @end  @end
   
 // Original glib functions  // Original glib functions

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.7

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>