Working Broken

Posts: 102
Joined: 2005.01
Post: #1
why wont this GLUT/GL thingy work?

#include <stdlib.h>

#include <GLUT/glut.h>

void display(void)

        glColor3f(0.5f , 0.5f, 0.8f);
        glVertex3f( 0.0f, 1.0f, 0.0f);
        glColor3f(0.5f , 0.8f, 0.5f);
        glVertex3f(-1.0f,-1.0f, 0.0f);
        glColor3f(0.8f , 0.5f, 0.5f);
        glVertex3f( 1.0f,-1.0f, 0.0f);                        
    glColor3f(1.0f, 0.5f, 0.5f);
        glVertex3f(-1.0f, 1.0f, 0.0f);                          
        glVertex3f( 1.0f, 1.0f, 0.0f);                          
        glVertex3f( 1.0f,-1.0f, 0.0f);                          
        glVertex3f(-1.0f,-1.0f, 0.0f);                          

void reshape(int width, int height)
    glViewport(0, 0, width, height);

void idle(void)

int main(int argc, char** argv)
    glutInit(&argc, argv);
    glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_DEPTH);
    glutInitWindowSize(640, 480);
    glutCreateWindow("Some Drawings n' Stuff");
    return EXIT_SUCCESS;

it draws a blank window. i want it to draw a quad and trianlge

edit:fixed it (the problem is in the display func anyway)
Quote this message in a reply
Posts: 567
Joined: 2004.07
Post: #2
we need all of the code.

It's not magic, it's Ruby.
Quote this message in a reply
Posts: 102
Joined: 2005.01
Post: #3
fixed the code (and by that i mean the code here is the same as i have.. althought it doesnt work!)

it draws a black square
Quote this message in a reply
Posts: 5,143
Joined: 2002.04
Post: #4
as discussed on IRC, you're drawing things outside of OpenGL's default coordinate system. Either change where you're drawing your objects, or change the coordinate system.
Quote this message in a reply
Post: #5
In your reshape() routine, you haven't set up your camera.
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  VBO broken in MacOS 10.4 execomrt 3 3,925 Sep 27, 2005 05:28 AM
Last Post: TomorrowPlusX
  Vertex Shaders broken in 10.2.5? Bossa Nova 2 2,913 Apr 30, 2003 07:44 AM
Last Post: Bossa Nova
  Is GLUT broken in 10.2.4? OSXRules 1 2,507 Apr 4, 2003 01:06 PM
Last Post: blb