void display() { int i; update(); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Clear Screen and Depth Buffer glLoadIdentity(); glTranslatef(0.0f,0.0f,-10.0f); /* * Triangle code starts here * 3 verteces, 3 colors. */ //markAt(points, pointnum); //markAt(moonpoints, moonpnum); glPushMatrix(); glTranslatef(-3, 1, 0); glColor3f(0.9, 0.9, 0.3); drawBezier(moonpoints, moonpnum, moonsmoothness); for(i=0;i<exmoonlinesnum;i++) drawBezier(moonexlines[i], moonpnum, moonsmoothness); glPopMatrix(); glColor3f(0.2, 0.3, 0.6); drawBezier(points, pointnum, beziersmoothness); for(i=0;i<exlinesnum;i++) drawBezier(exlines[i], pointnum, beziersmoothness); glutSwapBuffers(); drawfinish(); }
void GLWidget::clientDraw() { //_subdiv->draw(); getDrawer()->edge(_model); drawBezier(); }
void myMouse(int button, int state, int x, int y) { // If left button was clicked if(button == GLUT_LEFT_BUTTON && state == GLUT_DOWN) { // Store where the user clicked, note Y is backwards. abc[NUMPOINTS].setxy((float)x,(float)(SCREEN_HEIGHT - y)); NUMPOINTS++; // Draw the red dot. drawDot(x, SCREEN_HEIGHT - y); // If 3 points are drawn do the curve. if(NUMPOINTS == 3) { glColor3f(1.0,1.0,1.0); // Draw two legs of the triangle drawLine(abc[0], abc[1]); drawLine(abc[1], abc[2]); point POld = abc[0]; /* Draw each segment of the curve. Make t increment in smaller amounts for a more detailed curve. */ for(double t = 0.0;t <= 1.0; t += 0.1) { point P = drawBezier(abc[0], abc[1], abc[2], t); drawLine(POld, P); POld = P; } glColor3f(1.0,0.0,0.0); NUMPOINTS = 0; } } }
void main() { wait(1); screen_color.blue = 255; BMAP* test = bmap_createblack(658,409,32); bmap_process(test, testRed, _ctaMat); testPan->bmap = test; while(1) { drawBezier(vector(10,10,0),vector(40,10,0),vector(90,50,0),vector(120,50,0)); wait(1); } }
/* first we see if we even need to draw by checking if it is in the camera, via cameraGetLoc() cameraGetLoc() returns a drawable rect (if camera is zoomed it needs to translate) which draw can use. DRAW SHOULD NEVER AFFECT GAME WORLD */ void drawObject(dioneObject *obj) { SDL_Rect drawable; SDL_bool in_camera; in_camera = cameraGetLoc(&(obj->l), &drawable); if (in_camera == SDL_FALSE) { return; } /* drawable is now in pixels not world units. We can just draw it like it is! */ switch (TYPEOF(obj)) { case OBJ_LINE: drawLine((lineObject*)obj, &drawable); break; case OBJ_PEOPLE: drawPerson((humanObject*)obj, &drawable); break; case OBJ_WAVE: drawWave((waveObject*)obj, &drawable); break; case OBJ_CUSTOM: (((customObject*)obj)->drawFunc)(obj); break; case OBJ_POLY: drawPoly((polyObject*)obj, &drawable); break; case OBJ_BEZIER: drawBezier((bezierObject*)obj, &drawable); break; case OBJ_TEXTURE: drawTexture((textureObject*)obj, &drawable); break; case OBJ_TEXT: drawText((textObject*)obj, &drawable); break; default: /* I never want to be here */ print_message(MSG_VERBOSE_ERROR, MSG_FLAG_NONE, "[draw] I have no idea how to handle this obj: %x!", obj); } }
void KivioShapePainter::drawShape( KivioShape *pShape, float x, float y, float w, float h ) { KivioShapeData *pShapeData; m_x = x; m_y = y; m_w = w; m_h = h; m_pShape = pShape; pShapeData = pShape->shapeData(); switch( pShapeData->shapeType() ) { case KivioShapeData::kstArc: drawArc(); break; case KivioShapeData::kstPie: drawPie(); break; case KivioShapeData::kstLineArray: drawLineArray(); break; case KivioShapeData::kstPolyline: drawPolyline(); break; case KivioShapeData::kstPolygon: drawPolygon(); break; case KivioShapeData::kstBezier: drawBezier(); break; case KivioShapeData::kstRectangle: drawRectangle(); break; case KivioShapeData::kstRoundRectangle: drawRoundRectangle(); break; case KivioShapeData::kstEllipse: drawEllipse(); break; case KivioShapeData::kstOpenPath: drawOpenPath(); break; case KivioShapeData::kstClosedPath: drawClosedPath(); break; case KivioShapeData::kstTextBox: drawTextBox(); break; case KivioShapeData::kstNone: default: break; } }
void Terrain::draw(Matrix4 c) { draw_bezier ? drawNormal(c) : drawBezier(c); }