inline void VL_glPointParameterf( GLenum pname, GLfloat param)
 {
   if (glPointParameterf)
     glPointParameterf(pname,param);
   else
   if (glPointParameterfARB)
     glPointParameterfARB(pname,param);
   else
   if (glPointParameterfEXT)
     glPointParameterfEXT(pname,param);
   else
     VL_UNSUPPORTED_FUNC();
 }
 void GLStateCacheManagerImp::setPointParameters(GLfloat *attenuation, float minSize, float maxSize)
 {
     if (minSize != mPointSizeMin)
     {
         mPointSizeMin = minSize;
         const Ogre::RenderSystemCapabilities* caps = dynamic_cast<GLRenderSystem*>(Root::getSingleton().getRenderSystem())->getCapabilities();
         if (caps->hasCapability(RSC_POINT_EXTENDED_PARAMETERS))
             glPointParameterf(GL_POINT_SIZE_MIN, mPointSizeMin);
         else if (caps->hasCapability(RSC_POINT_EXTENDED_PARAMETERS_ARB))
             glPointParameterfARB(GL_POINT_SIZE_MIN, mPointSizeMin);
         else if (caps->hasCapability(RSC_POINT_EXTENDED_PARAMETERS_EXT))
             glPointParameterfEXT(GL_POINT_SIZE_MIN, mPointSizeMin);
     }
     if (maxSize != mPointSizeMax)
     {
         mPointSizeMax = maxSize;
         const Ogre::RenderSystemCapabilities* caps = dynamic_cast<GLRenderSystem*>(Root::getSingleton().getRenderSystem())->getCapabilities();
         if (caps->hasCapability(RSC_POINT_EXTENDED_PARAMETERS))
             glPointParameterf(GL_POINT_SIZE_MAX, mPointSizeMax);
         else if (caps->hasCapability(RSC_POINT_EXTENDED_PARAMETERS_ARB))
             glPointParameterfARB(GL_POINT_SIZE_MAX, mPointSizeMax);
         else if (caps->hasCapability(RSC_POINT_EXTENDED_PARAMETERS_EXT))
             glPointParameterfEXT(GL_POINT_SIZE_MAX, mPointSizeMax);
     }
     if (attenuation[0] != mPointAttenuation[0] || attenuation[1] != mPointAttenuation[1] || attenuation[2] != mPointAttenuation[2])
     {
         mPointAttenuation[0] = attenuation[0];
         mPointAttenuation[1] = attenuation[1];
         mPointAttenuation[2] = attenuation[2];
         const Ogre::RenderSystemCapabilities* caps = dynamic_cast<GLRenderSystem*>(Root::getSingleton().getRenderSystem())->getCapabilities();
         if (caps->hasCapability(RSC_POINT_EXTENDED_PARAMETERS))
             glPointParameterfv(GL_POINT_DISTANCE_ATTENUATION, &mPointAttenuation[0]);
         else if (caps->hasCapability(RSC_POINT_EXTENDED_PARAMETERS_ARB))
             glPointParameterfvARB(GL_POINT_DISTANCE_ATTENUATION, &mPointAttenuation[0]);
         else if (caps->hasCapability(RSC_POINT_EXTENDED_PARAMETERS_EXT))
             glPointParameterfvEXT(GL_POINT_DISTANCE_ATTENUATION, &mPointAttenuation[0]);
     }
 }
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_EXTPointParameters_nglPointParameterfEXT(JNIEnv *env, jclass clazz, jint pname, jfloat param, jlong function_pointer) {
	glPointParameterfEXTPROC glPointParameterfEXT = (glPointParameterfEXTPROC)((intptr_t)function_pointer);
	glPointParameterfEXT(pname, param);
}
Example #4
0
bool Init(void)
{
	DMacro_TraceEnter(Init);

	//
	// OpenGL
	//
	DGL::Font::Init();
	// Texture
	glEnable( GL_TEXTURE_2D);

	g_loadingScreen.Init();

	CHECK_QUIT;
	g_loadingScreen.SetStage( 5, "Initializing OpenGL ...");
		DGL::InitQuadrics();

		DGL::Extensions::Init();

		if(DGL::Extensions::IsEnabled_WGL_EXT_swap_control())
		{
			DSys::Logger::Print("Disabling monitor sync ...");
			wglSwapIntervalEXT(0);
		}
		if(DGL::Extensions::IsEnabled_GL_EXT_clip_volume_hint())
		{
			DSys::Logger::Print("Enabling volume clipping ...");
			glHint( GL_CLIP_VOLUME_CLIPPING_HINT_EXT, GL_NICEST);
		}
		
		if(DGL::Extensions::IsEnabled_GL_EXT_point_parameters())
		{
			DSys::Logger::Print("Setting point parameters ...");
			glPointSize(5);
			glPointParameterfEXT( GL_POINT_SIZE_MIN_EXT, 1);
			glPointParameterfEXT( GL_POINT_SIZE_MAX_EXT, 10);
			glPointParameterfEXT( GL_POINT_FADE_THRESHOLD_SIZE_EXT, 50);
			glPointParameterfEXT( GL_DISTANCE_ATTENUATION_EXT, 60);
		}
		
		// Depth buffer
		glClearDepth( 100.0f);
//		glDepthFunc( GL_LEQUAL);
//		glEnable( GL_DEPTH_TEST);

		if(DGL::Extensions::IsEnabled_GL_NV_texgen_reflection())
		{
			glTexGeni( GL_S, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP_NV);
			glTexGeni( GL_T, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP_NV);
		}
		else
		{
			glTexGeni( GL_S, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP);
			glTexGeni( GL_T, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP);
		}

		// shade model
		glShadeModel(GL_SMOOTH);
		
		// clear color
		glClearColor(0,0,0,1);
		
		// hints
		glHint( GL_PERSPECTIVE_CORRECTION_HINT,	GL_NICEST);
		glHint( GL_POINT_SMOOTH_HINT,			GL_NICEST);
		glHint( GL_LINE_SMOOTH_HINT,			GL_NICEST);
		glHint( GL_POLYGON_SMOOTH_HINT,			GL_NICEST);
		
		// polygon mode
		glPolygonMode( GL_FRONT_AND_BACK, GL_FILL );		// Back Face Is Solid
		glDisable( GL_CULL_FACE);
		g_font.Create( "Font");
		glLoadIdentity();
		
	//
	// Media
	//
	CHECK_QUIT;
	g_loadingScreen.SetStage(10, "Loading Media...");
	if(!DSys::sv_bDeveloper)
		g_bakmusic.Load( "sounds/music/bouncing.mp3");

	// User interface
	CHECK_QUIT;
	g_loadingScreen.SetStage(40, "Loading User Interface...");
	UI_Init();

	CHECK_QUIT;
	g_loadingScreen.SetStage(60, "Initializing Bouncing Game ...");
	TD::gameServer = new TD::game_server;
	TD::gameServer->init();

	CHECK_QUIT;
	g_loadingScreen.SetStage(90, "Initializing Effects...");
	// fade effect
	g_fadeIn.Init( DGL::Color(0.0f,0.0f,0.0f,1.0f), DGL::Color(0.0f,0.0f,0.0f,0.0f),1000);
	g_fadeOut.Init( DGL::Color(0.0f,0.0f,0.0f,0.0f), DGL::Color(0.0f,0.0f,0.0f,1.0f),2000);
	g_menuBack.Build( "textures/menuBack.jpg");

	CHECK_QUIT;
	g_loadingScreen.SetStage(100, "Awaiting Snapshot...");


	///////////////
	// now start the back music
	g_bakmusic.Play();


	DMacro_TraceLeave();
	return true;
}