Working Broken
why wont this GLUT/GL thingy work?
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)
Code:
#include <stdlib.h>
#include <GLUT/glut.h>
void display(void)
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glLoadIdentity();
glTranslatef(-1.5f,0.0f,-6.0f);
glBegin(GL_TRIANGLES);
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);
glEnd();
glTranslatef(3.0f,0.0f,0.0f);
glColor3f(1.0f, 0.5f, 0.5f);
glBegin(GL_QUADS);
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);
glEnd();
glutSwapBuffers();
}
void reshape(int width, int height)
{
glViewport(0, 0, width, height);
}
void idle(void)
{
glutPostRedisplay();
}
int main(int argc, char** argv)
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_DEPTH);
glutInitWindowSize(640, 480);
glutCreateWindow("Some Drawings n' Stuff");
glutDisplayFunc(display);
glutReshapeFunc(reshape);
glutIdleFunc(idle);
glutMainLoop();
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)
we need all of the code.
It's not magic, it's Ruby.
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
it draws a black square
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.
Possibly Related Threads...
| Thread: | Author | Replies: | Views: | Last Post | |
| VBO broken in MacOS 10.4 | execomrt | 3 | 2,939 |
Sep 27, 2005 05:28 AM Last Post: TomorrowPlusX |
|
| Vertex Shaders broken in 10.2.5? | Bossa Nova | 2 | 2,259 |
Apr 30, 2003 07:44 AM Last Post: Bossa Nova |
|
| Is GLUT broken in 10.2.4? | OSXRules | 1 | 1,789 |
Apr 4, 2003 01:06 PM Last Post: blb |
|

