Exemplo n.º 1
0
void drawTree(node* treeRoot, int level) {
  int hasBranches = 0;

  drawPoints(treeRoot->nodeBounds, level);
  for(int i = 0; i < 4; i++) {
    if(treeRoot->branches[i]) {
      drawTree(treeRoot->branches[i], level+1);
      hasBranches = 1;
    }
  }

  glPointSize(2.0f);

  if(hasBranches == 0)
    glColor3b(127, 0, 0);
  else
    glColor3b(0, 64, 0);

  if(treeRoot->nodeBody) {
    glBegin(GL_POINTS);
      glVertex2d(treeRoot->nodeBody->xP, treeRoot->nodeBody->yP);
    glEnd();
  }

  glColor3b(127, 127, 127);
}
Exemplo n.º 2
0
    void onDisplay() override
    {
        // paint bg color (in full size)
        glColor3b(r, g, b);
        bgFull.draw();

        // paint inverted color (in 2/3 size)
        glColor3b(100-r, 100-g, 100-b);
        bgSmall.draw();
    }
Exemplo n.º 3
0
void SeaActor::renderSea(int xMin, int xMax, int zMin, int zMax, int inc, bool trick)
{
    int s = 900;

    int vel = 7;
    int zstart = sc->time / vel + zMin; //6 quad/s
    int zend= sc->time / vel + zMax; //6 quad/s
    int ofs = sc->time * s / vel;

    int r = 80;
    int b = 240;
    for(int z = zstart; z < zend; z+=inc)
    {
        glBegin(GL_QUAD_STRIP);
        int old1 = gety(xMin, z);
        int old2 = gety(xMin, z+inc);
        int oldc1 = getc(xMin, z);
        int oldc2 = getc(xMin, z+inc);

        GFX_TEX_COORD = TEXTURE_PACK(inttot16(64*inc), inttot16(0));
        glColor3b(r, oldc1, b);
        glVertex3v16((xMin+0)*s, old1, -(z+0)*s+ofs);
        GFX_TEX_COORD = TEXTURE_PACK(inttot16(64*inc), inttot16(64*inc));
        glColor3b(r, oldc2, b);
        glVertex3v16((xMin+0)*s, old2, -(z+inc)*s+ofs);
        bool tex = false;
        for(int x = xMin; x < xMax; x+=inc)
        {
            int new1 = gety(x+inc, z);
            int new2;

            if(trick && z == zend-1 && (x/inc)%2 == 0)
                new2 = (old2+gety(x+inc*2, z+inc))/2;
            else
                new2 = gety(x+inc, z+inc);
            int newc1 = getc(x+inc, z);
            int newc2 = getc(x+inc, z+inc);

            GFX_TEX_COORD = TEXTURE_PACK(inttot16(64*tex*inc), inttot16(0));
            glColor3b(r, newc1, b);
            glVertex3v16((x+inc)*s, new1, -(z+0)*s+ofs);
            GFX_TEX_COORD = TEXTURE_PACK(inttot16(64*tex*inc), inttot16(64*inc));
            glColor3b(r, newc2, b);
            glVertex3v16((x+inc)*s, new2, -(z+inc)*s+ofs);

            tex = !tex;
            old1 = new1;
            old2 = new2;
            oldc1 = newc1;
            oldc2 = newc2;
        }
        glEnd();
    }

}
Exemplo n.º 4
0
static void		brick_color(char c)
{
	if (c == '1')
		glColor3b(51, 51, 127);
	if (c == '2')
		glColor3b(127, 0, 63);
	if (c == '3')
		glColor3b(127, 51, 51);
	if (c == '4')
		glColor3b(127, 0, 0);
}
Exemplo n.º 5
0
void QSceneDisplay::DrawCoodinates()
{
	glTranslatef(0,0,-6);
	glBegin(GL_LINES);
	glColor3b(0,0,255);
	glVertex3f(0,-5000,0);
	glVertex3f(0,5000,0);
	glColor3b(0,255,0);
	glVertex3f(-5000,0,0);
	glVertex3f(5000,0,0);
	glColor3b(255,0,0);
	glVertex3f(0,0,-5000);
	glVertex3f(0,0,5000);
	glEnd();
}
Exemplo n.º 6
0
void    GLUI_List::draw_text(const char *t, int selected, int x, int y )
{
  int text_x, i, x_pos;
  int box_width;

  GLUI_DRAWINGSENTINAL_IDIOM

  /** Find where to draw the text **/

  text_x = 2 + GLUI_LIST_BOXINNERMARGINX;

  /** Draw selection area dark **/
  if ( enabled && selected ) {
    glColor3f( 0.0f, 0.0f, .6f );
    glBegin( GL_QUADS );
    glVertex2i(text_x, y+5 );    glVertex2i( w-text_x, y+5 );
    glVertex2i(w-text_x, y+19 );    glVertex2i(text_x, y+19 );
    glEnd();
  }
  box_width = get_box_width();   

  if ( !selected || !enabled ) {   /* No current selection */
    x_pos = text_x;                /*  or control disabled */
    if ( enabled )
      glColor3b( 0, 0, 0 );
    else
      glColor3b( 32, 32, 32 );
    
    glRasterPos2i( text_x, y+15);
    i = 0;
    while( t[i] != '\0' && substring_width(t,0,i) < box_width) {
      glutBitmapCharacter( get_font(), t[i] );
      x_pos += char_width( t[i] );
      i++;
    }
  }
  else { /* There is a selection */
    i = 0;
    x_pos = text_x;
    glColor3f( 1., 1., 1. );
    glRasterPos2i( text_x, y+15);
    while( t[i] != '\0' && substring_width(t,0,i) < box_width) {
      glutBitmapCharacter( get_font(), t[i] );
      x_pos += char_width( t[i] );
      i++;
    }
  }
}
Exemplo n.º 7
0
int DrawGLScene()											// Here's Where We Do All The Drawing
{
	glBindTexture(GL_TEXTURE_2D, texture[0]);			// Select Our Texture

	for (loop=0; loop<num; loop++)						// Loop Through All The Stars
	{
		glLoadIdentity();								// Reset The View Before We Draw Each Star
		glTranslatef(0.0f,0.0f,zoom);					// Zoom Into The Screen (Using The Value In 'zoom')
		glRotatef(tilt,1.0f,0.0f,0.0f);					// Tilt The View (Using The Value In 'tilt')
		glRotatef(star[loop].angle,0.0f,1.0f,0.0f);		// Rotate To The Current Stars Angle
		glTranslatef(star[loop].dist,0.0f,0.0f);		// Move Forward On The X Plane
		glRotatef(-star[loop].angle,0.0f,1.0f,0.0f);	// Cancel The Current Stars Angle
		glRotatef(-tilt,1.0f,0.0f,0.0f);				// Cancel The Screen Tilt
		
		if (twinkle)
		{
			glColor3b(star[(num-loop)-1].r,star[(num-loop)-1].g,star[(num-loop)-1].b);  ///different
			glBegin(GL_QUADS);
				glTexCoord2f(0.0f, 0.0f); glVertex3f(-1.0f,-1.0f, 0.0f);
				glTexCoord2f(1.0f, 0.0f); glVertex3f( 1.0f,-1.0f, 0.0f);
				glTexCoord2f(1.0f, 1.0f); glVertex3f( 1.0f, 1.0f, 0.0f);
				glTexCoord2f(0.0f, 1.0f); glVertex3f(-1.0f, 1.0f, 0.0f);
			glEnd();
		}

		glRotatef(spin,0.0f,0.0f,1.0f);
		glColor3b(star[loop].r,star[loop].g,star[loop].b);                            //different
		glBegin(GL_QUADS);
			glTexCoord2f(0.0f, 0.0f); glVertex3f(-1.0f,-1.0f, 0.0f);
			glTexCoord2f(1.0f, 0.0f); glVertex3f( 1.0f,-1.0f, 0.0f);
			glTexCoord2f(1.0f, 1.0f); glVertex3f( 1.0f, 1.0f, 0.0f);
			glTexCoord2f(0.0f, 1.0f); glVertex3f(-1.0f, 1.0f, 0.0f);
		glEnd();

		spin+=0.01f;
		star[loop].angle+=float(loop)/num;
		star[loop].dist-=0.01f;
		if (star[loop].dist<0.0f)
		{
			star[loop].dist+=5.0f;
			star[loop].r=rand()%256;
			star[loop].g=rand()%256;
			star[loop].b=rand()%256;
		}
	}
	return TRUE;															// Keep Going

}
Exemplo n.º 8
0
void TGLWindow::paintGL()
{
//    QPainter painter(this);
//    TWeakPtr <QPainter> painter(new QPainter(this));
//    TWeakPtr
//    QImage img(size(), this->format());
//    painter.begin(&img);
    TPaintParameters pars;
    pars.glwidget = this;
//    pars.painter = &painter;

    makeCurrent();
    glBegin(GL_POLYGON);
    glColor3b(200, 100, 100);
    glVertex2f(11, 11);
    glVertex2f(22, 11);
    glVertex2f(22, 22);
    glVertex2f(11, 22);
    glEnd();
//    pars.rect = rect();
//    painter.setRenderHint(QPainter::Antialiasing);
    world->paint(pars);

    swapBuffers();
//    painter.end();
//    QPainter p2;
//    p2.begin(this);
//    p2.drawImage(img.rect(), img);
//    p2.end();
}
Exemplo n.º 9
0
    void Draw_Image(GLSurface Surface, float x, float y)
    {
        if(full_screen)x += 48;
        glColor3f(1.0f, 1.0f, 1.0f);

        glBindTexture(GL_TEXTURE_2D, Surface.Surface);
        glBegin( GL_QUADS );
            //Bottom-left vertex (corner)
            glColor3b(127,127,127);
            glTexCoord2i( 0, 0 ); //Position on texture to begin interpolation
            glVertex3f( x, y, 0.f ); //Vertex Coords

            //Bottom-right vertex (corner)
            glTexCoord2i( 1, 0 );
            glVertex3f( x+Surface.w, y, 0.f );

            //Top-right vertex (corner)
            glTexCoord2i( 1, 1 );
            glVertex3f( x+Surface.w, y+Surface.h, 0.f );

            //Top-left vertex (corner)
            glTexCoord2i( 0, 1 );
            glVertex3f( x, y+Surface.h, 0.f );
        glEnd();
    }
Exemplo n.º 10
0
void GameController::Draw() 
{
	glColor3b(1,0,0);
	glClear( GL_COLOR_BUFFER_BIT );

    glMatrixMode( GL_PROJECTION );
    glLoadIdentity();
    double w = glutGet( GLUT_WINDOW_WIDTH );
    double h = glutGet( GLUT_WINDOW_HEIGHT );
    glOrtho( 0, w, 0, h, -1, 1);

    glMatrixMode( GL_MODELVIEW );
    glLoadIdentity();

    // important
    glTranslatef( 0.5, 0.5, 0 );

    float offset = 40;
    glColor3ub( 255, 0, 0 );
    glBegin(GL_LINE_LOOP);
    glVertex2f( 0+offset, 0+offset );
    glVertex2f( 0+offset, h-offset );
    glVertex2f( w-offset, h-offset );
    glVertex2f( w-offset, 0+offset );
    glEnd();

    glutSwapBuffers();
}
Exemplo n.º 11
0
void drawPoints(bounds* p_nodeBounds, int level) {
  //glColor3b(colours[level][0], colours[level][1], colours[level][2]);
  //glBegin(GL_QUADS);
  //  glVertex2f(p_nodeBounds->centerX - p_nodeBounds->halfDistance, p_nodeBounds->centerY + p_nodeBounds->halfDistance);
  //  glVertex2f(p_nodeBounds->centerX + p_nodeBounds->halfDistance, p_nodeBounds->centerY + p_nodeBounds->halfDistance);
  //  glVertex2f(p_nodeBounds->centerX + p_nodeBounds->halfDistance, p_nodeBounds->centerY - p_nodeBounds->halfDistance);
  //  glVertex2f(p_nodeBounds->centerX - p_nodeBounds->halfDistance, p_nodeBounds->centerY - p_nodeBounds->halfDistance);
  //glEnd();
  glColor3b(32, 32, 32);
  glBegin(GL_LINE_LOOP);
    glVertex2f(p_nodeBounds->centerX - p_nodeBounds->halfDistance, p_nodeBounds->centerY + p_nodeBounds->halfDistance);
    glVertex2f(p_nodeBounds->centerX + p_nodeBounds->halfDistance, p_nodeBounds->centerY + p_nodeBounds->halfDistance);
    glVertex2f(p_nodeBounds->centerX + p_nodeBounds->halfDistance, p_nodeBounds->centerY - p_nodeBounds->halfDistance);
    glVertex2f(p_nodeBounds->centerX - p_nodeBounds->halfDistance, p_nodeBounds->centerY - p_nodeBounds->halfDistance);
  glEnd();


  /*
  // Render center point
  glPointSize(5.0f);
  glColor3b(0, 0, 127);
  glBegin(GL_POINTS);
    //glVertex2f(p_nodeBounds->centerX, p_nodeBounds->centerY);
  glEnd();
  glColor3b(127, 127, 127);
  */
}
Exemplo n.º 12
0
    void Draw_Image(GLSurface Surface, float x, float y, float dx, float dy, float w, float h)
    {
        if(full_screen)x += 48;
        glColor3f(1.0f, 1.0f, 1.0f);

        glBindTexture(GL_TEXTURE_2D, Surface.Surface);

        glBegin( GL_QUADS );
            //Bottom-left vertex (corner)
            glColor3b(127,127,127);
            glTexCoord2f( dx/Surface.w, dy/Surface.h ); //Position on texture to begin interpolation
            glVertex3f( x, y, 0.f ); //Vertex Coords

            //Bottom-right vertex (corner)
            glTexCoord2f( (dx/Surface.w)+(w/Surface.w), dy/Surface.h );
            glVertex3f( x+w, y, 0.f );

            //Top-right vertex (corner)
            glTexCoord2f( (dx/Surface.w)+(w/Surface.w), (dy/Surface.h)+(h/Surface.h) );
            glVertex3f( x+w, y+h, 0.f );

            //Top-left vertex (corner)
            glTexCoord2f( dx/Surface.w, (dy/Surface.h)+(h/Surface.h) );
            glVertex3f( x, y+h, 0.f );
        glEnd();

    }
Exemplo n.º 13
0
void App_Test::display_Model()
{
//        gluLookAtf32(      this->camera.getPosition()->get_vec_ox(),this->camera.getPosition()->get_vec_oy(),this->camera.getPosition()->get_vec_oz(),
//                           this->camera.getLookAt()->get_vec_ox(),this->camera.getLookAt()->get_vec_oy(),this->camera.getLookAt()->get_vec_oz(),
//                           0,4096,0
//        );
//    glLoadIdentity();
    glEnable(GL_TEXTURE_2D);
    glEnable(GL_ANTIALIAS);
    glEnable(GL_OUTLINE);

    glLight(0, RGB15(31,31,31) , 0, floattov10(-6.0), floattov10(-1.0));

	glSetOutlineColor(0,RGB15(0,0,0));
    glPolyFmt(POLY_ID(0) | POLY_ALPHA(31)|POLY_CULL_NONE | POLY_FORMAT_LIGHT0 | POLY_TOON_HIGHLIGHT);
//    glPolyFmt(POLY_ALPHA(31)|POLY_CULL_NONE | POLY_FORMAT_LIGHT0);
    glColor3b(31,31,31);
    glBindTexture(GL_TEXTURE_2D, this->textureID[0]);

	glTranslatef(0,-6,0);
    glRotatef(90,-1,0,0);
    glRotatef(-90,0,0,1);
	glCallList( (u32 *) this->model_selected);
    glEnd();
}
Exemplo n.º 14
0
void Scene::renderString(const char* str, f32 x, f32 y, int r, int g, int b)
{
    int l = 0;
    while(str[l] != 0) l++;

    x -= (l*25) / 2;

    int i = 0;
    while(str[i] != 0)
    {
        glPolyFmt(POLY_ALPHA(27+rand()%3) | POLY_ID(BG_FX2_POLYID) | POLY_CULL_NONE);
        int rr = r+irand(80);
        if(rr < 0) rr = 0;
        if(rr > 255) rr = 255;
        int gg = g+irand(80);
        if(gg < 0) gg = 0;
        if(gg > 255) gg = 255;
        int bb = b+irand(80);
        if(bb < 0) bb = 0;
        if(bb > 255) bb = 255;

        glColor3b(rr, gg, bb);
        renderChar(str[i], x+frand(1), y+frand(2), 10);
        x += 25;
        i++;
    }
}
Exemplo n.º 15
0
void CharActor::renderUnrotated()
{
    glPolyFmt(POLY_ALPHA(27+rand()%3) | POLY_ID(BG_FX2_POLYID) | POLY_CULL_NONE);
    
    glColor3b(255, 160+irand(80), 0);
    
    renderChar(c, x+frand(1), y+frand(2), size);
}
Exemplo n.º 16
0
void DrawBuffer()
{
	for(int i=0;i<WIDTH;i++)
		for(int j=0;j<HEIGHT;j++)
		{
			glColor3b(buffer[i][j][0],buffer[i][j][1],buffer[i][j][2]);
			glVertex2i(i,j);
		}

}
Exemplo n.º 17
0
void TGLFunWidget::drawPredicate(void)
{
    Float x0 = (maxX + minX)*0.5,
          y0 = (maxY + minY)*0.5,
          z0 = (maxZ + minZ)*0.5;

    glPointSize(4);
    glBegin(GL_POINTS);
    for (unsigned i = 0; i < mesh->getX().size(); i++)
        if (fabsl((*results)[funIndex].getResults(i) > predicate.toFloat()))
        {
            if ((*results)[funIndex].getResults(i) > 0)
                glColor3b(1,0,0);
            else
                glColor3b(0,0,1);
            glVertex3f(cX(i) - x0, (mesh->getY().size()) ? cY(i) - y0 : 0, (mesh->getZ().size()) ? cZ(i) - z0 : 0);
        }
    glEnd();

}
Exemplo n.º 18
0
void drawBackground()//Draws the checker board back drop
{
    bool color = false;
        for (int i = 0; i < 8; i++)
        {

            if (color)
            {
                glColor3b(70, 69, 75);
                color = !color;
            }

            else
            {
                glColor3b(105, 100, 99);
                color = !color;
            }

            for(int j = 0; j<12;j++)
            {
                if (color)
                {
                    glColor3b(70, 69, 75);
                    color = !color;
                }

                else
                {
                    glColor3b(105, 100, 99);
                    color = !color;
                }
                glBegin(GL_TRIANGLE_STRIP);
                glVertex2f(-1+j/6.0,1 - i/4.0);
                glVertex2f(-1+j/6.0,0.75 - i/4.0);
                glVertex2f(-(5.0/6.0)+j/6.0, 1 - i/4.0);
                glVertex2f(-(5.0/6.0)+j/6.0, 0.75 - i/4.0);
                glEnd();
            }

        }
}
Exemplo n.º 19
0
void PointCloudViewer::drawUserSkeltons()
{
    QMapIterator<unsigned int, Skelton> itr(*userSkeltons);

    while(itr.hasNext())
    {
        itr.next();
        QMap<unsigned int, Point3f> skelton(itr.value());
        Point3f p;
        glColor3b(0,0,0);
        glBegin(GL_LINE_LOOP);
        p = skelton.value(XN_SKEL_TORSO);
        glVertex3f(p.x, p.y, p.z);
        p = skelton.value(XN_SKEL_NECK);
        glVertex3f(p.x, p.y, p.z);
        p = skelton.value(XN_SKEL_HEAD);
        glVertex3f(p.x, p.y, p.z);
        glEnd();
        glBegin(GL_LINE_LOOP);
        p = skelton.value(XN_SKEL_LEFT_SHOULDER);
        glVertex3f(p.x, p.y, p.z);
        p = skelton.value(XN_SKEL_LEFT_ELBOW);
        glVertex3f(p.x, p.y, p.z);
        p = skelton.value(XN_SKEL_LEFT_HAND);
        glVertex3f(p.x, p.y, p.z);
        glEnd();
        glBegin(GL_LINE_LOOP);
        p = skelton.value(XN_SKEL_RIGHT_SHOULDER);
        glVertex3f(p.x, p.y, p.z);
        p = skelton.value(XN_SKEL_RIGHT_ELBOW);
        glVertex3f(p.x, p.y, p.z);
        p = skelton.value(XN_SKEL_RIGHT_HAND);
        glVertex3f(p.x, p.y, p.z);
        glEnd();
        glBegin(GL_LINE_LOOP);
        p = skelton.value(XN_SKEL_LEFT_HIP);
        glVertex3f(p.x, p.y, p.z);
        p = skelton.value(XN_SKEL_LEFT_KNEE);
        glVertex3f(p.x, p.y, p.z);
        p = skelton.value(XN_SKEL_LEFT_FOOT);
        glVertex3f(p.x, p.y, p.z);
        glEnd();
        glBegin(GL_LINE_LOOP);
        p = skelton.value(XN_SKEL_RIGHT_HIP);
        glVertex3f(p.x, p.y, p.z);
        p = skelton.value(XN_SKEL_RIGHT_KNEE);
        glVertex3f(p.x, p.y, p.z);
        p = skelton.value(XN_SKEL_RIGHT_FOOT);
        glVertex3f(p.x, p.y, p.z);
        glEnd();

    }
}
Exemplo n.º 20
0
    void Draw_Point(float x, float y, int r, int g, int b)
    {
        if(full_screen)x += 48;
        //if(boundTexture != NULL){
        glBindTexture( GL_TEXTURE_2D, NULL );// boundTexture = NULL; }
        //if(scale == 7.5)x += 48;

        glBegin(GL_POINTS);
            glColor3b(r,g,b);
            glVertex2f( x, y);
        glEnd();
    }
Exemplo n.º 21
0
    void Draw_Line(float x1, float y1, float x2, float y2, int r, int g, int b)
    {
        if(full_screen){x1 += 48;x2 += 48;}
        //if(boundTexture != NULL){
        glBindTexture( GL_TEXTURE_2D, NULL );// boundTexture = NULL; }
        //if(scale == 7.5)x1 += 48;

        glBegin(GL_LINES);
            glColor3b(r,g,b);
            glVertex2f( x1, y1);
            glVertex2f( x2, y2);
        glEnd();
    }
Exemplo n.º 22
0
    void Draw_Circle(float x, float y, float R, int n, int r, int g, int b)
    {
        if(full_screen)x += 48;
        //if(boundTexture != NULL){
        glBindTexture( GL_TEXTURE_2D, NULL ); //boundTexture = NULL; }
        //if(scale == 7.5)x += 48;

        glBegin(GL_LINE_LOOP);
            glColor3b(r,g,b);
        for(float i = 0; i < 2*PI; i+= (2*PI)/n){
            glVertex2f(x+cosf(i)*R, y+sinf(i)*R);
        }
        glEnd();
    }
Exemplo n.º 23
0
/*
 * the display callback function
 */
 void display (void)
 {
	/* clear the screen to the background color */
   glClear( GL_COLOR_BUFFER_BIT );

   for(int i=0; i<hxres; i++){		
    for(int j=0; j<hyres; j++){
			glColor3b(pixels[i][j].rgbtRed/2, pixels[i][j].rgbtGreen/2, pixels[i][j].rgbtBlue/2);		// set drawing color 
			glBegin(GL_POINTS);
      glVertex2i(i, j);
      glEnd();
    }
  }

  glFlush();
}
Exemplo n.º 24
0
void SeaActor::renderPerspective()
{


    glPolyFmt(POLY_ALPHA(20) | POLY_ID(BG_FX1_POLYID) | POLY_CULL_NONE);
    glColor3b(10, 50, 255);

    setTexture(13);

    ydelta = 0;
    renderSea(-6, 6, -10, -5, 1, false);
    renderSea(-10, 10, -5, -2, 1, true);
    renderSea(-18, 18, -2, 5, 2, true);
    renderSea(-20, 22, 6, 12, 4, true);

}
Exemplo n.º 25
0
static void setup()
{
    consoleDemoInit();

    //put 3D on top
    lcdMainOnTop();

    //set mode 0, enable BG0 and set it to 3D
    videoSetMode(MODE_0_3D);

    // initialize gl
    glInit();

    // enable antialiasing
    glEnable(GL_ANTIALIAS);

    // setup the rear plane
    glClearColor(0,0,0,31); // BG must be opaque for AA to work
    glClearPolyID(63); // BG must have a unique polygon ID for AA to work
    glClearDepth(0x7FFF);

    // Set our viewport to be the same size as the screen
    glViewport(0,0,255,191);

    glColor3b(255,255,0);

    glLight(0, RGB15(0,31,0) , 0,               floattov10(-1.0),      0);

    //need to set up some material properties since DS does not have them set by default
    glMaterialf(GL_AMBIENT, RGB15(5,5,5));
    glMaterialf(GL_DIFFUSE, RGB15(15,15,15));
    glMaterialf(GL_SPECULAR, RGB15(8,8,8));
    glMaterialf(GL_EMISSION, RGB15(5,5,5));

    //ds uses a table for shinyness..this generates a half-assed one
    glMaterialShinyness();

    //ds specific, several attributes can be set here   
    glPolyFmt( POLY_ALPHA(31) | POLY_CULL_NONE | POLY_FORMAT_LIGHT0 );

    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    gluPerspective(60, (float)W / H, Znear, Zfar);

    lookAtSelectedModel();
}
void    GLUI_Listbox::draw( int x, int y )
{
  GLUI_DRAWINGSENTINAL_IDIOM
  int name_x;

  /*  draw_active_area();              */

  name_x = MAX(text_x_offset - string_width(this->name) - 3,0);
  draw_name( name_x , 13);
  draw_box_inwards_outline( text_x_offset, w,
			    0, h );

  if ( NOT active ) {
    draw_box( text_x_offset+3, w-2, 2, h-2, 1.0, 1.0, 1.0 );
    if ( NOT enabled )
      glColor3b( 32, 32, 32 );
    else
      glColor3f( 0.0, 0.0, 0.0 );
    glRasterPos2i( text_x_offset+5, 13 );
    draw_string( curr_text );
  }
  else {
    draw_box( text_x_offset+3, w-2, 2, h-2, .0, .0, .6 );
    glColor3f( 1.0, 1.0, 1.0 );
    glRasterPos2i( text_x_offset+5, 13 );
    draw_string( curr_text );
  }


  if ( enabled ) {
    glui->std_bitmaps.
      draw(GLUI_STDBITMAP_LISTBOX_UP,
	   w-glui->std_bitmaps.width(GLUI_STDBITMAP_LISTBOX_UP)-1,
	   2 );
  }
  else {
    glui->std_bitmaps.
      draw(GLUI_STDBITMAP_LISTBOX_UP_DIS,
	   w-glui->std_bitmaps.width(GLUI_STDBITMAP_LISTBOX_UP)-1,
	   2 );
  }
}
Exemplo n.º 27
0
void TFighter::paint(TPaintParameters &p)
{
    float r = 20;
//    makecurrent
    p.glwidget->makeCurrent();
    glBegin(GL_POLYGON);
    glColor3b(200, 100, 100);
    glVertex2f(pos.x() - r, pos.y() - r);
    glVertex2f(pos.x() - r, pos.y() + r);
    glVertex2f(pos.x() + r, pos.y() + r);
    glVertex2f(pos.x() + r, pos.y() - r);
    glEnd();
//    p.painter->save();
//    p.painter->setPen(QPen(Qt::red));
//    p.painter->translate(pos);
//    p.painter->rotate(this->Orientation().getAngle());
//    TPosition center(0, 0);
//    p.painter->drawEllipse(center, r, r);
//    p.painter->drawLine(center, center.movedX(r));
//    p.painter->restore();
}
Exemplo n.º 28
0
/*!
 * \brief draw points cloud
 *
 * Draw 3d+color if pcloud_3d has data (size>0) and
 * draw 2d in red color at heigh=0 if pcloud_2d >0
 */
void FrameGL::drawCloud()
{
    glPointSize(1.0f);
    glBegin(GL_POINTS);
        if(pcloud_3d.size()>0){
            for(int i = 0; i < pcloud_3d.size(); i++){
                glColor3b(pcloud_3d[i].color.rgbRed,pcloud_3d[i].color.rgbGreen,pcloud_3d[i].color.rgbBlue);
                glVertex3s(pcloud_3d[i].x,pcloud_3d[i].y,pcloud_3d[i].z);
            }
        }

        glColor3ub(0,255,0);
        if(pcloud_2d.size()>0){
            for(int i = 0; i < pcloud_2d.size(); i++){
                glVertex3s(pcloud_2d[i].x,0,pcloud_2d[i].z);
            }
        }
    glEnd();
    pcloud_3d.resize(0);
    pcloud_2d.resize(0);
}
Exemplo n.º 29
0
     void Draw_Rect(float x, float y, float w, float h, int r, int g, int b)
     {
        if(full_screen)x += 48;
        //if(boundTexture != NULL){
        glBindTexture( GL_TEXTURE_2D, NULL );// boundTexture = NULL; }
        //if(scale == 7.5)x += 48;

        glBegin(GL_QUADS);
            glColor3b(r,g,b);
            //Bottom-left vertex (corner)
            glVertex3f( x, y, 0.0f ); //Vertex Coords

            //Bottom-right vertex (corner)
            glVertex3f( x+w, y, 0.f );

            //Top-right vertex (corner)
            glVertex3f( x+w, y+h, 0.f );

            //Top-left vertex (corner)
            glVertex3f( x, y+h, 0.f );

        glEnd();
    }
Exemplo n.º 30
0
void Circle::Draw()
{
	glMatrixMode(GL_MODELVIEW);
	glLoadIdentity();
	//glTranslatef(m_iPosX, m_iPosY, 0.f);
	//glScalef(m_iRadius, m_iRadius, m_iRadius);

	glBegin(GL_TRIANGLE_FAN);

	glColor3b(m_cColorR, m_cColorG, m_cColorB);
	//glColor3f(1.f, 1.f, 0.f);

	glVertex2d(m_iPosX, m_iPosY);
	for (int i = 0; i < 99; i++)
	{
		// alpha = 2 * i / 98
		double a = i / 49.f;
		glVertex2d(m_iPosX + m_iRadius * cos(M_PI * a), m_iPosY + m_iRadius * sin(M_PI * a));
	}
//	glVertex2f(0.f, 600.f);
//	glVertex2f(0.f, 0.f);
//	glVertex2f(400.f, 600.f);
	glEnd();
}