예제 #1
0
bool RenderManager::initialise()
{

	fpsDisplay_ = new Font("Arial", 25, false, false);
	fpsDisplay_->initialise();

	ent1 = new Entity;

	testCamera_ = new ChaseCamera(ent1);
	//testCamera_ = new StaticCamera;
	//testCamera_ = new Camera;
	testCamera_->initialise();

	bool result = true;

	if(!glh_init_extensions(
		"GL_ARB_multitexture "
		"GL_NV_vertex_program "
		"GL_NV_fragment_program "
		"WGL_ARB_pbuffer "
		"WGL_ARB_pixel_format "
		"WGL_ARB_render_texture "
		))	
	{
		debugLog << "Error - required extensions were not supported: " <<  glh_get_unsupported_extensions() << std::endl;		
	}

	glEnable(GL_DEPTH_TEST);


	checkError("initialise");
	return result;
}
예제 #2
0
void GLApp::initgl ()
{
	// maybe splash here?
	//glEnableClientState(GL_VERTEX_ARRAY);
	//glEnableClientState(GL_TEXTURE_COORD_ARRAY);
	//glEnableClientState(GL_NORMAL_ARRAY);

	if(! glh_init_extensions(
		"GL_ARB_multitexture "
		"GL_NV_vertex_program "
		"GL_NV_fragment_program "
		"WGL_ARB_pbuffer "
		"WGL_ARB_pixel_format "
		"WGL_ARB_render_texture "
		))	{
			// TODO log properly
			fprintf(stderr, "Error - required extensions were not supported: %s", glh_get_unsupported_extensions());
		}

	glHint(GL_LINE_SMOOTH_HINT, GL_FASTEST);
    glHint(GL_POLYGON_SMOOTH_HINT, GL_FASTEST);
    glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST);
	glEnable(GL_DEPTH_TEST);


	//const char* fp_mode = "float=16 rgba depth textureRECT";
	const char* fp_mode = "rgba depth textureRECT";
	const GLenum fp_target = GL_TEXTURE_RECTANGLE_NV;
	//const char* fp_mode = "rgba depth texture";
	//const GLenum fp_target = GL_TEXTURE_2D;

	int sizeOfTarget=256;
	//otherScene = new RenderTexture(fp_mode, sizeOfTarget, sizeOfTarget, fp_target);
	//otherScene = new RenderTexture(fp_mode, 320, 240, fp_target);
	//otherScene->Activate();
	//glEnable(GL_DEPTH_TEST);
	//setProjection(320,240);
	//otherScene->Deactivate();

	glEnable(GL_TEXTURE_2D);

	glClearColor(0.3f, 0.4f, 0.9f, 0.0f);

	arial = new Font ("Arial Black");

	unsigned texture_id;
	TextureManager::Instance().Load("./pics/envtest1.jpg", texture_id);
	TextureManager::Instance().Load("./pics/sky.jpg", texture_id);
	TextureManager::Instance().Load("./pics/crosshair.tga", texture_id);
	TextureManager::Instance().Load("./pics/spectrum.jpg", texture_id);

	LoadStaticMedia();

	terrain.Init("map1");

	//mainScene->Activate();
	checkError("Init");

}
int ObjMeshGPUDeformer_uUq_fbo::InitExtensions()
{
  #ifdef WIN32
    if (!glh_init_extensions("GL_EXT_framebuffer_object "
                           "GL_ARB_multitexture "))
    {
      printf("Unable to load the following extension(s): %s\n", 
             glh_get_unsupported_extensions());
      printf("Try updating your graphics card driver.\n");
      return 1;
    }
    printf("Detected extensions: GL_EXT_framebuffer_object GL_ARB_multitexture\n");
  #endif

  return 0;
}