First of all, hello everyone. Been searching for a place of assistance for some time now.
My dilemma... I am trying to use the sin() function to modify a simple mesh (a giant quad made of a single degenerative triangle strip. Uses OpenGL, and is an indexed vertex array). I am wishing to loop through and make the mesh look wavy, similar to a sine wave. Unfortunately for me, things are going awry. If I use sin() to modify a single vertex, I can see some change though it sort of jumps and flickers. However, if I try to loop through the vertices, the entire mesh disappears. My default mesh is 40x40, but I made it easily modifiable and changed it to a 4x4, still experiencing the same issue.
Running the debugger, I find that after 5 or 6 iterations, the value that the function returns becomes -1.#IND000
I've tried several different inputs into the function, and it always starts returning the above value after 5 or 6 iterations. I've never really worked with the sin() function before, and am lost as to what that value means.
I know the following will not give me axactly what I need... in fact, it SHOULD modify all the values in the mesh the exact same way, giving me the appearance of a bouncing mesh. At current, the first 5 times returns 1.065..... etc, which is a decent number. I'm trying to keep with smaller values so that the verts stay in view. Current vert count is 100, which uNumPoints is equal to, in case it matters. The mesh does draw if I do not use the sin() function. I believe the -1.#IND000 is messing things up.
Also, just in case it lies here, which I doubt, but never know... my drawing is done here.
void ShaderApplyBehavior (Int32 iShaderIdx, Float32 pPoints[NUMVERTS], Uint32 uNumPoints)
static float ftime = 0.0f;
ftime += 0.01f;
if(ftime > 1.0f)
ftime = -1.0f;
for(i = 0; i < uNumPoints; i++)
deltaZ = (float)sin(ftime) * 0.000000001f;
pPoints[i] = deltaZ;
Thanks in advance for any advice or suggestions you may have. I am utterly stuck until I get at least some functionality from the sin() function.
Int32 i = 0;
Int32 j = 0;
glColor3f(1.0f, 1.0f, 1.0f);
ShaderBegin(0); // <- This function currently sets culling based on the parsed shader script. Culling is currently off.
ShaderApplyBehavior(0, &vdata, totalVerts); // <- The above function.
glTranslatef(0.0f, 0.0f, -70.0f);
glRotatef(45.0f, -1.0f, 0.0f, 0.0f);
glRotatef(25.0f, 0.0f, 1.0f, 0.0f);
glVertexPointer(3, GL_FLOAT, 0, vdata);
glDrawElements(GL_TRIANGLE_STRIP, vertsStored, GL_UNSIGNED_INT, floorMesh);