void SpheresGridDemo::myinit()
{
	DemoApplication::myinit();
#ifndef __APPLE__
    glewInit();
    if (!glewIsSupported("GL_VERSION_2_0 GL_VERSION_1_5 GL_ARB_multitexture GL_ARB_vertex_buffer_object")) {
        fprintf(stderr, "Required OpenGL extensions missing.");
        exit(-1);
    }
#endif //__APPLE__
	
	m_shaderProgram = _compileProgram(vertexShader, spherePixelShader);
#ifdef INTEGRATION_DEMO
	m_pWorldI->initCLKernels(m_argc, m_argv);
#endif

#ifdef SPHERES_DEMO
#ifdef INTEGRATION_DEMO
	m_pWorldS->m_cxMainContext = m_pWorldI->m_cxMainContext;
	m_pWorldS->m_cdDevice = m_pWorldI->m_cdDevice;
	m_pWorldS->m_cqCommandQue = m_pWorldI->m_cqCommandQue;
	m_pWorldS->m_cpProgram = m_pWorldI->m_cpProgram;
	m_pWorldS->initCLKernels(m_argc, m_argv);
#else
	m_pWorldS->initCLKernels(m_argc, m_argv);
#endif
#endif
}
void ParticleRenderer::_initGL()
{
    m_program_sphere = _compileProgram(vertexShader_sphere, pixelShader_sphere);
	m_program_cosmos   = _compileProgram(vertexShader_cosmos,   pixelShader_cosmos); _createTexture(32);

#if !defined(__APPLE__) && !defined(MACOSX)
    glClampColorARB(GL_CLAMP_VERTEX_COLOR_ARB, GL_FALSE);
    glClampColorARB(GL_CLAMP_FRAGMENT_COLOR_ARB, GL_FALSE);
#endif

	// load floor texture
	char imagePath[] = "../src/data/floortile.ppm";
    if (imagePath == 0) {
        fprintf(stderr, "Error finding floor image file\n");
        fprintf(stderr, "  FAILED\n");
        exit(EXIT_FAILURE);
    }
    floorTex = loadTexture(imagePath);
   
    // load sky texture
	char imagePath2[] = "../src/data/pansky2.ppm";
    if (imagePath2 == 0) {
        fprintf(stderr, "Error finding floor image file\n");
        fprintf(stderr, "  FAILED\n");
        exit(EXIT_FAILURE);
    }
    
    skyboxTex[0] = loadTexture("../src/data/faesky02back.ppm");
    skyboxTex[1] = loadTexture("../src/data/faesky02down.ppm");
    skyboxTex[2] = loadTexture("../src/data/faesky02front.ppm");
    skyboxTex[3] = loadTexture("../src/data/faesky02left.ppm");
    skyboxTex[4] = loadTexture("../src/data/faesky02right.ppm");
    skyboxTex[5] = loadTexture("../src/data/faesky02up.ppm");    
     
    for (int i=0; i<6; i++){
		glBindTexture(GL_TEXTURE_2D, skyboxTex[i]);
		glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
		glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, 16.0f);
		
		glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
		glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
		glBindTexture(GL_TEXTURE_2D, 0);
	}
    //floorProg = new GLSLProgram(floorVS, floorPS);	
}
Exemple #3
0
void ParticleRenderer::_initGL()
{
    m_program = _compileProgram(vertexShader, spherePixelShader);

#if !defined(__APPLE__) && !defined(MACOSX)
    glClampColorARB(GL_CLAMP_VERTEX_COLOR_ARB, GL_FALSE);
    glClampColorARB(GL_CLAMP_FRAGMENT_COLOR_ARB, GL_FALSE);
#endif
}
Exemple #4
0
void ParticlesDemo::myinit()
{
	DemoApplication::myinit();
#ifndef __APPLE__
    glewInit();
    if (!glewIsSupported("GL_VERSION_2_0 GL_VERSION_1_5 GL_ARB_multitexture GL_ARB_vertex_buffer_object")) {
        fprintf(stderr, "Required OpenGL extensions missing.");
        exit(-1);
    }
#endif //__APPLE__
	
	m_shaderProgram = _compileProgram(vertexShader, spherePixelShader);
	m_pWorld->initCLKernels(m_argc, m_argv);
}