注册 登录
编程论坛 C图形专区

opengl初学者求助,程序运行失败

anwww12 发布于 2008-10-11 14:08, 1361 次点击
#include<windows.h>
#include<GL/gl.h>
#include<GL/glaux.h>
void CALLBACK display(void)
{
    static float a=30.0;
    glClearColor(1.0,1.0,1.0,0.0);
    glClear(GL_COLOR_BUFFER_BIT|GL_STENCIL_BUFFER_BIT);
    glColor3f(0.3f,0.7f,1.0f);
    glLoadIdentity();
    glTranslatef(0.0,0.0,-20.0);
    glRotatef(a,0.0,0.0,1.0);
    auxWireTeapot(1.0);    
    glFlush();
    auxSwapBuffers();
    a=a+10.0f;
    
}
void myinit(void)
{
    glShadeModel(GL_FLAT);
}
void CALLBACK myReshape(int w,int h)
{
    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    glFrustum(-1.0,1.0,-1.0,1.0,1.5,20.0);
    glMatrixMode(GL_MODELVIEW);
    glViewport(0,0,w,h);
}
void main(int argc,char** argv)
{
    auxInitDisplayMode(AUX_DOUBLE|AUX_RGB);
    auxInitPosition(0,0,125500,950);
    auxInitWindow(argv[0]);
    myinit();
    auxReshapeFunc(myReshape);
    auxMainLoop(display);
}
程序实现茶壶旋转,运行后出现茶壶,但没有旋转,请高手看看哪里出错了
2 回复
#2
starrysky2008-10-13 18:28
嘿嘿,你把你生成的图像窗口的边框拉一拉,改变一下大小,看看那壶转不转?
#3
anwww122008-10-14 12:22
那怎样不用拖动窗口,让它自己转动
1