PDA

View Full Version : Nothing showing on screen



bluekrill
06-28-2011, 03:16 AM
Ok I am an absolute OpenGL newbie..and I am sure the problem is something stupid..but I cannot for the life of me figure out what is wrong...I installed OpenGL fine..got a sample program to run as well...then I created a new project..am using Microsoft Visual C++ express...and wrote some code to draw some basic shapes in a window...but nothing is turning up inside the window..also the program is showing a stream of .dlls that are either not there or are not opening..I checked the folders and all the .dlls are there...but somehow they are not opening..I don't know if this is related..coz the sample program was working just fine...despite these errors...the code within main is


glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);
glutInitWindowSize(400, 400);

glutCreateWindow("Basic shapes Tut");
initRendering();

glutDisplayFunc(drawScene);
glutKeyboardFunc(handleKeypress);
glutReshapeFunc(handleResize);

glutMainLoop();
return 0;


drawScene contains:



glClear(GL_COLOR_BUFFER_BIT);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();

glBegin(GL_QUADS);

glVertex3f(-0.7f, -1.5f, -5.0f);
glVertex3f(0.7f, -1.5f, -5.0f);
glVertex3f(0.4f, -0.5f, -5.0f);
glVertex3f(-0.4f, -0.5f, -5.0f);

glEnd();


Wat am I doing wrong?? Any help with an explanation will be greatly appreciated..

Zyx_2000
06-28-2011, 07:11 AM
Don't you have to do a swap buffer call?

MaxH
06-28-2011, 02:49 PM
What do you mean by 'got a sample program to run'? Hopefully it means you started with source code which you successfully compiled and ran. If this is the case, I suggest using that source code as a starting point and making small changes to it (like 1 line of code at a time), until it displays the quad you've defined above.