Example #1
0
void display() {
  glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
  glMatrixMode(GL_MODELVIEW);

  glLoadIdentity();
  glPushMatrix ();
  glColor3f(1.0, 0.0, 0.0);
  glTranslatef (0, 0, 0);    // Move box down X axis.
  //glScalef (0.2, 0.2, 0.2);
  glRotated(45, 0, 0,1);
  drawFilledCircle (0,0,0.5);
  glPopMatrix ();
  

  // glColor3f(1.0, 0.0, 0.0);
  // glBegin(GL_LINE_LOOP);

  // for (int i=0; i<1000 ; i++)
  //   {
  //     float degInRad = i*DEG2RAD;
  //     glVertex2f(cos(degInRad)*5,sin(degInRad)*5);
  //   }

  // glEnd();
  
  
  // Gllinewidth(2.5);
  // glColor3f(1.0, 0.0, 0.0);
  // glBegin(GL_LINES);
  // glVertex3f(0.0, 0.0, 0.0);
  // glVertex3f(15, 0, 0);
  // glEnd();
  
  glutSwapBuffers();
}
void IKSolver::drawMaxArea()
{
	glPushMatrix();
	glColor4fv(ColorCodes::trackableAreaColor);
	drawFilledCircle(_maxLength);
	glPopMatrix();
}
Example #3
0
void DungeonUtil::drawArc(int x, int y, float radius, float startAngle, float arcAngle, float brushSize, int steps, const SelectiveDungeonTile& tile) {
  for(int i = 0; i < steps; i++) {
    float percent = (float)i / (float)steps;
    v2di_t position = arcLerp(x, y, radius, startAngle, arcAngle, percent);
    drawFilledCircle(position.x, position.y, brushSize, tile);
  }
}
void IKSolver::drawTarget()
{
	glPushMatrix();
	glColor4fv(ColorCodes::targetColor);
	glTranslatef(_userTargetPos.x, _userTargetPos.y, 0.0f);
	drawFilledCircle(20.0f);
	glPopMatrix();
}
Example #5
0
void DungeonUtil::drawSpiral(int x, int y, float brushSize, float startAngle, float rotation, float startRadius, float endRadius, int steps, const SelectiveDungeonTile& tile) {
  float deltaRadius = endRadius - startRadius;
  for(int i = 0; i < steps; i++) {
    float percent = (float)i / (float)steps;
    float currentRadius = startRadius + (percent * deltaRadius);
    v2di_t position = arcLerp(x, y, currentRadius, startAngle, rotation, percent);
    drawFilledCircle(position.x, position.y, brushSize, tile);
  }
}
Example #6
0
void DungeonUtil::drawLine(double x1, double y1, double x2, double y2, float brushSize, int steps, const SelectiveDungeonTile& tile) {
  double x = x1;
  double y = y1;
  double deltaX = (x2 - x1);
  double deltaY = (y2 - y1);

  for(int i = 0; i < steps; i++) {
    double percent = (double)i / (double)(MACRO_MAX(steps - 1, 1));
    drawFilledCircle(round_int(x + (percent * deltaX)), round_int(y + (percent * deltaY)), brushSize, tile);
  }
}
Example #7
0
void RenderArea::paintEvent(QPaintEvent *)
{
    QPainter painter(this);
    QImage transparent(600, 600, QImage::Format_ARGB32_Premultiplied);
    transparent.fill(QColor(0,0,0,0).rgba());

    switch (shape) {
    case RenderArea::Line:
        if (dragging) {
            drawLine(&transparent);
        } else {
            drawLine(&image);
        }
        break;
    case RenderArea::AALine:
        if (dragging) {
            drawAALine(&transparent);
        } else {
            drawAALine(&image);
        }
        break;
    case RenderArea::Circle:
        if (dragging) {
            drawCircle(&transparent);
        } else {
            drawCircle(&image);
        }
        break;
    case RenderArea::FilledCircle:
        if (dragging) {
            drawFilledCircle(&transparent);
        } else {
            drawFilledCircle(&image);
        }
        break;
    }

    painter.drawImage(QPoint(0, 0), image);
    if (dragging)
        painter.drawImage(QPoint(0, 0), transparent);
}
void IKSolver::draw()
{
	
	glColor4fv(ColorCodes::connectorColor);
	drawFilledCircle(30.0f);

	glPushMatrix();

	for (auto i : _vecLinks)
	{
		glRotatef(degree(i->_angle), 0.0f, 0.0f, 1.0f);
		glColor4fv(i->_color);
		drawFilledRectange(15.0f, (i->_length - 7.5f));
		glTranslatef((i->_length - 7.5f), 7.5f, 0.0f);
		glColor4fv(i->_color);
		drawFilledCircle(15.0f);
		glTranslatef(7.5f, -7.5f, 0.0f);
	}

	glPopMatrix();
}
Example #9
0
std::vector<Position>
GLHelper::drawFilledCircleReturnVertices(double width, int steps) {
    drawFilledCircle(width, steps, 0, 360);
    std::vector<Position> result;
    const double inc = 360 / (double)steps;
    // obtain all vertices
    for (int i = 0; i <= steps; ++i) {
        const std::pair<double, double>& vertex = myCircleCoords[angleLookup(i * inc)];
        result.push_back(Position(vertex.first * width, vertex.second * width));
    }
    return result;
}
Example #10
0
void
GLHelper::drawBoxLines(const PositionVector& geom,
                       const std::vector<SUMOReal>& rots,
                       const std::vector<SUMOReal>& lengths,
                       SUMOReal width, int cornerDetail, SUMOReal offset) {
    // draw the lane
    int e = (int) geom.size() - 1;
    for (int i = 0; i < e; i++) {
        drawBoxLine(geom[i], rots[i], lengths[i], width, offset);
    }
    // draw the corner details
    if (cornerDetail > 0) {
        for (int i = 1; i < e; i++) {
            glPushMatrix();
            glTranslated(geom[i].x(), geom[i].y(), 0.1);
            if (rightTurn(rots[i - 1], rots[i])) {
                // inside corner
                drawFilledCircle(MIN2(lengths[i], width - offset), cornerDetail);
            } else {
                // outside corner, make sure to only draw a segment of the circle
                SUMOReal angleBeg = -rots[i - 1];
                SUMOReal angleEnd = 180 - rots[i];
                // avoid drawing more than 360 degrees
                if (angleEnd - angleBeg > 360) {
                    angleBeg += 360;
                }
                if (angleEnd - angleBeg < -360) {
                    angleEnd += 360;
                }
                // for a left tur, draw the right way around
                if (angleEnd > angleBeg) {
                    angleEnd -= 360;
                }
                drawFilledCircle(MIN2(lengths[i], width + offset), cornerDetail, angleBeg, angleEnd);
            }
            glEnd();
            glPopMatrix();
        }
    }
}
Example #11
0
void drawAnglePresets(GLshort percUnitW, GLshort percUnitH)
{
    int i,j;
    GLshort gapW = ((percUnitW*20)-30)/4;
    GLshort gapH = ((percUnitH*20)-30)/4;

    //set angle area box
    uiS.anglesBL[0] = percUnitW*55;
    uiS.anglesBL[1] = percUnitH*60;
    uiS.anglesTR[0] = percUnitW*75;
    uiS.anglesTR[1] = percUnitH*75;

    //draw angle area box
    glBegin(GL_LINE_LOOP);
        glVertex2sv(uiS.anglesBL);
        glVertex2s(uiS.anglesTR[0], uiS.anglesBL[1]);
        glVertex2sv(uiS.anglesTR);
        glVertex2s(uiS.anglesBL[0], uiS.anglesTR[1]);
    glEnd();

    for (i=0; i<3;i++){
        for (j=0;j<3;j++){
            //set angle preset location
            uiS.anglesPS[0][i*3+j] = percUnitW*60+i*gapW; // x
            uiS.anglesPS[1][i*3+j] = percUnitH*63+j*gapH; // y
            // draw radio button for angle preset
            drawHollowCircle(uiS.anglesPS[0][i*3+j], uiS.anglesPS[1][i*3+j], 10);
            if(!tmpState.angleRand){
                if(tmpState.angle == (i*3)+j+1){
                        drawFilledCircle(uiS.anglesPS[0][i*3+j], uiS.anglesPS[1][i*3+j], 8);
                }
            }
            else{
                //if random angle selected draw cross
                drawCheck(uiS.randAng[0], uiS.randAng[1]);
                //also need to draw a cross through the circles box to indicate out of use
                glBegin(GL_LINES);
                    glVertex2sv(uiS.anglesBL);
                    glVertex2sv(uiS.anglesTR);
                glEnd();
                glBegin(GL_LINES);
                    glVertex2s(uiS.anglesTR[0], uiS.anglesBL[1]);
                    glVertex2s(uiS.anglesBL[0], uiS.anglesTR[1]);
                glEnd();
            } // end if
        }// end for
    }// end for
}// end drawPresetAngles
Example #12
0
File: main.cpp Project: ptrsz/graf1
// Rajzolas, ha az alkalmazas ablak ervenytelenne valik, akkor ez a fuggveny hivodik meg
void onDisplay( ) {
    glClearColor(0.0f, 0.0f, 0.0f, 0.0f);		// torlesi szin beallitasa
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // kepernyo torles
    if (contpoints.amount != 0) {
            glColor3f(1.0f, 1.0f, 1.0f);
            for (int i = 0; i < contpoints.amount; i++) {
                drawFilledCircle(contpoints.points[i].x,contpoints.points[i].y,0.04f);
                drawCircle(contpoints.points[i].x,contpoints.points[i].y,0.04f);
                
            }
        drawCatmullRom(contpoints);
    }
   
    glutSwapBuffers();     				// Buffercsere: rajzolas vege
    
}
Example #13
0
void FViewer::drawHurtBox(point centre, int radius, bool isHovered, bool isSelected)
{
	//translate the centre values of the hitbox from the anchor-based coordinates, back to the world coords
	centre.x = centre.x + drawAnchorAt->x;
	centre.y = centre.y + drawAnchorAt->y;

	//set up all the drawing colours
	GLfloat previousColour[4];
	glGetFloatv(GL_CURRENT_COLOR, previousColour);

	pin_ptr<GLfloat> p = &hurbColour[0];//stick a pin ptr in this bad boy, stop him from going anywhere
	GLfloat* glP = p;//a non-moveable pointer to elem 0

	pin_ptr<GLfloat> lineP = &hurbLineColour[0];//stick a pin ptr in this bad boy, stop him from going anywhere
	pin_ptr<GLfloat> hLineP = &hlhbLineColour[0];//create a pin_ptr in the highlight line colour array. If it needs drawing we'll point to this instead of the regular one
	pin_ptr<GLfloat> sLineP = &selecLineColour[0];

	GLfloat* glLineP; //declare it outside the scope of the if statement = lineP;//a non-moveable pointer to elem 0
	if(isHovered)//if this hitbox is hovered
	{
		glLineP = hLineP;//set the line colour to the highlighted version
	} 
	else//if not
	{
		if (isSelected)
		{
			glLineP = sLineP;
		} 
		else
		{
			glLineP = lineP;//the regular line colour
		}

	}
	
	

	glColor4fv(glP);
	drawFilledCircle(centre, radius);
	glColor4fv(glLineP);
	drawCircleOutline(centre, radius);

	glColor4fv(previousColour);

	//delete glP;  NOTE: Pin_ptr objects do not need deleting as they are MANAGED
	//delete glLineP;
}
Example #14
0
void
GLHelper::drawBoxLines(const PositionVector& geom,
                       const std::vector<double>& rots,
                       const std::vector<double>& lengths,
                       const std::vector<RGBColor>& cols,
                       double width, int cornerDetail, double offset) {
    int e = (int) geom.size() - 1;
    for (int i = 0; i < e; i++) {
        setColor(cols[i]);
        drawBoxLine(geom[i], rots[i], lengths[i], width, offset);
    }
    if (cornerDetail > 0) {
        for (int i = 1; i < e; i++) {
            glPushMatrix();
            setColor(cols[i]);
            glTranslated(geom[i].x(), geom[i].y(), 0);
            drawFilledCircle(width, cornerDetail);
            glEnd();
            glPopMatrix();
        }
    }
}
Example #15
0
void
GLHelper::drawBoxLines(const PositionVector& geom,
                       const std::vector<double>& rots,
                       const std::vector<double>& lengths,
                       double width, int cornerDetail, double offset) {
    // draw the lane
    int e = (int) geom.size() - 1;
    for (int i = 0; i < e; i++) {
        drawBoxLine(geom[i], rots[i], lengths[i], width, offset);
    }
    // draw the corner details
    if (cornerDetail > 0) {
        for (int i = 1; i < e; i++) {
            glPushMatrix();
            glTranslated(geom[i].x(), geom[i].y(), 0.1);
            double angleBeg = -rots[i - 1];
            double angleEnd = 180 - rots[i];
            if (rightTurn(rots[i - 1], rots[i])) {
                std::swap(angleBeg, angleEnd);
            }
            // only draw the missing piece
            angleBeg -= 90;
            angleEnd += 90;
            // avoid drawing more than 360 degrees
            if (angleEnd - angleBeg > 360) {
                angleBeg += 360;
            }
            if (angleEnd - angleBeg < -360) {
                angleEnd += 360;
            }
            // draw the right way around
            if (angleEnd > angleBeg) {
                angleEnd -= 360;
            }
            drawFilledCircle(width + offset, cornerDetail, angleBeg, angleEnd);
            glPopMatrix();
        }
    }
}
Example #16
0
void
GLHelper::drawFilledCircle(double width, int steps) {
    drawFilledCircle(width, steps, 0, 360);
}
Example #17
0
void PongBall::draw() {
    setColor(WHITE);
    drawFilledCircle((int)xpos, (int)ypos, radius);
}
Example #18
0
void drawScene(void) {
    clearWindow();          // clear the last scene
    setColor(RED);
    drawFilledCircle(100,100,50);
    glutSwapBuffers();      // double buffering control
}
Example #19
0
void
GLHelper::drawFilledCircle(SUMOReal width, int steps) {
    drawFilledCircle(width, steps, 0, 360);
}
Example #20
0
void DungeonUtil::drawFilledCircle(int x, int y, float radius, const SelectiveDungeonTile& fillTile, const SelectiveDungeonTile& borderTile) {
  // this may be slower than the slowest way to do this
  drawFilledCircle(x, y, radius, fillTile);
  drawCircle(x, y, radius, borderTile);
}