Esempio n. 1
0
/**
 * @name	rgba_init
 * @brief
 * @retval	NONE
 */
void rgba_init() {
	static bool done_rgba_init = false;

	if (!done_rgba_init) {
		done_rgba_init = true;
		int i = 0;

		for (; colors[i].name != NULL; i++) {
			ADD_COLOR(colors[i]);
		}
	}
}
Esempio n. 2
0
File: color.c Progetto: tomtix/uuc
static void clr_init(void)
{
    colors = ht_create(100, NULL);

    ADD_COLOR("RESET", COLOR_RESET);
    ADD_COLOR("red", "\e[91m");
    ADD_COLOR("light blue", "\e[96m");
    ADD_COLOR("fushia", "\e[95m");
    ADD_COLOR("green", "\e[92m");
    ADD_COLOR("yellow", "\e[93m");
    
    COLOR_LEN = strlen(color("green", ""));
}
Esempio n. 3
0
bool CCubeZoom::init()
{ 
	// Setup colors to show for each depth of recursion
	ADD_COLOR(0,	1.0f,	0.6f, 0.6f);
	ADD_COLOR(1,	1.0f,	1.0f, 0.5f);
	ADD_COLOR(2,	0.6f,	1.0f, 0.6f);
	ADD_COLOR(3,	0.3f,	0.4f, 1.0f);
	ADD_COLOR(4,	0.0f,	0.0f, 1.0f);	// ???TBH not used
	ADD_COLOR(5,	0.0f,	0.0f, 1.0f);	// ???TBH not used
	
	// Setup initial lights and positions
	m_ambientLight[0] = 0.2f;
	m_ambientLight[1] = 0.2f;
	m_ambientLight[2] = 0.2f;
	m_ambientLight[3] = 1.0f;

	m_diffuseLight[0] = 0.7f;
	m_diffuseLight[1] = 0.7f;
	m_diffuseLight[2] = 0.7f;
	m_diffuseLight[3] = 1.0f;
	
	m_lightPos[0] = 20.0f;
	m_lightPos[1] = 40.0f;
	m_lightPos[2] = 2.0f;
	m_lightPos[3] = 1.0f;
	

	// Create displays lists for recursion
	m_vCubes.resize(nMAX_CUBE_DEPTH);
	m_glDispStartIndex = glGenLists(nMAX_CUBE_DEPTH);

	// Generate display list
	m_glDispObject = glGenLists(1);

	// Create a new quadric and set our pointer to it
	m_pQuadObject = gluNewQuadric();
	if (m_pQuadObject == 0)
		throw "CCubeZoom.init()\r\nNot enough memory to allocate m_pQuadObject";

	// Set options to how foreground quadric behaves in OpenGL environment
	gluQuadricDrawStyle(		m_pQuadObject, GLU_FILL);
	gluQuadricNormals(		m_pQuadObject, GLU_SMOOTH);
	gluQuadricOrientation(	m_pQuadObject, GLU_OUTSIDE);
	gluQuadricTexture(		m_pQuadObject, GL_TRUE);

	// Load textures	
	md::Cimage oImage;
	if (!m_pEnvInfo->oMedia.read("spheretex.png", oImage))
		throw "CCubeZoom.init()\r\nCould not load spheretex.png";

	m_punNodeTexture = new unsigned int;

	*m_punNodeTexture = oImage.makeGLTexture(m_pEnvInfo->glWantMipmap,m_pEnvInfo->glWantLinear);

	oImage.destroy();

	// To increase performace, I have the quadric rendered in a display list.
	// I have yet to find the time to see if this provides a significant
	// (if any) speed increase.
	glNewList(m_glDispObject, GL_COMPILE);
		glBindTexture(GL_TEXTURE_2D, *m_punNodeTexture);
		gluSphere(
			m_pQuadObject,			// Quadric identifier
			1.0,						// radius
			m_nSphereQuality,		// horizontal components
			m_nSphereQuality);	// verticle componetns
	glEndList();

	glEnable(GL_NORMALIZE);

	return true;
}