Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


Enabling fog gives no fog or lights!

This topic is 5882 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I've got a basic heightmap that i've generated to test out a few openGL basics, and managed to get coords, colours and normals generated properly. However i've got a few problems: When i enable lighting, the light works correctly, but the vertex colours are now ignored How do i set openGL to blend the vertex and light colours when rendering? Light setup:
(ambient/diffuse are dark/light grey, position is updating correctly)
	gl.lightfv(GL.LIGHT1, GL.AMBIENT, pAmbient);
	gl.lightfv(GL.LIGHT1, GL.DIFFUSE, pDiffuse);
	gl.lightfv(GL.LIGHT1, GL.POSITION,pPosition);
Even more oddly, when i try and enable fog, the light dissapears, and theres no fog drawn either. Even the fog colour (white) is nowhere to be seen. (note, just tried this without lights and it seems to kill the heighmap to black regardless). Fog setup:
	FloatBuffer fogBuffer = createFloatBuffer(4);
	fogBuffer.put(new float[] {1.0f, 1.0f, 1.0f, 1.0f} );
	int pFogColour = Sys.getDirectBufferAddress(fogBuffer);
	gl.fogi(GL.FOG_MODE, GL.EXP);
	gl.fogf(GL.FOG_DENSITY, 0.35f);
	gl.fogf(GL.FOG_START, 1f);
	gl.fogf(GL.FOG_END, 5f);
	gl.hint(GL.FOG, GL.DONT_CARE); // This might be the reason, i've no idea its just from the Red Book..

	gl.fogf(GL.FOG_COLOR, pFogColour);
Any pointers appreciated [edited by - OrangyTang on September 10, 2002 2:33:54 PM]

Share this post

Link to post
Share on other sites
int pFogColour = Sys.getDirectBufferAddress(fogBuffer);
gl.fogf(GL.FOG_COLOR, pFogColour);

int + float !!

also start+end is for linear
exp + exp2 is for density


Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!