Exemple #1
0
void
tesselate_strip_s_fill(GLint top_start, GLint top_end, GLint top_z,
	GLint bottom_start, GLint bottom_end, GLint bottom_z, GLfloat bottom_domain)
{
	GLint top_cnt,bottom_cnt,tri_cnt,k;
	GLint direction;

	top_cnt=top_end-top_start;
	direction= (top_cnt>=0 ? 1: -1);
	bottom_cnt=bottom_end-bottom_start;
	while(top_cnt)
	{
		if(bottom_cnt)
			tri_cnt=top_cnt/bottom_cnt;
		else
			tri_cnt=abs(top_cnt);
		glBegin(GL_TRIANGLE_FAN);
		glEvalCoord2f((GLfloat)bottom_start/bottom_domain,
			(GLfloat)bottom_z/bottom_domain);
		for(k=0;k<=tri_cnt;k++ , top_start+=direction)
			glEvalPoint2(top_start,top_z);
		if(bottom_cnt)
		{
			bottom_start+=direction;
			top_start-=direction;
			glEvalCoord2f((GLfloat)bottom_start/bottom_domain,
				(GLfloat)bottom_z/bottom_domain);
		}
		glEnd();
		top_cnt-=direction*tri_cnt;
		bottom_cnt-=direction;
	}
}
void PainelOpenGL::desenharSuperficieBezier(){

    glColor3f(0.0, 0.0, 0.0);

    GLfloat ctrlpoints[4][4][3] = {
        {{-1.5, -1.5, 4.0}, {-0.5, -1.5, 2.0},
        {0.5, -1.5, -1.0}, {1.5, -1.5, 2.0}},
        {{-1.5, -0.5, 1.0}, {-0.5, -0.5, 3.0},
        {0.5, -0.5, 0.0}, {1.5, -0.5, -1.0}},
        {{-1.5, 0.5, 4.0}, {-0.5, 0.5, 0.0},
        {0.5, 0.5, 3.0}, {1.5, 0.5, 4.0}},
        {{-1.5, 1.5, -2.0}, {-0.5, 1.5, -2.0},
        {0.5, 1.5, 0.0}, {1.5, 1.5, -1.0}}
    };
    glMap2f(GL_MAP2_VERTEX_3, 0, 1, 3, 4, 0, 1, 12, 4, &ctrlpoints[0][0][0]);
    glEnable(GL_MAP2_VERTEX_3);
    glMapGrid2f(20, 0.0, 1.0, 20, 0.0, 1.0);


    for (int j = 0; j <= 8; j++) {

        glBegin(GL_LINE_STRIP);
        for (int i = 0; i <= 30; i++)
            glEvalCoord2f((GLfloat)i/30.0, (GLfloat)j/8.0);
        glEnd();

        glBegin(GL_LINE_STRIP);
        for (int i = 0; i <= 30; i++)
            glEvalCoord2f((GLfloat)j/8.0, (GLfloat)i/30.0);
        glEnd();
    }

}
Exemple #3
0
static void hugsprim_glEvalCoord2f_11(HugsStackPtr hugs_root)
{
    HsFloat arg1;
    HsFloat arg2;
    arg1 = hugs->getFloat();
    arg2 = hugs->getFloat();
    glEvalCoord2f(arg1, arg2);
    
    hugs->returnIO(hugs_root,0);
}
Exemple #4
0
void display(void)
{
  int i, j;
  glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
  glColor3f(1.0, 1.0, 1.0);
  glPushMatrix ();
  glRotatef(85.0, 1.0, 1.0, 1.0);
  for (j = 0; j <= 8; j++) {
    glBegin(GL_LINE_STRIP);
    for (i = 0; i <= 30; i++)
      glEvalCoord2f((GLfloat)i/30.0, (GLfloat)j/8.0);
    glEnd();
    glBegin(GL_LINE_STRIP);
    for (i = 0; i <= 30; i++)
      glEvalCoord2f((GLfloat)j/8.0, (GLfloat)i/30.0);
    glEnd();
  }
  glPopMatrix ();
  glFlush();
}
Exemple #5
0
void _mesa_EvalPoint2( GLint i, GLint j )
{
   GET_CURRENT_CONTEXT( ctx );
   GLfloat du = ((ctx->Eval.MapGrid2u2 - ctx->Eval.MapGrid2u1) / 
		 (GLfloat) ctx->Eval.MapGrid2un);
   GLfloat dv = ((ctx->Eval.MapGrid2v2 - ctx->Eval.MapGrid2v1) / 
		 (GLfloat) ctx->Eval.MapGrid2vn);
   GLfloat u = i * du + ctx->Eval.MapGrid2u1;
   GLfloat v = j * dv + ctx->Eval.MapGrid2v1;

   glEvalCoord2f( u, v );
}
void BasicObject::bezierSurface()
{
	GLfloat ctrlPts [4][4][3] = {
       { {-1.5, -1.5,  4.0}, {-0.5, -1.5,  2.0}, {-0.5, -1.5, -1.0}, { 1.5, -1.5,  2.0} },
       { {-1.5, -0.5,  1.0}, {-0.5, -0.5,  3.0}, { 0.5, -0.5,  0.0}, { 1.5, -0.5, -1.0} },
       { {-1.5,  0.5,  4.0}, {-0.5,  0.5,  0.0},  { 0.5,  0.5,  3.0}, { 1.5,  0.5,  4.0} },
       { {-1.5,  1.5, -2.0}, {-0.5,  1.5, -2.0}, { 0.5,  1.5,  0.0}, { 1.5,  1.5, -1.0} }
    };
    glPushMatrix();    
	glRotatef(35.0, 1.0, 1.0, 1.0);
	glTranslatef(0,40,0);
    glScalef(10,10,10);	
	glMap2f (GL_MAP2_VERTEX_3, 0.0, 1.0, 3, 4,
                     0.0, 1.0, 12, 4, &ctrlPts[0][0][0]);
    glEnable (GL_MAP2_VERTEX_3);
    GLint k, j;

    glColor3f (0.0, 1.0, 1.0);
    for (k = 0; k <= 8; k++)
    {
        glBegin (GL_LINE_STRIP);  
            for (j = 0; j <= 40; j++)
            glEvalCoord2f (GLfloat (j) / 40.0, GLfloat (k) / 8.0);
        glEnd ( );
        glBegin (GL_LINE_STRIP);
          for (j = 0; j <= 40; j++)
            glEvalCoord2f (GLfloat (k) / 8.0, GLfloat (j) / 40.0);
        glEnd ( );
    }

    glColor3f (1.0, 0.0, 0.0);             
    glPointSize (5.0);                   
    glBegin (GL_POINTS);                 
      for (k = 0; k < 4; k++)
      for (j = 0; j < 4; j++)
        glVertex3fv (&ctrlPts [k][j][0]);
    glEnd ();
    glPopMatrix();    
}
Exemple #7
0
void
tesselate_bottom_left_corner(GLenum display_mode, GLfloat s_1, GLfloat t_1)
{
	if(display_mode==GL_FILL)
	{
		glBegin(GL_TRIANGLE_FAN);
		glEvalPoint2(1,1);
		glEvalCoord2f(s_1,0.0);
		glEvalCoord2f(0.0,0.0);
		glEvalCoord2f(0.0,t_1);
	}
	else
	{
		glBegin(GL_LINES);
		glEvalCoord2f(0.0,0.0);
		glEvalCoord2f(0.0,t_1);
		glEvalCoord2f(0.0,0.0);
		glEvalPoint2(1,1);
		glEvalCoord2f(0.0,0.0);
		glEvalCoord2f(s_1,0.0);
	}
	glEnd();
}
Exemple #8
0
void
tesselate_top_right_corner(GLenum display_mode, GLint u_left, GLint v_bottom,
	GLint u_right, GLint v_top, GLfloat s_1, GLfloat t_1)
{
	if(display_mode==GL_FILL)
	{
		glBegin(GL_TRIANGLE_FAN);
		glEvalPoint2(u_left,v_bottom);
		glEvalCoord2f((u_right-1)*s_1,v_top*t_1);
		glEvalCoord2f(u_right*s_1,v_top*t_1);
		glEvalCoord2f(u_right*s_1,(v_top-1)*t_1);
	}
	else
	{
		glBegin(GL_LINES);
		glEvalCoord2f(u_right*s_1,v_top*t_1);
		glEvalPoint2(u_left,v_bottom);
		glEvalCoord2f(u_right*s_1,v_top*t_1);
		glEvalCoord2f(u_right*s_1,(v_top-1)*t_1);
		glEvalCoord2f(u_right*s_1,v_top*t_1);
		glEvalCoord2f((u_right-1)*s_1,v_top*t_1);
	}
	glEnd();
}
Exemple #9
0
void
tesselate_top_left_corner(GLenum display_mode, GLint u_right, GLint u_left,
	GLfloat s_1, GLfloat t_1)
{
	if(display_mode==GL_FILL)
	{
		glBegin(GL_TRIANGLE_FAN);
		glEvalPoint2(u_right,1);
		glEvalCoord2f((u_left+1)*s_1,t_1);
		glEvalCoord2f((u_left+1)*s_1,0.0);
		glEvalCoord2f(u_left*s_1,0.0);
	}
	else
	{
		glBegin(GL_LINES);
		glEvalCoord2f((u_left+1)*s_1,0.0);
		glEvalPoint2(u_right,1);
		glEvalCoord2f((u_left+1)*s_1,0.0);
		glEvalCoord2f(u_left*s_1,0.0);
		glEvalCoord2f((u_left+1)*s_1,0.0);
		glEvalCoord2f((u_left+1)*s_1,t_1);
	}
	glEnd();
}
Exemple #10
0
void
tesselate_bottom_right_corner(GLenum display_mode, GLint v_top,GLint v_bottom,
	GLfloat s_1, GLfloat t_1)
{
	if(display_mode==GL_FILL)
	{
		glBegin(GL_TRIANGLE_FAN);
		glEvalPoint2(1,v_top);
		glEvalCoord2f(0.0,v_bottom*t_1);
		glEvalCoord2f(0.0,(v_bottom+1)*t_1);
		glEvalCoord2f(s_1,(v_bottom+1)*t_1);
	}
	else
	{
		glBegin(GL_LINES);
		glEvalCoord2f(0.0,(v_bottom+1)*t_1);
		glEvalPoint2(1,v_top);
		glEvalCoord2f(0.0,(v_bottom+1)*t_1);
		glEvalCoord2f(0.0,v_bottom*t_1);
		glEvalCoord2f(0.0,(v_bottom+1)*t_1);
		glEvalCoord2f(s_1,(v_bottom+1)*t_1);
	}
	glEnd();
}
Exemple #11
0
void glEvalCoord2fv(const GLfloat *v) {
    glEvalCoord2f(v[0], v[1]);
}
Exemple #12
0
void glEvalCoord2d(GLdouble u, GLdouble v) {
    glEvalCoord2f(u, v);
}
Exemple #13
0
void _mesa_EvalCoord2fv( const GLfloat *u )
{
   glEvalCoord2f( u[0], u[1] );
}
Exemple #14
0
M(void, glEvalCoord2f, jfloat u, jfloat v) {
	glEvalCoord2f(u, v);
}