コード例 #1
0
void drawRoad() {
	
	glTexEnvf(GL_TEXTURE_ENV,GL_TEXTURE_ENV_MODE,GL_MODULATE);
	glBindTexture(GL_TEXTURE_2D,roadTexture);
	GLfloat width = 2000, length = 100, height = e[1]-0.4;

	glColor4fv(hexColor(0x00, 0x99, 0x33, 1.0f));

	glBegin(GL_QUADS);
		
		GLfloat a[] = {-width, height, -length};
		GLfloat c[] = {-width, height,  length};
		GLfloat b[] = { width, height,  length};
		GLfloat *v1 = vSubtract(a, c);
		GLfloat *v2 = vSubtract(b, c);
		
		GLfloat *v3 = vToUnitVector(vCrossProduct(v1, v2));
		glNormal3fv(v3);
		//printf("%f %f %f\n", v3[0], v3[1], v3[2]);
		GLdouble nRepeatTexureWidth = width/100;
		GLdouble nRepeatTexureLength = length/100;
		glTexCoord2d(nRepeatTexureWidth,0); 
		glVertex3f(-width, height, -length);
		
		glTexCoord2d(nRepeatTexureWidth,nRepeatTexureLength);
		glVertex3f(-width, height,  length);
		
		glTexCoord2d(0,nRepeatTexureLength);
		glVertex3f( width, height,  length);
		
		glTexCoord2d(0,0);
		glVertex3f( width, height, -length);
	glEnd();

}
コード例 #2
0
void drawSky() {
	GLfloat width = 2000, length = 500, height = 500;
	
	glBegin(GL_QUADS);
		glColor4fv(hexColor(0xCC,0xFF,0xFF,1.0));
	
		glVertex3f( width, 0.0f, length);
		glVertex3f(-width, 0.0f, length);
	
		glColor4fv(hexColor(0x00,0xFF,0xFF,1.0));
	
		glVertex3f(-width, height,  length);
		glVertex3f( width, height,  length);
	
		glColor4fv(hexColor(0xCC,0xFF,0xFF,1.0));
	
		glVertex3f( width, 0.0f, -length);
		glVertex3f(-width, 0.0f, -length);
	
		glColor4fv(hexColor(0x00,0xFF,0xFF,1.0));
	
		glVertex3f(-width, height,  -length);
		glVertex3f( width, height,  -length);
	
		glColor4fv(hexColor(0xCC,0xFF,0xFF,1.0));
	
		glVertex3f( width, 0.0f, length);
		glVertex3f( width, 0.0f, -length);
	
		glColor4fv(hexColor(0x00,0xFF,0xFF,1.0));
	
		glVertex3f( width, height,  -length);
		glVertex3f( width, height,  length);
	
		glColor4fv(hexColor(0xCC,0xFF,0xFF,1.0));
	
		glVertex3f(-width, 0.0f, length);
		glVertex3f(-width, 0.0f, -length);
	
		glColor4fv(hexColor(0x00,0xFF,0xFF,1.0));
	
		glVertex3f(-width, height,  -length);
		glVertex3f(-width, height,  length);
	
		glColor4fv(hexColor(0x00,0xFF,0xFF,1.0));
	
		glVertex3f(-width, height, -length);
		glVertex3f(-width, height,  length);
		glVertex3f( width, height,  length);
		glVertex3f( width, height, -length);
	glEnd();
}
コード例 #3
0
void drawHill() {

	glColor4fv(hexColor(0x45, 0xaa, 0x31, 1.0f));
	glBegin(GL_POLYGON);
		glVertex3f(-100.0f,  0.0f, -10.0f);
		glVertex3f(-0.0f,  0.0f, 20.0f);
		glVertex3f(-30.0f,  10.0f, 60.0f);
		glVertex3f(-65.0f,  20.0f, 55.0f);
		glVertex3f(-100.0f,  30.0f, 10.0f);
	glEnd();
	
	glColor4fv(hexColor(0x40, 0xa0, 0x33, 1.0f));
	glBegin(GL_POLYGON);
		glVertex3f(-0.0f,  0.0f, 20.0f);
		glVertex3f(-30.0f,  10.0f, 60.0f);
		glVertex3f(-30.0f,  10.0f, 100.0f);
		glVertex3f(10.0f,  0.0f, 100.0f);
	glEnd();
	
	glColor4fv(hexColor(0x50, 0xa9, 0x33, 1.0f));
	glBegin(GL_POLYGON);
		glVertex3f(-30.0f,  10.0f, 60.0f);
		glVertex3f(-65.0f,  20.0f, 55.0f);
		glVertex3f(-30.0f,  10.0f, 100.0f);
	glEnd();
	
	glColor4fv(hexColor(0x45, 0xa8, 0x33, 1.0f));
	glBegin(GL_POLYGON);
		glVertex3f(-65.0f,  20.0f, 55.0f);
		glVertex3f(-30.0f,  10.0f, 100.0f);
		glVertex3f(-60.0f,  30.0f, 100.0f);
		glVertex3f(-60.0f,  40.0f, 80.0f);
	glEnd();
	
	glColor4fv(hexColor(0x50, 0xaa, 0x33, 1.0f));
	glBegin(GL_POLYGON);
		glVertex3f(-60.0f,  30.0f, 100.0f);
		glVertex3f(-60.0f,  40.0f, 80.0f);
		glVertex3f(-100.0f,  50.0f, 100.0f);
	glEnd();
	
	glColor4fv(hexColor(0x40, 0xa5, 0x33, 1.0f));
	glBegin(GL_POLYGON);
		glVertex3f(-60.0f,  40.0f, 80.0f);
		glVertex3f(-65.0f,  20.0f, 55.0f);
		glVertex3f(-100.0f,  30.0f, 10.0f);
		glVertex3f(-100.0f,  50.0f, 100.0f);
	glEnd();
}
コード例 #4
0
QString ChartLine::getColor() const
{
    Q_D(const ChartLine);
    return hexColor(d->getColor());
}
コード例 #5
0
QString Marker::getColor() const
{
    Q_D(const Marker);
    return hexColor(d->getColor());
}