Thread: OpenGL question..

  1. #1
    The Defective GRAPE Lurker's Avatar
    Join Date
    Feb 2003
    Posts
    949

    OpenGL question..

    I'm trying to create a buncha green lines in my DrawGLScene() function, and it compiles fine, but when I run it, it errors. What's wrong? (I included whole file if needed):

    Code:
    int DrawGLScene(GLvoid) {
    	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    	glLoadIdentity();
    	gluLookAt(0, 1.5f, 6, 0, 1.5f, 0, 0, 1, 0);
    	glColor3f(0.0f, 1.0f, 0.0f);
    	for(float i = -50; i < 51; i++) {
    		glBegin(GL_LINES);
    		glVertex3f(-50, 0, i);
    		glVertex3f(50, 0, i);
    		glVertex3f(i, 0, -50);
    		glVertex3f(i, 0, 50);
    		glEnd();
    	}
    	return true;
    }
    Do not make direct eye contact with me.

  2. #2
    30 Helens Agree neandrake's Avatar
    Join Date
    Jan 2002
    Posts
    640
    ok, you need to add the libraries to the project, easiest way is this (put in before your #includes):

    Code:
    #pragma comment(lib, "opengl32.lib")
    #pragma comment(lib, "glu32.lib")
    Environment: OS X, GCC / G++
    Codes: Java, C#, C/C++
    AOL IM: neandrake, Email: neandrake (at) gmail (dot) com

  3. #3
    The Defective GRAPE Lurker's Avatar
    Join Date
    Feb 2003
    Posts
    949
    It COMPILES fine, and I have compiled programs with polygons / lines / rectangles before.
    Do not make direct eye contact with me.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. OpenGL Question
    By Halo3Master in forum Game Programming
    Replies: 16
    Last Post: 10-02-2007, 02:40 AM
  2. Opengl question
    By Shadowwoelf in forum Windows Programming
    Replies: 3
    Last Post: 06-03-2007, 01:21 PM
  3. OpenGL Camera Question
    By Astra in forum Game Programming
    Replies: 2
    Last Post: 03-25-2007, 01:53 PM
  4. OpenGL Question
    By Shamino in forum C++ Programming
    Replies: 5
    Last Post: 05-05-2005, 02:35 PM
  5. OpenGL and Windows
    By sean345 in forum Game Programming
    Replies: 5
    Last Post: 06-24-2002, 10:14 PM