Hi, my name is Danny and I am very new to Visual C++ and OpenGL. I began using NeHe's tutorials and everything was going great. Later, I wanted to try some clipping so I transfered this code from OpenGL Programming Guide (the red book, pg 107):

After trying to resolve these problems and making sure I linked the appropriate libraries(OpenGL32.lib GLu32.lib GLaux.lib), I placed the above code in a newly downloaded NeHe tutorial and I got the same errors. Now everything I compile in Visual C++ is incurring the same errors, whether they are simple programs I wrote or tutorials I downloaded!!

I would greatly appreciate some assistance regarding this issue, thanks and have a great day!!

Danny

Relic

06-22-2006, 12:56 AM

Hardly an advanced question. You should have used the beginner's forum.

Is this the whole program code?
If yes, something is severly broken with your project.
It lists GLUT errors but you use the AUX library and have no glut.h included at all.
And if you have a glut.h somewhere it might be old or corrupted.
The aux library is out of date anyway, you should move to GLUT.
http://www.opengl.org/resources/libraries/glut/

There is at least one error in your code which should not compile:
glRotate() doesn't exist, it's either glRotatef() or glRotated()

Looks like your sphere will be clipped by the zNear plane, try glTranslatef(0.0f, 0.0f, -5.0f) instead of -0.5.

Mind, the user clipping planes are transformed by the current modelview matrix, so that glTranslatef() affects them where you put it.

gluPerspective() takes doubles.

wile_spice

06-22-2006, 09:11 AM

Thanks alot!! Yea I guessed that, but I haven't been having much luck solving the errors so I decided that more advanced users would provide better help.
Yes this is the entire code, I added the glut files to the VC++ folders per the ReadMe file. I tried adding the glut header file but it didn't make a difference. I don't know how to modify the code enough to take out the aux references, could you tell me of a website that may help me with that? I was told to add a return 0 or return TRUE, this didn't help. I change what you suggested but the amount of errors didn't decrease. Thanks for your advice!!! :) When you say that gluPerspective() takes doubles do you mean that I should've written gluPerspective4d(),still no changes. This is the modified code:

glColor3f(1.0f,1.0f,1.0f); // sets color to white
glPushMatrix(); // this pushes the current matrix stack down by one, duplicating the current matrix
glTranslatef(0.0f,0.0f,-5.0f); // this moves the current view matrix 5 units deeper into the screen

glRotatef(90.0f,1.0f,0.0f,0.0f); // rotates object 90 degrees on the X axis (ie it moves up and down away from the viewer)
auxWireSphere(1.0); // draws a wire sphere with a diameter of 1?
glPopMatrix(); // pops the current matrix stack, replace the current matrix with the one below it on the stack
glFlush(); // empties all the buffers causing all issued commands to execute in finite time (as quickly as they're accepted by the actual rendering engine)

}
// closes the display(void) function

void myinit(void)
{
glShadeModel(GL_FLAT); // this selects which type of shading is used (Flat shading selects the computed color of one vertex and assigns it to the entire object)

int main(int argc, char** argv)
{
auxInitDisplayMode(AUX_SINGLE | AUX_RGBA); // tells auxInitWindow to create a RGBA and a single buffered window
auxInitPosition(0,0,500,500); // tells auxInitWindow where to position a window on the screen
auxInitWondow(argv[0]); // opens a window with the characteristics specificied by the two previous commands, the string argv appears in the title window)
myinit(); // calls the myinit() function above
auxReshapeFunc(myReshape); // specifies the function that is called when the window is resized( in this case the myReshape() function), moved or exposed. the arguement is a pointer to a function that expects 2 parameters
auxMainLoop(display); // specifies the function that's called when the window needs to be updated. This function should redraw the objects on the screen

return TRUE;
}

Relic

06-22-2006, 10:22 AM

Sorry, you misunderstood.
What I wanted to say is, wipe aux calls and headers from your project, download the GLUT library from where it lies on OpenGL.org, and rewrite your code like this using only GLUT.
You need to add the glut32.lib to your projects link libraries and the glut32.dll into the applications folder.

This is one of the simplest GLUT applications I have with your clip planes added (though untransformed).

return 0;
}Build this, run it, and see a quarter wire sphere in the top right quadrant.

When I said gluPerspective takes GLdouble I meant you should cast the integers w and h to that.

wile_spice

06-22-2006, 11:42 AM

ahhhh, same problems, I feel like I'm about to have an epileptic fit!!! Could it be possible that I corrupted the VC++ when I wrote that code because every program I build and compile is telling me it has 102 error, errors with the glaux library and I didn't even include it!!
I suspect you tested that code before you gave it to me and that it worked for you so I don't understand whats going on!

sqrt[-1]

06-22-2006, 06:47 PM

Perhaps you have made a mistake and edited your gl.h/glu.h/glut.h header files?

Perhaps when you had a compile error, you went to the line of the error (in one of these header files) and edited it manually?

wile_spice

07-06-2006, 10:59 AM

Sorry this took so long... I don't remember going to the code for the libraries until after I got these errors, but.... stuff happen and this is such a weird problem (ie I am getting errors for a library that I didn't include) so I decided to reinstall vc++ and see if that helps! Thanks alot to everyone who helped!!