Results 1 to 5 of 5

Thread: sourcecode for a box (NewB)

  1. #1
    Junior Member Newbie
    Join Date
    May 2001
    Posts
    10

    sourcecode for a box (NewB)

    I have a little sourcecode to create a box:

    void Box(GLfloat scale) {
    glBegin(GL_QUADS);

    glVertex3f (-scale, scale,-scale);
    glVertex3f ( scale, scale,-scale);
    glVertex3f ( scale,-scale,-scale);
    glVertex3f (-scale,-scale,-scale);

    glVertex3f (-scale, scale, scale);
    glVertex3f ( scale, scale, scale);
    glVertex3f ( scale,-scale, scale);
    glVertex3f (-scale,-scale, scale);

    glVertex3f (-scale, scale,-scale);
    glVertex3f (-scale, scale, scale);
    glVertex3f (-scale,-scale, scale);
    glVertex3f (-scale,-scale,-scale);

    glVertex3f ( scale, scale,-scale);
    glVertex3f ( scale, scale, scale);
    glVertex3f ( scale,-scale, scale);
    glVertex3f ( scale,-scale,-scale);

    glVertex3f (-scale,-scale,-scale);
    glVertex3f (-scale,-scale, scale);
    glVertex3f ( scale,-scale, scale);
    glVertex3f ( scale,-scale,-scale);

    glVertex3f (-scale, scale,-scale);
    glVertex3f (-scale, scale, scale);
    glVertex3f ( scale, scale, scale);
    glVertex3f ( scale, scale,-scale);
    glEnd();
    }

    but when i want to start it with
    putPurple(0.4);
    my Programm crashes, can someone help me?

  2. #2
    Senior Member Regular Contributor
    Join Date
    May 2001
    Location
    Germany, Hannover
    Posts
    160

    Re: sourcecode for a box (NewB)

    try to draw a single triangle, quad, maybe you havent initialized opengl correctly ( wrong defined vertices etc. only produce opengl intern errors )

  3. #3
    Senior Member Regular Contributor
    Join Date
    Jun 2000
    Location
    B.C., Canada
    Posts
    367

    Re: sourcecode for a box (NewB)

    What does putPurple(0.4) do? And why do I feel as if this is a joke?

    j

  4. #4
    Junior Member Newbie
    Join Date
    May 2001
    Posts
    10

    Re: sourcecode for a box (NewB)

    sorry, I wrote purpleBox. Because first i wanted to create more colors, and it was an other procedure. (is it the correct english word???)

    It must be box(0.4).
    I have initialized opengl correctly, becase i can render other thing without any problems.

    (sorry for my bad English)

  5. #5
    Senior Member Regular Contributor
    Join Date
    May 2001
    Location
    Germany, Hannover
    Posts
    160

    Re: sourcecode for a box (NewB)

    it seems that the code is ok, so search for other errorsurces, maybe you call this function after a glBegin(...), remove glBegin(..) and glEnd() in this function, if it works you have called glBegin before this functioncall and this causes the crash, or you call this function from a thread, which isn't the one with the renderingcontext ...

Similar Threads

  1. can not superbible sourcecode in windows xp
    By Tony Purba in forum OpenGL: Basic Coding
    Replies: 0
    Last Post: 04-04-2012, 10:54 PM
  2. Problems with superbible sourcecode
    By cutcha in forum OpenGL: Basic Coding
    Replies: 4
    Last Post: 03-05-2012, 12:28 AM
  3. glu sourcecode where to get it from?
    By doodlemunch in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 12-06-2005, 08:14 AM
  4. Loading shader-sourcecode
    By McRip in forum OpenGL: Linux
    Replies: 9
    Last Post: 01-03-2005, 09:34 AM
  5. Winamp-plugin with sourcecode
    By imported_Marc in forum OpenGL: Basic Coding
    Replies: 0
    Last Post: 12-18-2001, 06:32 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean