Advertisement

my fog not working, also Nehe16 fog not working on my system.

Started by November 07, 2000 01:38 AM
10 comments, last by CodePlayEatSleep 24 years ago
Hi. First I would like to thank NEHE for the great JOB he''s doing (my first post here ), NEHE for president! Okay, I have a problem with fog. Been playing around with developing a tank-war 3D type game for awhile, got the level loading, collision detect etc worked out. SO I decided to try out lighting and fog. Well, lighting seems to work fine but somehow I JUST can''t get the fog to work. Yes, I have downloaded lesson 16 (the fog there dosen''t work either) and I''ve read the section on fog in the Red book quite a few times and I STILL can''t to work. Please guys, can you help?!! Thanks.

glEnable(GL_TEXTURE_2D);							// Enable Texture Mapping
	//glBlendFunc(GL_SRC_ALPHA,GL_ONE);					// Set The Blending Function For Translucency
	glClearColor(0.5f, 0.5f, 0.5f, 1.0f);				// This Will Clear The Background Color To Black
	glClearDepth(1.0);									// Enables Clearing Of The Depth Buffer
	glDepthFunc(GL_LESS);								// The Type Of Depth Test To Do
	glEnable(GL_DEPTH_TEST);							// Enables Depth Testing
	glShadeModel(GL_SMOOTH);							// Enables Smooth Color Shading
	glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);	// Really Nice Perspective Calculations

	//glEnable(GL_COLOR_MATERIAL);
	//lighting stuff
	glLightfv(GL_LIGHT1, GL_AMBIENT, light1_ambient);
	glLightfv(GL_LIGHT1, GL_DIFFUSE, light1_diffuse);
	glLightfv(GL_LIGHT1, GL_SPECULAR,  light1_specular);
	glLightfv(GL_LIGHT1, GL_POSITION, light1_position);
	//enable light1
	glEnable(GL_LIGHTING);
	glEnable(GL_LIGHT1);
	//enable fog
	
	
		GLfloat fogColor[4] = {0.7, 0.7, 0.7, 1.0};

		GLint fogMode = GL_LINEAR;
		glFogi(GL_FOG_MODE, fogMode);
		glFogfv(GL_FOG_COLOR, fogColor);
		glFogf(GL_FOG_DENSITY, 0.30);
		glHint(GL_FOG_HINT, GL_DONT_CARE);
		glFogf(GL_FOG_START, 0.0f);
		glFogf(GL_FOG_END, 5.0f);
	glEnable(GL_FOG);
	SetupWorld();
	//init_wall();


	//open a file for debugging out put.
//#ifdef G_DEBUG
//	debug_out.open("debug.txt");
 
Again big shout out to NEHE and friends for getting me started on OPENGL! Thank you!
Sorry, forgot my system spec:

PIII 500
Voodoo3 2000 driver few month old, damn I knew I should have gotten the latest driver...going to try that.
Advertisement
In all honesty, It sounds like a driver issue to me. I have a V3 3000 and it wouldn''t display fog at one point in time. I have since updated the driver, and now fog works fine. 3Dfx is doing a great job of updating their drivers, each new release adds lots of new features. Check and see if that is the problem. If you can''t find a driver that works, let me know and I will tell you what driver it is that I''m using with the Voodoo 3.

Sorry I couldn''t be more help.


Change your fog mode from GL_LINEAR to GL_EXP or GL_EXP2.
I''ve had trouble with the silly Voodoo cards. Make sure you have the latest version of DirectX too. ( Yes I know that doesn''t make sense for openGL but it helped me ).
fs

http://www.CornflakeZone.com
//-- Modelling and animation in every dimension --//
fshana, someone once said that OpenGL actually sorta used DirectX. I don''t know if it is true, but if it is, then I can see why updating DirectX could help out your OpenGL progs.

-Blackstream

Mongo only pawn in game of life.
-Blackstream Will you, won't you, will you, won't you, won't you take my virus?-The Mad HackerBlackstream's Webpage
Advertisement
Thanks! But it is still not working

Got back from class, I tried to download the newest 3Dfx driver, while downloading i opend msvc 6 and ran my program (what happened next could''ve effected my driver, at this point I''m superstious) right then my connection was reset. My program ran(not with the new driver installed yet, remember the download thingy crashed) with FOG, but it was so slow I got something like 3 - 4 frames per second !!! WTH! So I said to myself it must be the driver, so I downloaded the driver again(successfully), ran it, installed it. Pefect except my program was still too slow. After much cursing, feet stomping, and renaming opengl.dll and opengl32.lib (renaming those 2 files then running my program which resulted in file not found, then rename them back to opengl.dll and 32.dll) I finally got my program running fast again, except without FOG!!!

Am I going nuts? Seeing things maybe?!!

I will download the latest DX, tho I don''t know if this will work. I mean I have DX7 unless having the LATEST version is a must. Worth a try tho.

Also whatsup with 3dfxogl.dll driver? It''s not in my system directory but in a temp dir. WTF? Can I download the opengl from 3Dfx? Going to check that out.

Thanks for tha help people!



It works if I disable GL_TEXTURE_2D. Strange?

Blackstream, that person didnt know what the hell he was talking about. OpenGL does NOT at all use DirectX. For one thing, OpenGL was made long before DirectX was even thought of.

-Snyper
=============================Where's the 'any' key?=============================
I just thought of another thing. OpenGL will work on dang near ANY OS. Whereas DirectX will only work for windows. Thats kind of a shame you know? I would like to be able to use DirectX on other Os''s too.

-Snyper
=============================Where's the 'any' key?=============================

This topic is closed to new replies.

Advertisement