fog extension problem

Started by
4 comments, last by zedzeek 19 years, 4 months ago
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();
Advertisement
did u try glGetError()?
if theres no errors post the code of the pointer version.
are u setting up the extensions correctly?
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.
post the code of the pointer version (that works)
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 ?
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

This topic is closed to new replies.

Advertisement