Esempio n. 1
0
void
VulcanGun(char solid)
{
  int i;

  glNewList(SOLID_MECH_VULCAN, GL_COMPILE);

#ifdef LIGHT
  SetMaterial(mat_specular2, mat_ambient2, mat_diffuse2, mat_shininess2);
#endif
  glColor3f(0.5, 0.5, 0.5);

  if (!solid) {
    gluQuadricDrawStyle(qobj, GLU_LINE);
  }
  gluCylinder(qobj, 0.5, 0.5, 0.5, 16, 10);
  glTranslatef(0.0, 0.0, 0.5);
  gluDisk(qobj, 0.0, 0.5, 16, 10);

  for (i = 0; i < 5; i++) {
    glRotatef(72.0, 0.0, 0.0, 1.0);
    glTranslatef(0.0, 0.3, 0.0);
    if (!solid) {
      gluQuadricDrawStyle(qobj, GLU_LINE);
    }
    gluCylinder(qobj, 0.15, 0.15, 2.0, 16, 10);
    gluCylinder(qobj, 0.06, 0.06, 2.0, 16, 10);
    glTranslatef(0.0, 0.0, 2.0);
    gluDisk(qobj, 0.1, 0.15, 16, 10);
    gluCylinder(qobj, 0.1, 0.1, 0.1, 16, 5);
    glTranslatef(0.0, 0.0, 0.1);
    gluDisk(qobj, 0.06, 0.1, 16, 5);
    glTranslatef(0.0, -0.3, -2.1);
  }
  glEndList();
}
Esempio n. 2
0
void drawboard(void)
{
  int i, j;
  GLUquadricObj* hole;

  /* Draw the board */
  glColor3f(0.3, 0.3, 1.0);  /* Blue */
  glShadeModel(GL_FLAT);
  glBegin(GL_QUADS);
  for (i=0; i<6; i++) 
    {
      glNormal3fv(&normals[3*i]);
      for (j=0; j<4; j++) 
	glVertex3fv(&vertices[3*faces[i*4 + j]]);
    }
  glEnd();

  /* Draw holes */
  glShadeModel(GL_SMOOTH);
  /*  glColor3f(0.0, 0.0, 0.0); */
  glPushMatrix();
  glTranslatef(-4.0, 0.51, -4.0);
  for (i=0; i<BOARDSIZE; i++)
    {
      glPushMatrix();
      for (j=0; j<BOARDSIZE; j++)
	{
	  if (filled[i][j] == UNUSED)
	    {
	      glTranslatef(1.0, 0.0, 0.0);
	      continue;
	    }
	  glColor3f(0.3, 0.3, 1.0);  /* Blue */
	  glPushMatrix();
	    glRotatef(-90.0, 1.0, 0.0, 0.0);
	    hole = gluNewQuadric();
	    gluQuadricDrawStyle(hole, GLU_FILL);
	    gluQuadricNormals(hole, GLU_SMOOTH);
	    gluCylinder(hole, 0.3, 0.3, 0.5, 8, 1); 
	    gluDeleteQuadric(hole);
	  glPopMatrix();
	  glTranslatef(1.0, 0.0, 0.0);
	}
      glPopMatrix();
      glTranslatef(0.0, 0.0, 1.0);
    }
  glPopMatrix();
}
Esempio n. 3
0
void makeplanets(double red, double green, double blue, double PLANET_INCLINATION, double PLANET_ORBIT, double PLANET_RADIUS, double EARTHRADIUS, double planet_period, float speed, float rotation, float tilt, float EARTH_DEGREES )
{
//	 glEnable(GL_TEXTURE_CUBE_MAP);

	glEnable(GL_TEXTURE_2D);
	GLUquadric *orbit = gluNewQuadric();
	gluQuadricDrawStyle(orbit, GLU_LINE);

	GLUquadric *planet = gluNewQuadric();
	glColor3f(255,255,255);
	//eod * 365 = beta  Earth orbit degree per frame
	glPushMatrix();
	glRotatef(PLANET_INCLINATION,1,0,0);
		glRotatef(90,1,0,0);
		gluDisk(orbit,PLANET_ORBIT*AU,PLANET_ORBIT*AU,30,30);
		glColor3ub(red,green,blue);
	glPopMatrix();
	
	glRotatef(speed*.05,0,1,0);
	//sets the planets inclination relative to the Earth
	glRotatef(PLANET_INCLINATION,0,0,1);

	//****sets the planets rotation****/
	glRotatef(-90,1,0,0);//xaxis
	//translate to position
	
	//rotatez
	
	//sets the planets distatance from the sun relative to the Earth
	glTranslatef(PLANET_ORBIT*AU,0,0);
	glRotatef(tilt,1,0,0);
	glRotatef(rotation,0,0,1);
	
	//Creates planet with Earth Radius
	gltDrawSphere(PLANET_RADIUS*EARTH_RADIUS,30,30);
	
	//glRotatef(rotation,1,0,0);
	//glRotatef((cos (PI/90)),(sin (PI/90)),0,0 );//alpha
	//glRotatef(beta,1,0,0);
	//gluSphere(planet,PLANET_RADIUS*EARTH_RADIUS,30,30);
	
	
	glDisable(GL_TEXTURE_2D);
	//sets the planets inclination relative to the Earth
	//glRotatef(PLANET_INCLINATION,0,0,1);
	
	
}
Esempio n. 4
0
void Cylinder::walk_gl(){
    GLUquadricObj* q = gluNewQuadric();
    gluQuadricNormals(q, GLU_SMOOTH);
    gluQuadricTexture(q, GL_TRUE);
    gluQuadricDrawStyle(q, GLU_FILL);
    gluCylinder(q,1,1,0.3,20,20);

    glTranslatef(0.0, 0.0, 0.2);
    glNormal3f( 0.0f, 1.0f, 0.0f);
    gluDisk(q, 0.0, 1, 20, 1);

    glTranslatef(0.0, 0.0, -0.2);
    gluQuadricOrientation(q, (GLenum)GLU_INSIDE);
    glNormal3f( 0.0f, -1.0f, 0.0f);
    gluDisk(q, 0.0, 1, 20, 1);
}
Esempio n. 5
0
void display(void){
  glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
  
  static GLUquadricObj * q;
  if ( q == 0){
    q = gluNewQuadric();
    gluQuadricDrawStyle(q,/*GLU_LINE*/GLU_FILL);
    
  }	


  e->draw();
  
  glFlush();
  
}
Esempio n. 6
0
void OpenGLRenderInterface::drawEllipsoid(const Eigen::Vector3d& _size) {
    glScaled(_size(0), _size(1), _size(2));

    GLdouble radius = 0.5;
    GLint slices = 16;
    GLint stacks = 16;

    // Code taken from glut/lib/glut_shapes.c
    QUAD_OBJ_INIT;
    gluQuadricDrawStyle(quadObj, GLU_FILL);
    gluQuadricNormals(quadObj, GLU_SMOOTH);
    //gluQuadricTexture(quadObj, GL_TRUE);

    gluSphere(quadObj, radius, slices, stacks);
    //glut/lib/glut_shapes.c
}
Esempio n. 7
0
void Particle::draw(){


  static GLUquadricObj * q;
  if ( q == 0){
    q = gluNewQuadric();
    gluQuadricDrawStyle(q,/*GLU_LINE*/GLU_FILL);
    
  }	
  
  glTranslatef(pos[0],pos[1],pos[2]);
  
  gluSphere(q,radius,16,16); // r, subdiv,subdiv
  glTranslatef(-pos[0],-pos[1],-pos[2]);

}
Esempio n. 8
0
void Sphere::draw(int complexity){
  GLUquadricObj* qobj=gluNewQuadric();
  glCallList(material->handle);
  gluQuadricDrawStyle(qobj,(GLenum)GLU_FILL);
  gluQuadricOrientation(qobj,(GLenum)GLU_OUTSIDE);
  gluQuadricNormals(qobj,(GLenum)GLU_SMOOTH);
  gluQuadricTexture(qobj,(GLenum)GL_TRUE);
  
  glPushMatrix();
  glTranslated(center[0],center[1],center[2]);
  glRotated(90.0,1.0,0.0,0.0);
  gluSphere(qobj,radius,complexity,complexity);
  glPopMatrix();
  
  gluDeleteQuadric(qobj);
}
Esempio n. 9
0
File: balle.cpp Progetto: cocap10/3D
void Balle::draw()
{
    glPushMatrix();
        glTranslatef(x,y,z);
        glEnable(GL_TEXTURE_2D);
        glBindTexture(GL_TEXTURE_2D, GLtexture);
        quadric=gluNewQuadric();
        gluQuadricDrawStyle(quadric, GLU_FILL);
        gluQuadricTexture(quadric,1);
        glScalef(2,2,2);
        gluSphere(quadric,0.5,10,10);
        gluDeleteQuadric(quadric);
        glDisable(GL_TEXTURE_2D);
    glPopMatrix();

}
Esempio n. 10
0
/*******************************************************************
**	円柱描画
*******************************************************************/
void OpenGL::DrawSphere(double radius)
{

	// quadric object を一つ生成する */
    GLUquadricObj *quad = gluNewQuadric();

    // 面の塗り潰しを指定する(線画ではなく陰影をつけた円柱を描く)
    gluQuadricDrawStyle(quad, GLU_FILL);

    // スムースシェーディングを行うよう設定する
    gluQuadricNormals(quad, GLU_SMOOTH);

    // 球面
	gluSphere(quad, (GLdouble)radius, (GLint)16, (GLint)16 );
	return;
}
Esempio n. 11
0
inline void FXGLVertices::render(FXGLViewer *viewer, bool isHit, bool complex){
#ifdef HAVE_GL_H
  bool olddepthtest=!!glIsEnabled(GL_DEPTH_TEST);
  if(options & VERTICES_NODEPTHTEST) glDisable(GL_DEPTH_TEST);
  if(!displayLists) displayLists=glGenLists(3);
  if(modified & (1<<viewer->doesTurbo())){
    //fxmessage("modified=%u\n", modified);
    if(complex){
      // Render a sphere into a display list as it's the same for all points
      GLUquadricObj* quad=0;
      glNewList(displayLists+2, GL_COMPILE);
      quad=gluNewQuadric();
      gluQuadricDrawStyle(quad,(GLenum)GLU_FILL);
      gluSphere(quad,pointSize/2,12,12);
      gluDeleteQuadric(quad);
      glEndList();
      }
    glNewList(displayLists+viewer->doesTurbo(), GL_COMPILE);
    if(vertexNumber){
      if(complex){
        if(options & VERTICES_POINTS)
          renderPoints(viewer, isHit, complex);
        if(options & VERTICES_LINES)
          renderLines(viewer, isHit, complex);
        }
      else{
        if(options & VERTICES_POINTS){
          if(!isHit) glPointSize(pointSize);
          glBegin(GL_POINTS);
          renderPoints(viewer, isHit, complex);
          glEnd();
        }
        if(options & VERTICES_LINES){
          if(!isHit) glLineWidth(lineSize);
          glBegin((options & VERTICES_LOOPLINES) ? GL_LINE_LOOP : (options & VERTICES_LINEITEMS) ? GL_LINES : GL_LINE_STRIP);
          renderLines(viewer, isHit, complex);
          glEnd();
          }
        }
      }
    glEndList();
    modified&=~(1<<viewer->doesTurbo());
    }
  glCallList(displayLists+viewer->doesTurbo());
  if((options & VERTICES_NODEPTHTEST) && olddepthtest) glEnable(GL_DEPTH_TEST);
#endif
  }
Esempio n. 12
0
int GLCreate(HWND handle)
{
 hdc=GetDC(handle);
 PIXELFORMATDESCRIPTOR pfd = {
    	        sizeof(PIXELFORMATDESCRIPTOR),
                1,
                PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER,
                PFD_TYPE_RGBA,
                24,
                0,0,0,0,0,0,
                0,0,
                0,0,0,0,0,
                32,
                0,
                0,
                PFD_MAIN_PLANE,
                0,
                0,0,
 };
 int PixelFormat=ChoosePixelFormat(hdc,&pfd);
 SetPixelFormat(hdc,PixelFormat,&pfd);
 hrc=wglCreateContext(hdc);
 if(hrc==NULL)
  return -1;
 if(!wglMakeCurrent(hdc,hrc))
  return -1;
 glShadeModel( GL_SMOOTH );
 GLfloat amb_light[] = { 6.0, 0.0, 0.1, 1 };
 GLfloat diffuse[] = { 6.6, 0, 0.6, 1 };
 GLfloat specular[] = { 0.7, 0.0, 0.3, 1 };
 glLightModelfv( GL_LIGHT_MODEL_AMBIENT, amb_light );
 glLightfv( GL_LIGHT0, GL_DIFFUSE, diffuse );
 glLightfv( GL_LIGHT0, GL_SPECULAR, specular );
 glEnable( GL_LIGHT0 );
 glClearColor(0.0,0.0,0.0,0.0);
 glEnable(GL_COLOR_MATERIAL);
 glEnable(GL_DEPTH_TEST);
 glEnable(GL_LIGHTING);
 glEnable(GL_LIGHT0);
 glEnable(GL_SCISSOR_TEST);
 float p[4]={10,10,10,0};
 glLightfv(GL_LIGHT0,GL_POSITION,p);
 GLMainObj=gluNewQuadric();
 gluQuadricDrawStyle(GLMainObj,GLU_FILL);
 glRotatef(90,0,1,0);
 return 0;
}
Esempio n. 13
0
static void
realize (GtkWidget *widget,
         gpointer   data)
{
  GdkGLContext *glcontext = gtk_widget_get_gl_context (widget);
  GdkGLDrawable *gldrawable = gtk_widget_get_gl_drawable (widget);

  GLUquadricObj *qobj;
  static GLfloat light_diffuse[] = {1.0, 0.0, 0.0, 1.0};
  static GLfloat light_position[] = {1.0, 1.0, 1.0, 0.0};

  /*** OpenGL BEGIN ***/
  if (!gdk_gl_drawable_gl_begin (gldrawable, glcontext))
    return;

  qobj = gluNewQuadric ();
  gluQuadricDrawStyle (qobj, GLU_FILL);
  glNewList (1, GL_COMPILE);
  gluSphere (qobj, 1.0, 20, 20);
  glEndList ();

  glLightfv (GL_LIGHT0, GL_DIFFUSE, light_diffuse);
  glLightfv (GL_LIGHT0, GL_POSITION, light_position);
  glEnable (GL_LIGHTING);
  glEnable (GL_LIGHT0);
  glEnable (GL_DEPTH_TEST);

  glClearColor (1.0, 1.0, 1.0, 1.0);
  glClearDepth (1.0);

  glViewport (0, 0,
              widget->allocation.width, widget->allocation.height);

  glMatrixMode (GL_PROJECTION);
  glLoadIdentity ();
  gluPerspective (40.0, 1.0, 1.0, 10.0);

  glMatrixMode (GL_MODELVIEW);
  glLoadIdentity ();
  gluLookAt (0.0, 0.0, 3.0,
             0.0, 0.0, 0.0,
             0.0, 1.0, 0.0);
  glTranslatef (0.0, 0.0, -3.0);

  gdk_gl_drawable_gl_end (gldrawable);
  /*** OpenGL END ***/
}
Esempio n. 14
0
void GraphicalNode::create()
{
    GLUquadricObj* sphere;
    mListIndex = glGenLists(1);

    if (mListIndex != 0)
    {
        glNewList(mListIndex,GL_COMPILE);
            sphere = gluNewQuadric();
            gluQuadricDrawStyle(sphere,GLU_TRUE);
            gluQuadricNormals(sphere,GLU_SMOOTH);
            gluSphere(sphere,radius,16,16);
        glEndList();
        // Delete the pointer
        gluDeleteQuadric(sphere);
    }
}
Esempio n. 15
0
void Cylinder::draw()
{
/*	if (strcmp(cullorder,"CW") == 0)
	{
		gluQuadricOrientation(obj, GLU_INSIDE);
	}
	else if (strcmp(cullorder,"CCW") == 0)
	{
		gluQuadricOrientation(obj, GLU_OUTSIDE);
	}*/

	gluQuadricDrawStyle(obj, GLU_FILL);
	gluQuadricTexture(obj, GL_TRUE);
	gluQuadricNormals(obj, GLU_SMOOTH);

	gluCylinder(obj, (double)data[0], (double)data[1], (double)data[2], (int)data[3], (int)data[4]);
}
Esempio n. 16
0
void R3Cone::Draw(void) const
{
    // Draw cone
    glPushMatrix();
    glTranslated(center[0], center[1], center[2]);
    glRotated(-90, 1, 0, 0);
    glTranslated(0, 0, -0.5 * height);
    static GLUquadricObj *glu_cone = gluNewQuadric();
    gluQuadricTexture(glu_cone, GL_TRUE);
    gluQuadricNormals(glu_cone, (GLenum) GLU_SMOOTH);
    gluQuadricDrawStyle(glu_cone, (GLenum) GLU_FILL);
    gluQuadricOrientation(glu_cone, (GLenum) GLU_OUTSIDE);
    gluCylinder(glu_cone, radius, 0, height, 32, 8);
    gluQuadricOrientation(glu_cone, (GLenum) GLU_INSIDE);
    gluDisk(glu_cone, 0, radius, 32, 8);
    glPopMatrix();
}
Esempio n. 17
0
//==============================================================================
void OpenGLRenderInterface::drawCone(double radius, double height)
{
  GLint slices = 16;
  GLint stacks = 16;

  // Graphics assumes Cylinder is centered at CoM
  // gluCylinder places base at z = 0 and top at z = height
  glTranslated(0.0, 0.0, -0.5*height);

  // Code taken from glut/lib/glut_shapes.c
  QUAD_OBJ_INIT;
  gluQuadricDrawStyle(quadObj, GLU_FILL);
  gluQuadricNormals(quadObj, GLU_SMOOTH);

  gluCylinder(quadObj, radius, 0.0, height, slices, stacks); //glut/lib/glut_shapes.c
  gluDisk(quadObj, 0, radius, slices, stacks);
}
Esempio n. 18
0
static void
SetupColourPreview(void)
{
    InitGL(0);
    glClearColor(0.f, 0.f, 0.f, 1.f);

    qobj = gluNewQuadric();
    gluQuadricDrawStyle(qobj, GLU_FILL);
    gluQuadricNormals(qobj, GLU_FLAT);

    glViewport(0, 0, PREVIEW_WIDTH, PREVIEW_HEIGHT);
    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    glOrtho(0.0, (double) STRIP_WIDTH, 0.0, (double) STRIP_HEIGHT, (double) -STRIP_HEIGHT, 0.0);
    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();
}
Esempio n. 19
0
	static void drawcylinder(coord a, coord b, double width)
	{
		double matrix[16];
		if (cylqs == NULL)
		{
			cylqs = gluNewQuadric();
			gluQuadricNormals(cylqs, GLU_SMOOTH);
			gluQuadricOrientation(cylqs, GLU_OUTSIDE);
			gluQuadricDrawStyle(cylqs, GLU_FILL);//GLU_SILHOUETTE
		}
		glPushMatrix();
		glTranslated(a[0], a[1], a[2]);
		get_matrix(a, b, matrix);
		glMultMatrixd(matrix);
		gluCylinder(cylqs, width, width, sqrt((b - a) ^ (b - a)), 4, 2);
		glPopMatrix();
	}
Esempio n. 20
0
void SimpleDraw::DrawSpheres( StdVector<Vec3d> & centers, float radius /*= 1.0*/ )
{
	GLUquadricObj *quadObj = gluNewQuadric();

	gluQuadricDrawStyle(quadObj, GLU_FILL);
	gluQuadricNormals(quadObj, GLU_SMOOTH);

	for(int i = 0; i < (int)centers.size(); i++)
	{
		glPushMatrix();
		glTranslatef(centers[i].x(), centers[i].y(), centers[i].z());
		gluSphere(quadObj, radius, 16, 16);
		glPopMatrix();
	}

	gluDeleteQuadric(quadObj);
}
Esempio n. 21
0
 GLWidget::GLWidget(Window *parent)
     : QGLWidget(QGLFormat(QGL::SampleBuffers), parent),
       m_window(parent),
       m_xRot(0), m_yRot(0), m_zRot(0),
       m_xTransl(0), m_yTransl(0), m_zTransl(0),
       m_xCursor(0),  m_yCursor(0), m_zCursor(0)
 {
     m_purple = QColor::fromCmykF(0.39, 0.39, 0.0, 0.0);

     m_gluQuadricParams1 = gluNewQuadric() ;
     gluQuadricDrawStyle( m_gluQuadricParams1, GLU_FILL ) ;

     this->setMouseTracking( true ) ;

     connect( this, SIGNAL(xyzPositionsChanged(double,double,double,double,double,double,double,double,double)),
              m_window, SLOT(setWmTable(double,double,double,double,double,double,double,double,double)) ) ;
 }
Esempio n. 22
0
void drawSphere(double x, double y, double radius, float red, float green, float blue)
{
    float matAmb[4] = {red, green, blue, 1.f};
    float matDiff[4] = {red, green, blue, 1.f};
    float matSpec[4] = {1.f, 1.f, 1.f, 1.f};
    float matShin[1] = {100.f};

    glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, matAmb);
    glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, matDiff);
    glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, matSpec);
    glMaterialfv(GL_FRONT_AND_BACK, GL_SHININESS, matShin);
    glTranslated(x - 0.5, y - 0.5, 0.5);
    GLUquadric *quad = gluNewQuadric();
    gluQuadricDrawStyle(quad, GLU_FILL);
    gluSphere(quad, radius, 20, 20);
    gluDeleteQuadric(quad);
}
Esempio n. 23
0
void DrawSphere()
{
    glBindTexture(GL_TEXTURE_2D,texture4);
 
    GLUquadric* params = gluNewQuadric();
 
//     gluQuadricDrawStyle(params,GLU_LINE);
//     gluCylinder(params,1,1,2,20,1);
 
    gluQuadricDrawStyle(params,GLU_FILL);
    gluQuadricTexture(params,GL_TRUE);
    glTranslated(0,0,2);
    gluSphere(params,0.75,20,20);
 
    gluDeleteQuadric(params);
    
}
Esempio n. 24
0
void SceneGraph::drawSphere(float radius, int slices, int stacks, double x, double y, double z){
	GLUquadricObj *quadObj;
	quadObj = gluNewQuadric();
	//assert(quadObj);
	
	//gluQuadricDrawStyle(quadObj, GLU_FILL);
	//gluQuadricNormals(quadObj, GLU_SMOOTH);
	
	gluQuadricDrawStyle(quadObj, GLU_LINE);
	//gluQuadricNormals(quadObj, GLU_SMOOTH);

	glTranslatef(.05f,0.1f,z);
	gluSphere(quadObj, radius, slices, stacks);

	

}
Esempio n. 25
0
// un cylindre
void Faire_Composantes() {
    GLUquadricObj* GLAPIENTRY qobj;

    // attribution des indentificateurs de display lists
    Ma_Tete =  glGenLists(6);
    Mon_Tronc = Ma_Tete + 1;
    Mon_Bras = Ma_Tete + 2;
    Mon_AvantBras = Ma_Tete + 3;
    Ma_Cuisse = Ma_Tete + 4;
    Mon_Mollet = Ma_Tete + 5;

    // compilation de la display list de la sph�re
    glNewList(Ma_Tete, GL_COMPILE);
    glutSolidSphere(1.5,8,8);
    glEndList();

    // allocation d�une description de quadrique
    qobj = gluNewQuadric();
    // la quadrique est pleine
    gluQuadricDrawStyle(qobj, GLU_FILL);
    // les ombrages, s�il y en a, sont doux
    gluQuadricNormals(qobj, GLU_SMOOTH);

    // compilation des display lists des cylindres
    glNewList(Mon_Tronc, GL_COMPILE);
    gluCylinder(qobj,2.5,2.5,7.0,100,100);
    glEndList();

    glNewList(Mon_Bras, GL_COMPILE);
    gluCylinder(qobj,0.5,0.5,5.0,100,100);
    glEndList();

    glNewList(Mon_AvantBras, GL_COMPILE);
    gluCylinder(qobj,0.5,0.25,5.0,100,100);
    glEndList();

    glNewList(Ma_Cuisse, GL_COMPILE);
    gluCylinder(qobj,1.25,0.75,5.0,100,100);
    glEndList();

    glNewList(Mon_Mollet, GL_COMPILE);
    gluCylinder(qobj,0.75,0.25,5.0,100,100);
    glEndList();

}
Esempio n. 26
0
void moCNote::Draw( float note_delay_x, float w_track, float h_track, float inter_line, moEffectState& state ) {

    glBindTexture( GL_TEXTURE_2D, 0 );
    glColor4f( 0, 0, 0, 1 );
    GLUquadricObj *quadric;
    quadric = gluNewQuadric();
    gluQuadricDrawStyle(quadric, GLU_FILL);

    bool bSostenido = false;
    float dy = ( inter_line / 2.0 ) ;
    float y = 0.0;

    moCHeader::HeaderToY( this, inter_line, y, bSostenido);

    glTranslatef( m_x - ( this->m_tiempo )*( w_track / 2 ) , y , 1.0 );

    if (bSostenido) {
        if (m_pFont) {
            moText sostxt = "#";
            m_pFont->SetForegroundColor( 0.0, 0.0, 0.0 );
            m_pFont->SetSize( dy*2 );
            m_pFont->Draw( - 2*dy , 0-dy/2, sostxt );
        }
    }
    if (m_pFont) {
        m_pFont->SetForegroundColor( 0.0, 0.0, 0.0 );
        m_pFont->SetSize( dy*4 );
    }

    glScalef( 1.0, 0.6, 1.0 );
    glRotatef( 45, 0.0, 0.0, 1.0 );

    int saturation = this->m_velocity;

    float cr,cg,cb;

    HSVtoRGB( saturation*2 , 255, 255, &cr, &cg, &cb);

    glColor4f( cr, cg, cb, 1.0 );

    gluDisk( quadric, 0, inter_line / 2.0, 12, 2 );

    gluDeleteQuadric(quadric);

}
Esempio n. 27
0
inline void FXGLVertices::renderLines(FXGLViewer *viewer, bool isHit, bool complex){
#ifdef HAVE_GL_H
  FXGLColor col(color);
  GLUquadricObj* quad=0;
  if(complex){
    quad=gluNewQuadric();
    gluQuadricDrawStyle(quad,(GLenum)GLU_FILL);
  }
  FXuint inc=(!(options & (SHADING_SMOOTH|SHADING_FLAT)) && viewer->doesTurbo()) ? 4 : 1;
  for(FXuint n=0; n<vertexNumber-complex; n+=inc){
    if(!isHit){
      if(colorGenerator) for(FXuint c=0; c<inc; c++) colorGenerator(col, this, viewer, n, colorGeneratorData);
      if(complex && (options & (SHADING_SMOOTH|SHADING_FLAT))){
        glMaterialfv(GL_FRONT_AND_BACK,GL_DIFFUSE,&col.r);
        }
       else
        glColor4fv(&col.r);
      }
    if(complex){
      FXVec3f vector=vertices[n+1]-vertices[n];
      FXfloat len=vector.length();
      if(!(options & VERTICES_POINTS) || len>=pointSize*0.8f){
        glPushMatrix();
        glTranslatef(vertices[n].x,vertices[n].y,vertices[n].z);
        FXVec3f zaxis(0.0f,0.0f,vector.z<0 ? 1.0f : -1.0f);
        // Cylinder points in Z direction, so we need to rotate so it follows vector
        FXVec3f vectornormal(vecnormalize(vector));
        FXVec3f axis(vectornormal^zaxis);
        FXfloat angle=((FXfloat) RTOD)*asinf(axis.length());
        //FXfloat dotproduct=vectornormal*axis;
        if(vector.z<0) angle+=180;
        glRotatef(angle,axis.x,axis.y,axis.z);
        gluCylinder(quad,lineSize/2,lineSize/2,len,8,8);
        glPopMatrix();
        }
      }
    else{
      glVertex3fv(&vertices[n].x);
      }
    }
  if(complex){
    gluDeleteQuadric(quad);
  }
#endif
  }
Esempio n. 28
0
//////////////////
// OpenGL stuff //
//////////////////
int RayCone::drawOpenGL(int materialIndex)
{
    if (material->index != materialIndex)
        material->drawOpenGL();

    glMatrixMode(GL_MODELVIEW);

    gluCylinder(gluNewQuadric(), radius, 0, height, openGLComplexity, openGLComplexity);
    GLUquadric* q = gluNewQuadric();
    gluQuadricOrientation(q, GLU_INSIDE);
    gluQuadricDrawStyle(q, GLU_FILL);
    gluQuadricNormals(q, GLU_SMOOTH);
    gluDisk(q, 0, radius, openGLComplexity, openGLComplexity);
        
    glFlush();

    return material->index;
}
Esempio n. 29
0
static void
mySphere(float radius, Bool wire)
{
#if 0
	GLUquadricObj *quadObj;

	quadObj = gluNewQuadric();
	gluQuadricDrawStyle(quadObj, (GLenum) GLU_FILL);
	gluSphere(quadObj, radius, 16, 16);
	gluDeleteQuadric(quadObj);
#else
    glPushMatrix();
    glScalef (radius, radius, radius);
    glRotatef (90, 1, 0, 0);
    unit_sphere (16, 16, wire);
    glPopMatrix();
#endif
}
Esempio n. 30
0
/*!
* Render a cylinder with end caps, along the Z axis centered at 0,0,0
*
* Cylinder may be rendered with face culling enabled.
*/
static void
solidCylinder(double r, double h, int slices)
{
  GLUquadricObj *qobj = gluNewQuadric();
  gluQuadricDrawStyle(qobj, GLU_FILL);
  gluQuadricNormals(qobj, GLU_SMOOTH);

  glPushMatrix();
  glTranslated(0., 0., -h/2);
  gluCylinder( qobj, r, r, h, slices, 1 );
  glPushMatrix();
  glRotated(180., 1.,0.,0.);
  gluDisk( qobj, 0., r, slices, 1 );
  glPopMatrix();
  glTranslated(0., 0., h);
  gluDisk( qobj, 0., r, slices, 1 );
  glPopMatrix();
}