• 大小: 9.62MB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2023-10-17
  • 语言: 其他
  • 标签: opengl  3D  obj  贴图  

资源简介

添加附加依赖库,和模型图片资源,以及模型obj文件。使用opengl库3d呈现以及贴图。obj文件初步解析

资源截图

代码片段和文件信息

#if 1


#include 
#include 
#include “MainWnd.h“
#include 
#include “atltypes.h“

CMainWnd * pCMainWnd = NULL;

void display(void)
{
    pCMainWnd->DrawScene();
}

void spinDisplay(int )
{
    pCMainWnd->m_fAngleY+=0.1;
    glutPostRedisplay();
}

void reshape(int w int h)
{   
    pCMainWnd->reshape(w h);
    glutPostRedisplay();
}

void mouse(int button int state int x int y)
{
    //printf(“b:%d s:%d\n“ button state);
    pCMainWnd->DrawScene();
    switch (button){
        // 鼠标事件捕获,进行交互
    case GLUT_LEFT_BUTTON:
        if (state == GLUT_DOWN)
        {
            pCMainWnd->SetPoint(POINT2(x y) true);
        }
        break;
    case 3:
        pCMainWnd->AddYU(-1);
        break;
    case 4:
        pCMainWnd->AddYU(1);
        break;

    case GLUT_RIGHT_BUTTON:
        if (state == GLUT_DOWN)
        {
            //glutIdleFunc(spinDisplay);           
            pCMainWnd->SetPoint(POINT2(x y) false);
        }
            
        break;
    default:
        break;
    }
}

void mouseMove(int x int y)
{
    pCMainWnd->mouseMove(x y);
}

int main(int argc char** argv)
{
    glutInit(&argc argv);
    glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA | GLUT_DEPTH);
    glutInitWindowSize(500 500);
    glutInitWindowPosition(100 100);
    glutCreateWindow(“gl3D_test“);

    pCMainWnd = new CMainWnd();
    pCMainWnd->InitScene();

    glutDisplayFunc(display);
    glutReshapeFunc(reshape);
    glutMouseFunc(mouse);
    //glutTimerFunc(100 spinDisplay 100);
    glutMotionFunc(mouseMove);
    glutMainLoop();
    return 0;
    /* ANSI C requires main to return int. */
}
#endif

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     文件        1781  2018-12-13 17:52  GL3D\main.cpp
     目录           0  2018-12-13 17:48  GL3D\
     文件       15506  2018-12-13 17:07  GL3D\MainWnd.cpp
     文件        2577  2018-12-13 17:08  GL3D\MainWnd.h
     目录           0  2018-12-13 17:45  GL3D\libs\
     目录           0  2018-12-13 17:45  GL3D\libs\Demo\
     目录           0  2018-12-13 17:45  GL3D\libs\Demo\Block\
     文件       18952  2010-07-03 13:19  GL3D\libs\Demo\Block\Block.cpp
     文件      196652  2010-03-20 19:17  GL3D\libs\Demo\Block\Block4.tga
     文件      196652  2010-03-20 19:17  GL3D\libs\Demo\Block\Block5.tga
     文件      196652  2010-03-20 19:17  GL3D\libs\Demo\Block\Block6.tga
     文件      196652  2010-03-20 19:17  GL3D\libs\Demo\Block\floor.tga
     目录           0  2018-12-13 17:45  GL3D\libs\freeglut\
     目录           0  2018-12-13 17:45  GL3D\libs\freeglut\freeglut\
     文件        1466  2013-05-11 11:20  GL3D\libs\freeglut\freeglut\Copying.txt
     文件        5065  2015-07-22 08:47  GL3D\libs\freeglut\freeglut\Readme.txt
     目录           0  2018-12-13 17:45  GL3D\libs\freeglut\freeglut\bin\
     文件      198656  2015-03-15 14:28  GL3D\libs\freeglut\freeglut\bin\freeglut.dll
     目录           0  2018-12-13 17:45  GL3D\libs\freeglut\freeglut\bin\x64\
     文件      235008  2015-03-14 16:02  GL3D\libs\freeglut\freeglut\bin\x64\freeglut.dll
     目录           0  2018-12-13 17:45  GL3D\libs\freeglut\freeglut\include\
     目录           0  2018-12-13 17:45  GL3D\libs\freeglut\freeglut\include\GL\
     文件         703  2015-03-14 15:34  GL3D\libs\freeglut\freeglut\include\GL\freeglut.h
     文件       10682  2015-03-14 15:34  GL3D\libs\freeglut\freeglut\include\GL\freeglut_ext.h
     文件       27470  2015-07-22 08:45  GL3D\libs\freeglut\freeglut\include\GL\freeglut_std.h
     文件         660  2015-03-14 15:34  GL3D\libs\freeglut\freeglut\include\GL\glut.h
     目录           0  2018-12-13 17:45  GL3D\libs\freeglut\freeglut\lib\
     文件       39732  2015-03-14 15:19  GL3D\libs\freeglut\freeglut\lib\freeglut.lib
     目录           0  2018-12-13 17:45  GL3D\libs\freeglut\freeglut\lib\x64\
     文件       36518  2015-03-14 15:24  GL3D\libs\freeglut\freeglut\lib\x64\freeglut.lib
     文件      210806  2017-04-15 14:51  GL3D\libs\freeglut\freeglut-MSVC-3.0.0-2.mp.zip
............此处省略1227个文件信息

评论

共有 条评论