// Initialize fog static void init(void) { GLfloat fogColor[4] = {0, 0.25, 0.25, 1.0}; f1 = 1.0f; f2 = 5.0; f3 = 10.0f; glEnable(GL_FOG); glFogi(GL_FOG_MODE, GL_EXP); glFogfv(GL_FOG_COLOR, fogColor); glFogf(GL_FOG_DENSITY, 0.25); glHint(GL_FOG_HINT, GL_DONT_CARE); glFogi(GL_FOG_COORD_SRC, GL_FOG_COORD); // fog color glClearColor(0.0, 0.25, 0.25, 1.0); }
void graphics_state_flush_fog() { glFogi(GL_FOG_MODE, fogmodes[d3dFogMode]); glHint(GL_FOG_HINT, d3dFogHint); const float glFogColor[] = {COL_GET_Rf(d3dFogColor),COL_GET_Gf(d3dFogColor),COL_GET_Bf(d3dFogColor)}; glFogfv(GL_FOG_COLOR, glFogColor); glFogf(GL_FOG_START, d3dFogStart); glFogf(GL_FOG_END, d3dFogEnd); glFogf(GL_FOG_DENSITY, d3dFogDensity); }
void RAS_OpenGLRasterizer::SetFog(short type, float start, float dist, float intensity, float color[3]) { float params[4] = {color[0], color[1], color[2], 1.0f}; glFogi(GL_FOG_MODE, GL_LINEAR); glFogf(GL_FOG_DENSITY, intensity / 10.0f); glFogf(GL_FOG_START, start); glFogf(GL_FOG_END, start + dist); glFogfv(GL_FOG_COLOR, params); }
/* * Redisplay() is called by Player_Gl_Window::draw(). * * The display is double buffered, and FLTK swap buffers when * Player_Gl_Window::draw() returns. The GL context associated with this * instance of Player_Gl_Window is set to be the current context by FLTK * when it calls draw(). */ void Redisplay() { /* clear image buffer to black */ glClearColor(1.0, 1.0, 1.0, 0); glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT); /* clear image, zbuf */ glPushMatrix(); /* save current transform matrix */ cameraView(); glLineWidth(2.0); /* we'll draw background with thick lines */ if (renderWorldAxes == ON) { glDisable(GL_LIGHTING); glDisable(GL_TEXTURE_2D); glDisable(GL_FOG); RenderWorldAxes(); /* draw a triad in the origin of the world coordinate */ } if (groundPlane == ON) { if (useFog == ON) { glEnable(GL_FOG); GLfloat fogColor[4] = {1.0, 1.0, 1.0, 1.0}; glFogfv(GL_FOG_COLOR, fogColor); glFogf(GL_FOG_START, (float)fogStart); glFogf(GL_FOG_END, (float)fogEnd); glFogf(GL_FOG_DENSITY, (float)fogDensity); glFogi(GL_FOG_MODE, GL_LINEAR); } // draw_ground(); glEnable(GL_LIGHTING); glDisable(GL_TEXTURE_2D); glCallList(displayListGround); glDisable(GL_LIGHTING); glDisable(GL_FOG); glLineWidth(1.0); glColor3f(0.1f, 0.1f, 0.1f); double ground[4] = {0,1,0,0}; double light[4] = {0,groundPlaneLightHeight,0,1}; displayer.RenderShadow(ground, light); } // render the skeletons if (displayer.GetNumSkeletons()) { glEnable(GL_LIGHTING); glDisable(GL_FOG); displayer.Render(DisplaySkeleton::BONES_AND_LOCAL_FRAMES); } glPopMatrix(); // restore current transformation matrix }
void draw_dilldallscene(object* room, object *sphere, object *sphere_copy, float time, float flash, float flash2){ glPushAttrib(GL_ALL_ATTRIB_BITS); glClearColor(1,1,1,0); glClear(GL_DEPTH_BUFFER_BIT|GL_COLOR_BUFFER_BIT); glMatrixMode(GL_TEXTURE); glLoadIdentity(); glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluPerspective(90, ASPECT, 1.f, 500); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glFogi(GL_FOG_MODE, GL_LINEAR); glFogfv(GL_FOG_COLOR,black_color); glFogf(GL_FOG_START, 100.f); glFogf(GL_FOG_END, 250.f); glEnable(GL_FOG); gluLookAt( sin(time)*90,-50,cos(time)*90, 0,-30,0, 0,1,0 ); set_light(0, (float)sin(time*5)*50,0,(float)cos(time*5)*50,TRUE); glEnable(GL_LIGHTING); glEnable(GL_DEPTH_TEST); glPushMatrix(); glTranslatef(100,0,-100); draw_object(room); glPopMatrix(); glPushMatrix(); glTranslatef(0,-30+ sin(time*flash)*flash*20+flash2,0); glScalef(0.7f,0.7f,0.7f); glRotatef(time*55,1,0,1); glRotatef(time*55,1,0,0); glRotatef(time*55.2f,0,1,0); glRotatef(time*55,0,0,1); glRotatef(time*75,1,0,0); glRotatef(time*55.2f,0,1,0); blob_distort(sphere, sphere_copy, vector_make((float)sin(time),time,-time), vector_make( (float)(1+sin(time))*0.1f, (float)(1+sin(time))*0.1f, (float)(1+sin(time))*0.1f ),vector_make(0.3f,0.3f,0.3f) ); draw_object(sphere_copy); glPopMatrix(); glPopAttrib(); }
glue_static void glueFog_toimiva(float *color, float min, float max) { glEnable(GL_FOG); glFogi(GL_FOG_MODE, GL_LINEAR); glFogf(GL_FOG_DENSITY, 1.0); glFogfv(GL_FOG_COLOR, color); glFogf(GL_FOG_START, min); glFogf(GL_FOG_END, max); glHint(GL_FOG_HINT, GL_NICEST); }
void LoadAll() { lastframe=SDL_GetTicks(); DrawLoad(); // if(texres)LoadGLTexturesHigh(); // load the textures. // else LoadGLTexturesLow(); loaded = 10; DrawLoad(); SetPlayerVars(); loaded = 20; DrawLoad(); InitItemList(); LoadItems(); loaded = 30; DrawLoad(); // xx();//debug InitQList(); loaded = 40; DrawLoad(); quadratic=gluNewQuadric(); // Create A Pointer To The Quadric Object ( NEW ) // set up lights. glLightfv(GL_LIGHT1, GL_AMBIENT, LightAmbient); glLightfv(GL_LIGHT1, GL_DIFFUSE, LightDiffuse); glLightfv(GL_LIGHT1, GL_POSITION, LightPosition); glEnable(GL_LIGHT1); glEnable(GL_LIGHTING); glEnable(GL_COLOR_MATERIAL); loaded = 50; DrawLoad(); //fog glFogi(GL_FOG_MODE, fogMode[fogFilter]); glFogfv(GL_FOG_COLOR, fogColor); glFogf(GL_FOG_DENSITY, 0.55f); glHint(GL_FOG_HINT, GL_DONT_CARE); glFogf(GL_FOG_START, -0.4f); glFogf(GL_FOG_END, -15.0f); loaded = 60; DrawLoad(); if(sound)InitSounds(); loaded = 70; DrawLoad(); setupLand1(); loaded = 100; DrawLoad(); display = LAND1; }
void V_AddWaterfog (int contents) { extern cvar_t gl_waterfog_color_water; extern cvar_t gl_waterfog_color_lava; extern cvar_t gl_waterfog_color_slime; float colors[4]; if (!gl_waterfog.value || COM_CheckParm ("-nomtex") || contents == CONTENTS_EMPTY || contents == CONTENTS_SOLID) { glDisable(GL_FOG); return; } switch (contents) { case CONTENTS_LAVA: colors[0] = (float) gl_waterfog_color_lava.color[0] / 255.0; colors[1] = (float) gl_waterfog_color_lava.color[1] / 255.0; colors[2] = (float) gl_waterfog_color_lava.color[2] / 255.0; colors[3] = (float) gl_waterfog_color_lava.color[3] / 255.0; break; case CONTENTS_SLIME: colors[0] = (float) gl_waterfog_color_slime.color[0] / 255.0; colors[1] = (float) gl_waterfog_color_slime.color[1] / 255.0; colors[2] = (float) gl_waterfog_color_slime.color[2] / 255.0; colors[3] = (float) gl_waterfog_color_slime.color[3] / 255.0; break; default: colors[0] = (float) gl_waterfog_color_water.color[0] / 255.0; colors[1] = (float) gl_waterfog_color_water.color[1] / 255.0; colors[2] = (float) gl_waterfog_color_water.color[2] / 255.0; colors[3] = (float) gl_waterfog_color_water.color[3] / 255.0; break; } glFogfv(GL_FOG_COLOR, colors); if (( (int) gl_waterfog.value ) == 2) { glFogf(GL_FOG_DENSITY, 0.0002 + (0.0009 - 0.0002) * bound(0, gl_waterfog_density.value, 1)); glFogi(GL_FOG_MODE, GL_EXP); } else { glFogi(GL_FOG_MODE, GL_LINEAR); glFogf(GL_FOG_START, 150.0f); glFogf(GL_FOG_END, 4250.0f - (4250.0f - 1536.0f) * bound (0, gl_waterfog_density.value, 1)); } glEnable(GL_FOG); }
int main(int ac, char **av) { float fogcolor[4] = { 0.7, 0.7, 0.7, 1.0 }; fprintf(stderr, "IperS V1.0\nWritten by David Bucciarelli ([email protected])\n"); glutInitWindowPosition(0, 0); glutInitWindowSize(WIDTH, HEIGHT); glutInit(&ac, av); glutInitDisplayMode(GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE); if (!(win = glutCreateWindow("IperS"))) { fprintf(stderr, "Error, couldn't open window\n"); exit(-1); } reshape(WIDTH, HEIGHT); glShadeModel(GL_SMOOTH); glEnable(GL_DEPTH_TEST); glEnable(GL_CULL_FACE); glEnable(GL_TEXTURE_2D); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glEnable(GL_FOG); glFogi(GL_FOG_MODE, GL_EXP2); glFogfv(GL_FOG_COLOR, fogcolor); glFogf(GL_FOG_DENSITY, 0.006); glHint(GL_FOG_HINT, GL_NICEST); inittextures(); initdlists(); initlight(); glClearColor(fogcolor[0], fogcolor[1], fogcolor[2], fogcolor[3]); glClear(GL_COLOR_BUFFER_BIT); calcposobs(); glutReshapeFunc(reshape); glutDisplayFunc(draw); glutKeyboardFunc(key); glutSpecialFunc(special); glutIdleFunc(draw); glutMainLoop(); cleanup(); return 0; }
void OpenGLRenderer::SetFogParams(FogMode fogMode, float fogStart, float fogEnd, float fogDensity) { glFogi(GL_FOG_MODE, arxToGlFogMode[fogMode]); glFogf(GL_FOG_START, fogStart); glFogf(GL_FOG_END, fogEnd); glFogf(GL_FOG_DENSITY, fogDensity); CHECK_GL; }
void ofApp::enableFog(float near, float far) { glEnable(GL_FOG); glFogi(GL_FOG_MODE, GL_LINEAR); GLfloat fogColor[4]= {0, 0, 0, 1}; glFogfv(GL_FOG_COLOR, fogColor); glHint(GL_FOG_HINT, GL_FASTEST); glFogf(GL_FOG_START, near); glFogf(GL_FOG_END, far); }
void cagdBegin(PCSTR title, int width, int height) { // auxReshapeFunc(resize); glFogi(GL_FOG_MODE, GL_LINEAR); glFogf(GL_FOG_START, 1.f); glFogf(GL_FOG_END, 2.f * Z_SHIFT); glPointSize((GLfloat)POINT_SIZE); cagdReset(); // createMenu(); }
void CSpecialFX::ActivateFog(float density, float r, float g, float b) { GLfloat fogColor[4] = {r, g, b, 1.0}; glEnable (GL_FOG); glFogi (GL_FOG_MODE, GL_EXP2); glFogfv (GL_FOG_COLOR, fogColor); glFogf (GL_FOG_DENSITY, density); glHint (GL_FOG_HINT, GL_NICEST); }
glue_static void glueFog2(float *color, float power, float min, float max) { glEnable(GL_FOG); glFogi(GL_FOG_MODE, GL_EXP); glFogf(GL_FOG_DENSITY, power); glFogfv(GL_FOG_COLOR, color); glFogf(GL_FOG_START, min); glFogf(GL_FOG_END, max); // glHint(GL_FOG_HINT, GL_NICEST); glHint(GL_FOG_HINT, GL_DONT_CARE); }
void initFog(){ glClearColor(0.5f,0.5f,0.5f,1.0f); // We'll Clear To The Color Of The Fog ( Modified ) glFogi(GL_FOG_MODE, fogMode[fogfilter]); // Fog Mode glFogfv(GL_FOG_COLOR, fogColor); // Set Fog Color glFogf(GL_FOG_DENSITY, 0.9f); // How Dense Will The Fog Be glHint(GL_FOG_HINT, GL_DONT_CARE); // Fog Hint Value glFogf(GL_FOG_START, 20.0f); // Fog Start Depth glFogf(GL_FOG_END, 100.0f); // Fog End Depth glEnable(GL_FOG); // Enables GL_FOG }
void CommanderCamera::updateFog() { GLfloat flowLight[] = {0.5, 0.5, 0.5, 1}; glEnable(GL_FOG); glFogfv(GL_FOG_COLOR, flowLight); glFogf(GL_FOG_START, locZ); glFogf(GL_FOG_END, locZ+30); glFogf(GL_FOG_DENSITY, 0.2f); glFogi(GL_FOG_MODE, GL_LINEAR); }
void myinit(void) { // Position der Lichtquelle GLfloat position[] = { 0.0, 3.0, 3.0, 0.0 }; // Hintergrundfarbe glClearColor(0.5, 0.5, 0.5, 1.0); // Projektionsmatrix ist aktuelle Matrix glMatrixMode(GL_PROJECTION); // Laden der Einheitsmatrix glLoadIdentity(); // Parallelprojektion glOrtho(-6.0, 6.0, -6.0, 6.0, 0.0, 10.0); // Modelviewmatrix ist aktuelle Matrix glMatrixMode(GL_MODELVIEW); // Laden der Einheitsmatrix glLoadIdentity(); // Einschalten des Tiefentests glEnable(GL_DEPTH_TEST); // Setzen der Position der Lichtquelle glLightfv(GL_LIGHT0, GL_POSITION, position); // Einschalten der Beleuchtungsberechnung glEnable(GL_LIGHTING); // Einschalten der Lichtquelle glEnable(GL_LIGHT0); // Einschalten des Nebeleffekts glEnable(GL_FOG); { GLfloat fogColor[4] = { 0.5, 0.5, 0.5, 1.0 }; fogMode = GL_EXP; // Setzen der Gewichtsfunktion für den Nebel glFogi(GL_FOG_MODE, fogMode); // Setzen der Nebelfarbe glFogfv(GL_FOG_COLOR, fogColor); // Setzen der Nebeldichte glFogf(GL_FOG_DENSITY, 0.35); // Setzen der Qualität der Nebelberechnung (systemabhängige Qualität) glHint(GL_FOG_HINT, GL_DONT_CARE); } }
void drawFog() { glEnable(GL_FOG); GLfloat fogColor[4] = {0.5, 0.5, 0.5, 1.0}; glFogi (GL_FOG_MODE, GL_EXP ); glFogfv (GL_FOG_COLOR, fogColor); glFogf (GL_FOG_DENSITY, 0.35); glHint (GL_FOG_HINT, GL_DONT_CARE); glFogf (GL_FOG_START, 1.0); glFogf (GL_FOG_END, 5.0); }
static void init(void) { int i; glEnable(GL_DEPTH_TEST); for (i = 0; i < NUMCOLORS; i++) { GLfloat shade; shade = (GLfloat) (NUMCOLORS-i)/(GLfloat) NUMCOLORS; glutSetColor (RAMPSTART + i, shade, shade, shade); } glEnable(GL_FOG); glFogi (GL_FOG_MODE, GL_LINEAR); glFogi (GL_FOG_INDEX, NUMCOLORS); glFogf (GL_FOG_START, 1.0); glFogf (GL_FOG_END, 6.0); glHint (GL_FOG_HINT, GL_NICEST); glClearIndex((GLfloat) (NUMCOLORS+RAMPSTART-1)); }
void Fog::enable() { m_enabled=true; glClearColor(m_fogr, m_fogg, m_fogb, 1.0f); glFogi(GL_FOG_MODE, GL_LINEAR);//GL_LINEAR,GL_EXP ou GL_EXP2 glFogf(GL_FOG_START, m_fogdistancestart); glFogf(GL_FOG_END, m_fogdistanceend); GLfloat fog_c[] = {m_fogr, m_fogg, m_fogb, 1.0f};//couleur du brouillard, ici noir glFogfv(GL_FOG_COLOR, fog_c); glEnable(GL_FOG); }
void turnExp2FogOn(void){ GLfloat fogColor[] = {0., 0., 0., 1.0}; // Nevoeiro cinzento // Activar o nevoeiro glEnable(GL_FOG); // Define a cor do nevoeiro glFogfv(GL_FOG_COLOR, fogColor); // Define nevoeiro exponencial ao quadrado (1 - e^(-(0.04d)^2)) glFogi(GL_FOG_MODE, GL_EXP2); glFogf(GL_FOG_DENSITY, 0.04f); }
///// initializeGL //////////////////////////////////////////////////////////// void GLView::initializeGL() /// Overridden from QGLWidget::initializeGL(). /// Initializes the OpenGL window. { GLfloat lightAmbient[] = {0.2f, 0.2f, 0.2f, 0.0f}; GLfloat lightDiffuse[] = {0.5f, 0.5f, 0.5f, 0.0f}; GLfloat lightSpecular[] = {1.0f, 1.0f, 1.0f, 0.0f}; updateGLSettings(); ///// lighting ///// lighting model //glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, GL_FALSE); // disable twosided lighting (default) //glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER, GL_FALSE); // disable local viewpoint (default) //glLightModelfv(GL_LIGHT_MODEL_AMBIENT, lightAmbient); // set the ambient light (default) ///// setup light 0 glLightfv(GL_LIGHT0, GL_AMBIENT, lightAmbient); // enable ambient glLightfv(GL_LIGHT0, GL_DIFFUSE, lightDiffuse); // enable diffuse glLightfv(GL_LIGHT0, GL_SPECULAR, lightSpecular); // enable specular glEnable(GL_LIGHTING); // enable lighting glEnable(GL_LIGHT0); // enable light 0 glEnable(GL_AUTO_NORMAL); glEnable(GL_NORMALIZE); // maybe this copes with the non-uniform scaling of the bonds => nope /////every change of glColor sets a new diffuse+ambient color glColorMaterial(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE); glEnable(GL_COLOR_MATERIAL); glEnable(GL_DITHER); // enable dithering (default) glEnable(GL_DEPTH_TEST); // use the depth buffer for hidden surface removal glCullFace(GL_BACK); // we will only see the outsides of objects glEnable(GL_CULL_FACE); // => enable culling ///// AA setup //glHint(GL_POLYGON_SMOOTH_HINT, GL_NICEST); // antialiasing method //glBlendFunc(GL_SRC_ALPHA_SATURATE, GL_ONE); // set the proper blending mode ///// AA for lines glHint(GL_LINE_SMOOTH_HINT, GL_NICEST); //glEnable(GL_LINE_SMOOTH); ///// AA for points glHint(GL_POINT_SMOOTH_HINT, GL_NICEST); //glEnable(GL_POINT_SMOOTH); // transparancy setup glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); ///// Fog setup glFogi(GL_FOG_MODE, GL_LINEAR); ///// other glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); // color interpolation method }
void glschool_initFog(void) { GLfloat fog[4] = {0.0, 0.0, 0.15, 1.0}; glEnable(GL_FOG); glFogi(GL_FOG_MODE, GL_EXP2); glFogfv(GL_FOG_COLOR, fog); glFogf(GL_FOG_DENSITY, .0025); glFogf(GL_FOG_START, -100); }
int MyInitScene() { glDepthFunc(GL_LEQUAL); glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); // Allow perspective correction glDepthFunc(GL_LEQUAL); dlMesh = glGenLists(Mesh_Count); glLightfv(GL_LIGHT1, GL_AMBIENT, MSA_pF(LightAmbient)); glLightfv(GL_LIGHT1, GL_DIFFUSE, MSA_pF(LightDiffuse)); glLightfv(GL_LIGHT1, GL_POSITION, MSA_pF(f4LightPos)); glEnable(GL_LIGHT1); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glDisable(GL_BLEND); glDisable(GL_LIGHTING); glDisable(GL_DEPTH_TEST); glLineWidth(1); // glAlphaFunc(GL_LEQUAL, 1); // glEnable(GL_ALPHA_TEST ); // LoadGLTextures(); glNewList(dlMesh + Mesh_Grid,GL_COMPILE); DrawGrid2(); glEndList(); BuildFonts(); glFogi(GL_FOG_MODE, GL_LINEAR); // GL_LINEAR, GL_EXP, and GL_EXP2 glFogfv(GL_FOG_COLOR, MSA_pF(InitInfo.BackCol)); // Set Fog Color glFogf(GL_FOG_DENSITY, 1.0f); // How Dense Will The Fog Be glHint(GL_FOG_HINT, GL_NICEST ); // GL_NICEST GL_FASTEST glFogf(GL_FOG_START, 1.0f); // Fog Start Depth glFogf(GL_FOG_END, 150.0f); // Fog End Depth glEnable(GL_FOG); strcpy(AppInfo.szFlags, "___________________"); Inputs.bLockMouse = TRUE; ShowCursor(FALSE); return TRUE; }
void GameEnvironment::addFog() { GLfloat density = 0.025; GLfloat fogColor[4] = { 0.00, 0.00, 0.00, 1.0 }; glEnable(GL_FOG); glFogi(GL_FOG_MODE, GL_EXP2); glFogfv(GL_FOG_COLOR, fogColor); glFogf(GL_FOG_DENSITY, density); glHint(GL_FOG_HINT, GL_NICEST); }
void displayFog(void) { GLfloat density = 0.002f; GLfloat fogColor[4] = {0.10f, 0.027f, 0.188f, 1.0f}; glFogi (GL_FOG_MODE, GL_LINEAR); glFogfv (GL_FOG_COLOR, fogColor); glFogf (GL_FOG_DENSITY, density); glHint (GL_FOG_HINT, GL_NICEST); glFogf(GL_FOG_START, 100.0f); glFogf(GL_FOG_END, 600.0f); glEnable(GL_FOG); }
static void initializeGL(ModeInfo *mi, GLsizei width, GLsizei height) { pulsarstruct *gp = &Pulsar[MI_SCREEN(mi)]; GLfloat fogColor[4] = { 0.1, 0.1, 0.1, 0.1 }; glViewport( 0, 0, width, height ); resetProjection(); if (do_depth) glEnable(GL_DEPTH_TEST); if (do_antialias) { do_blend = 1; glEnable(GL_LINE_SMOOTH); } if (do_blend) { glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); } if (do_light) { glShadeModel(GL_SMOOTH); glEnable(GL_COLOR_MATERIAL); glColorMaterial(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE); } # ifdef HAVE_JWZGLES /* #### glPolygonMode other than GL_FILL unimplemented */ do_wire = 0; # endif if (do_wire) glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); else glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); if (do_fog) { glEnable(GL_FOG); glFogi(GL_FOG_MODE, GL_LINEAR); glFogfv(GL_FOG_COLOR, fogColor); glFogf(GL_FOG_DENSITY, 0.35); /* glHint(GL_FOG_HINT, GL_FASTEST); */ glFogf(GL_FOG_START, 50.0); glFogf(GL_FOG_END, 100.0); } if (do_texture) Create_Texture(mi, which_image); GenerateQuad(gp); }
void SystemView::Draw3D() { glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluPerspective(50, Pi::GetScrAspect(), 1.0, 1000.0); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glClearColor(0,0,0,0); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); SystemPath path = Pi::sectorView->GetSelectedSystem(); if (m_system) { if (!m_system->GetPath().IsSameSystem(path)) { m_system.Reset(); ResetViewpoint(); } } m_time += m_timeStep*Pi::GetFrameTime(); std::string t = Lang::TIME_POINT+format_date(m_time); m_timePoint->SetText(t); if (!m_system) m_system = StarSystem::GetCached(path); glDisable(GL_LIGHTING); glEnable(GL_FOG); glFogi(GL_FOG_MODE, GL_EXP2); glFogfv(GL_FOG_COLOR, fogColor); glFogf(GL_FOG_DENSITY, fogDensity); glHint(GL_FOG_HINT, GL_NICEST); glTranslatef(0,0,-ROUGH_SIZE_OF_TURD); glRotatef(m_rot_x, 1, 0, 0); glRotatef(m_rot_z, 0, 0, 1); vector3d pos(0,0,0); if (m_selectedObject) GetTransformTo(m_selectedObject, pos); m_objectLabels->Clear(); if (m_system->m_unexplored) m_infoLabel->SetText(Lang::UNEXPLORED_SYSTEM_NO_SYSTEM_VIEW); else if (m_system->rootBody) { PutBody(m_system->rootBody, pos); if (Pi::game->GetSpace()->GetStarSystem() == m_system) { const Body *navTarget = Pi::player->GetNavTarget(); const SBody *navTargetSBody = navTarget ? navTarget->GetSBody() : 0; if (navTargetSBody) PutSelectionBox(navTargetSBody, pos, Color(0.0, 1.0, 0.0, 1.0)); } } glEnable(GL_LIGHTING); glDisable(GL_FOG); }
void ViewFogGL3::paintGL() { if(__enable){ glEnable(GL_FOG); if(__mode == 0)glFogi(GL_FOG_MODE,GL_LINEAR); else if(__mode == 1)glFogi(GL_FOG_MODE,GL_EXP); else if(__mode == 2)glFogi(GL_FOG_MODE,GL_EXP2); glGeomFogColor(__color); if(__hintmode == 0)glHint(GL_FOG_HINT,GL_DONT_CARE); else if(__hintmode == 1)glHint(GL_FOG_HINT,GL_FASTEST); else if(__hintmode == 2)glHint(GL_FOG_HINT,GL_NICEST); glFogf(GL_FOG_DENSITY,GLfloat(__density)); glFogf(GL_FOG_START,GLfloat(__start)); glFogf(GL_FOG_END,GLfloat(__end)); } else { glDisable(GL_FOG); } GEOM_GL_ERROR; }
void Fog::SetFog(Color newColor, float fStart, float fEnd, float Density) { GLfloat newfogColor[4]; newfogColor[0] = newColor.r; newfogColor[1] = newColor.g; newfogColor[2] = newColor.b; newfogColor[3] = 1; fogStart = fStart; fogEnd = fEnd; fogDensity = Density; fogMode = GL_LINEAR; glFogi(GL_FOG_MODE, fogMode); glFogfv(GL_FOG_COLOR, newfogColor); glFogf(GL_FOG_DENSITY, fogDensity); glFogi(GL_FOG_HINT, GL_DONT_CARE); glFogf(GL_FOG_START, fogStart); glFogf(GL_FOG_END, fogEnd); glEnable(GL_FOG); }