Jump to content
  • Advertisement
Sign in to follow this  
ade-the-heat

OpenGL fog extension problem

This topic is 5122 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 already use glFogCoordpointerEXT and it works fine. So I wanted to use also glFogCoordfEXT and it doesn't work at all. Here's my code: float fogColor[4] = {0.8f, 0.8f, 0.8f, 1.0f}; glEnable(GL_FOG); // Turn on fog glFogi(GL_FOG_MODE, GL_LINEAR); // Set the fog mode to LINEAR glFogfv(GL_FOG_COLOR, fogColor); // Give OpenGL our fog color glFogf(GL_FOG_START, 0.0f); // Set the start glFogf(GL_FOG_END, 500.0f); fogVal=400.0f; DrawCube(); //draw cube below is in a display list glBegin(GL_QUADS); glNormal3f(0.0, 0.0, 1.0); glFogCoordfEXT(fogVal); glTexCoord2f(0.0f, 0.0f); glVertex3f(0.0f, 0.0f, 0.0f); // front face glFogCoordfEXT(fogVal); ..etc for other vertices and faces in the cube glEnd();

Share this post


Link to post
Share on other sites
Advertisement
did u try glGetError()?
if theres no errors post the code of the pointer version.
are u setting up the extensions correctly?

Share this post


Link to post
Share on other sites
Hi
Yep -I checked the errors - there's none, I checked the pointer was correct and it was- so here's how I get the extension:

char *extList = (char *) glGetString(GL_EXTENSIONS);
if (extList && strstr(extList, "GL_EXT_fog_coord"))
{
fogEnabled = true;
//get the address
glFogCoordfEXT = (PFNGLFOGCOORDFEXTPROC)wglGetProcAddress
("glFogCoordfEXT ");

I check the pointer and it's valid.
This is really annoying !
I can't think what I've done wrong.

Share this post


Link to post
Share on other sites
Pointer version:

//get pointer
if (extList && strstr(extList, "GL_EXT_fog_coord"))
{
glFogCoordPointerEXT = (PFNGLFOGCOORDPOINTEREXTPROC) wglGetProcAddress
("glFogCoordPointerEXT");
}



//use:
glFogi(GL_FOG_COORDINATE_SOURCE_EXT, GL_FOG_COORDINATE_EXT);
glEnableClientState(GL_FOG_COORDINATE_ARRAY_EXT);
glFogCoordPointerEXT(GL_FLOAT, 0, m_fogArray);


is that helpful ?

Share this post


Link to post
Share on other sites
it should work, u realise with fog_coords that u have to do the depth calculations yourslef unlike normalfog, so opengl knows how much to fog a vertex. personally i found the extension to much of a hasslle for little gain

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!