Simple OpenGL Problem (easy points)

woodra
woodra used Ask the Experts™
on
I am trying desperately to compile a simple OpenGL program on my Win2000 machine using Microsoft Visual Studio 6.0 , but I am getting "Unresolved External Symbol errors" for every function that is included in the glut.h file.  I have included everything, yet I can't get it to run. Am i missing a library or something? HELP!

here is a copy of a simple OpenGL program that I cannot get running.

#include <GL/glut.h>

void reshape(int w, int h)
{
  glViewport(0, 0, w, h);
  glMatrixMode(GL_PROJECTION);
  glLoadIdentity();
  glOrtho(0, w, 0, h, -1, 1);
  glScalef(1, -1, 1);
  glTranslatef(0, -h, 0);
}

void display(void)
{
  glClear(GL_COLOR_BUFFER_BIT);
  glBegin(GL_TRIANGLES);
    glColor3f(0.0, 0.0, 1.0);  /* blue */
    glVertex2i(0, 0);
    glColor3f(0.0, 1.0, 0.0);  /* green */
    glVertex2i(200, 200);
    glColor3f(1.0, 0.0, 0.0);  /* red */
    glVertex2i(20, 200);
  glEnd();
  glFlush();  /* Single buffered, so needs a flush. */
}

int main(int argc, char **argv)
{
  glutInit(&argc, argv);
  glutCreateWindow("single triangle");
  glutDisplayFunc(display);
  glutReshapeFunc(reshape);
  glutMainLoop();
  return 0;
}
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Author

Commented:
I am on AIM until 4:00 Nov. 16 under username richy79 if you can help.

Commented:
where is your glut.h located? Make sure have it under GL/ folder or else get rid of the GL in # include GL/glut.h

vemul

Author

Commented:
my glut.h is in the right place... it was the libraries i forgot to add.... but now i can't get the program to display a simple jpg.
Ensure you’re charging the right price for your IT

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

Commented:
you can use the Developer's Image Library (DevIL) instead at

http://sourceforge.net/projects/openil

it's open-source.

Commented:
There's nothing wrong with your code except forgetting to add the libraries. It does what it's supposed to do which is display a simple triangle on screen. There's nothing in the code you posted to display a jpg.

If you are referring to some other code you are writing now please post it for comments.

Author

Commented:
good point kooheji....

I don't know where to begin to add a jpg... the DevIL link that nomad suggested is giving me zip files that i can't open(for some reason they are all the same size and will not open in WinZip). i just want to know how to display a jpeg( like a map of California) and maybe later, create objects to move around on it. OR... if anyone can think of something easier than openGL, that would be cool, too.

Commented:
maybe it would help if you posted your questions under:

http://www.experts-exchange.com/Programming/Game_Development/Game_Graphics/OpenGL/

vemul

Author

Commented:
thanks
Commented:
If you still want to learn and do it using OpenGL I recommend http://nehe.gamedev.net/ for excellent tutorials. It wouldn't make sense though to use OpenGL for 2D graphics. I'll answer your question in your other post http://www.experts-exchange.com/Programming/Game_Development/Game_Graphics/OpenGL/Q_20400606.html

Author

Commented:
kooheji, that site ROCKS! thanks a million

Author

Commented:
kooheji, could you answer one more Question on the other page...  does your other option allow me to read in a matrix from a text file, store it, and use the coordinates stored in the matrix to move multiple entities around the map?

http://www.experts-exchange.com/Programming/Game_Development/Game_Graphics/OpenGL/Q_20400606.html 

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial