当前位置: 首页>>代码示例>>C++>>正文


C++ TwInit函数代码示例

本文整理汇总了C++中TwInit函数的典型用法代码示例。如果您正苦于以下问题:C++ TwInit函数的具体用法?C++ TwInit怎么用?C++ TwInit使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了TwInit函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: pos_

fractal_t::fractal_t()
    : pos_(0.5, 0), scale_factor_(1)
{
#ifdef USE_CORE_OPENGL
   TwInit(TW_OPENGL_CORE, NULL);
#else
   TwInit(TW_OPENGL, NULL);
#endif
   // Определение "контролов" GUI
   TwBar *bar = TwNewBar("Parameters");
   TwDefine(" Parameters size='300 50' color='70 100 120' valueswidth=220 iconpos=topleft");

   TwAddButton(bar, "Fullscreen toggle", toggle_fullscreen_callback, NULL,
               " label='Toggle fullscreen mode' key=f");

   // Создание шейдеров
   vs_ = create_shader(GL_VERTEX_SHADER  , "shaders//fractal.glslvs");
   fs_ = create_shader(GL_FRAGMENT_SHADER, "shaders//fractal.glslfs");
   // Создание программы путём линковки шейдерова
   program_ = create_program(vs_, fs_);
   // Создание буфера с вершинными данными
   init_buffer();
   // Создание VAO
   init_vertex_array();
}
开发者ID:Icemore,项目名称:homework,代码行数:25,代码来源:fractal.cpp

示例2: TwInit

void AntTweakBarWrapper::Init()
{
    TwInit(TW_OPENGL, NULL);
    m_control_panel_bar = TwNewBar("Control Panel");
    //TwDefine(" 'Control Panel' size='200 210' position='114 10' color='255 255 255' text=dark ");
    char control_bar_pos_string [255];
    sprintf(control_bar_pos_string, "'Control Panel' position='%d 10' color='255 255 0' ", DEFAULT_SCREEN_WIDTH-210);
    TwDefine(control_bar_pos_string);

    TwAddVarRW(m_control_panel_bar, "Start Simulation", TwType(sizeof(bool)), &(g_start_simulation), " label='Start Simulation' key=s group='Debug Information' help='Toggle simulation mode.'");
    TwAddVarRW(m_control_panel_bar, "Render FP", TwType(sizeof(bool)), &(g_show_render), " label='Render FP' key=w group='Debug Information' help='Toggle render display mode.'");
    TwAddVarRW(m_control_panel_bar, "Wireframe", TwType(sizeof(bool)), &(g_show_wireframe), " label='Wireframe mode' key=w group='Debug Information' help='Toggle wireframe display mode.'");
    TwAddVarRW(m_control_panel_bar, "Edge List", TwType(sizeof(bool)), &(g_show_edgelist), " label='Edgelist mode'  group='Debug Information' help='Toggle edgelist display mode.'");
    TwAddVarRW(m_control_panel_bar, "Line Width", TW_TYPE_FLOAT, &(g_linewidth),"label='Line Width' min=0 max=100 step=0.05  help='line width' group='Debug Information'");
    TwAddVarRW(m_control_panel_bar, "Fixed Vertex", TwType(sizeof(bool)), &(g_show_fixedvertex), " label='Fixed Vertex' key=w group='Debug Information' help='Toggle fixed vertex mode.'");
    TwAddVarRW(m_control_panel_bar, "Point Size", TW_TYPE_FLOAT, &(g_pointsize),"label='Point Size' min=0 max=100 step=0.05  help='Point Size' group='Debug Information'");

    TwAddVarRW(m_control_panel_bar, "Zoom", TW_TYPE_FLOAT, &(cameraDistance),"label='Zoom Mode' min=-30 max=30 step=0.1 keyIncr=z keyDecr=Z help='zoom camera' group='Camera'");

    m_sim_bar = TwNewBar("Simulation Control");
    TwDefine("'Simulation Control' position='0 0' color='255 0 0'");

    TwEnumVal shapeEV[NUM_SIMULATION] = { {PositionBasedDynamic, "Position Based Dynamic"}, {MassSpring, "Mass Spring"}, {FiniteElement, "Finite Element"}, {FastMassSpring, "Fast Mass Spring"}, {ProjectiveDynamic, "Projective Dynamic"} };
    TwType simmethod = TwDefineEnum("simmethod", shapeEV, NUM_SIMULATION);
    TwAddVarRW(m_sim_bar, "Simulation Method", simmethod, &g_CurrentMethod, " keyIncr='<' keyDecr='>' help='Change Simulation Method.' ");
}
开发者ID:apapaxiong,项目名称:openglFrame,代码行数:26,代码来源:UI_warpper.cpp

示例3: TwInit

void SSAO::BuildUI() {
    TwInit(TW_DIRECT3D11, _device);
    TwWindowSize(_screenWidth, _screenHeight);
    _bar = TwNewBar("AmbientOcclusion");
    TwDefine(" GLOBAL help='This example shows how to integrate AntTweakBar into a DirectX11 application.' "); // Message added to the help bar.
    int barSize[2] = {300, 375};
    TwSetParam(_bar, NULL, "size", TW_PARAM_INT32, 2, barSize);

    TwAddVarCB(_bar, "Rad", TW_TYPE_FLOAT, SSAO::SetRad, SSAO::GetRad, this, "group=ShaderParams min=0 max=20 step=0.001 keyincr=+ keydecr=-");
    TwAddVarCB(_bar, "TotalStr", TW_TYPE_FLOAT, SSAO::SetTotStr, SSAO::GetTotStr, this, "group=ShaderParams min=0 max=50 step=0.1 keyincr=+ keydecr=-");
    TwAddVarCB(_bar, "Strength", TW_TYPE_FLOAT, SSAO::SetStrength, SSAO::GetStrength, this, "group=ShaderParams min=0.1 max=100 step=0.1 keyincr=+ keydecr=-");
    TwAddVarCB(_bar, "Offset", TW_TYPE_FLOAT, SSAO::SetOffset, SSAO::GetOffset, this, "group=ShaderParams min=0 max=100 step=0.5 keyincr=+ keydecr=-");
    TwAddVarCB(_bar, "Falloff", TW_TYPE_FLOAT, SSAO::SetFalloff, SSAO::GetFalloff, this, "group=ShaderParams min=0 max=0.01 step=0.00001 keyincr=+ keydecr=-");
    TwAddVarCB(_bar, "BlurSize", TW_TYPE_FLOAT, SSAO::SetBlur, SSAO::GetBlur, this, "group=ShaderParams min=1 max=16 step=1 keyincr=+ keydecr=-");
    TwAddButton(_bar, "Reset", SSAO::ResetButton, this, "");
    TwAddButton(_bar, "ShowDebug", SSAO::ShowDebug, this, "");

    TwEnumVal* a = new TwEnumVal[3];
    a[0].Value = 0; a[0].Label = "buddha";
    a[1].Value = 1; a[1].Label = "hairball";
    a[2].Value = 2; a[2].Label = "sib";
    _index = 0;

    TwType actMesh = TwDefineEnum("mesh", a, 3);

    TwAddVarCB(_bar, "ActiveVol", actMesh, SSAO::SetMesh, SSAO::GetMesh, this, 
        " group='Mesh' keyIncr=Backspace keyDecr=SHIFT+Backspace help='Stop or change the rotation mode.' ");

}
开发者ID:Jake-Baugh,项目名称:screen-space-ambient-occlusion,代码行数:29,代码来源:ssaoEffect.cpp

示例4: main

int main(int argc, char* argv[]) {
    glutInit(&argc, argv);
    glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);
    glutInitWindowSize(windowWidth, windowHeight);
    glutCreateWindow("Versuch1");

    GLenum err = glewInit();
    if (GLEW_OK != err) {
        // Veralteter Treiber etc.
        std::cerr << "Error: " << glewGetErrorString(err) << "\n";
        return 1;
    }

    glutMouseFunc((GLUTmousebuttonfun)TwEventMouseButtonGLUT);
    glutMotionFunc((GLUTmousemotionfun)TwEventMouseMotionGLUT);
    glutPassiveMotionFunc((GLUTmousemotionfun)TwEventMouseMotionGLUT); // same as MouseMotion
    glutKeyboardFunc(Keyboard);

    glutReshapeFunc(ChangeSize);
    glutSpecialFunc(SpecialKeys);
    glutDisplayFunc(RenderScene);

    TwInit(TW_OPENGL, NULL);
    SetupRC();
    glutMainLoop();
    ShutDownRC();

    return 0;
}
开发者ID:HibikiTaisuna,项目名称:CGBV,代码行数:29,代码来源:Versuch1c.cpp

示例5: Init

bool ATB::Init()
{
    bool ret = false;
    
    if (TwInit(TW_OPENGL_CORE, NULL) == 1)
    {
        TwStructMember Vector3fMembers[] = {
            { "x", TW_TYPE_FLOAT, offsetof(Vector3f, x), "" },
            { "y", TW_TYPE_FLOAT, offsetof(Vector3f, y), "" },
            { "z", TW_TYPE_FLOAT, offsetof(Vector3f, z), "" }
        };
        
        TW_TYPE_OGLDEV_VECTOR3F = TwDefineStruct("Vector3f", Vector3fMembers, 3, sizeof(Vector3f), NULL, NULL);

        TwStructMember AttenuationMembers[] = {
            { "Const", TW_TYPE_FLOAT, offsetof(LightAttenuation, Constant), "" },
            { "Linear", TW_TYPE_FLOAT, offsetof(LightAttenuation, Linear), "" },
            { "Exp", TW_TYPE_FLOAT, offsetof(LightAttenuation, Exp), "" }
        };
        
        TW_TYPE_OGLDEV_ATTENUATION = TwDefineStruct("Attenuation", AttenuationMembers, 3, sizeof(LightAttenuation), NULL, NULL);
        
        ret = true;
    }
    
    return ret;
}
开发者ID:LouisParkin,项目名称:LearnOpenGL-nonQt,代码行数:27,代码来源:ogldev_atb.cpp

示例6: initTweakMenu

//---------------CPU Functions---------------//
void initTweakMenu()
{
    if(!TwInit(TW_OPENGL, NULL))
    {
        fprintf(stderr, "AntTwekBar fails to initialize! Info: %s\n", TwGetLastError());
        exit(0);
    }

    bar = TwNewBar("Scene Parameters");
    //Camera attributes
    TwAddVarRW(bar, "View Direction", TW_TYPE_DIR3F, &viewdir, "group = 'Camera Attribute'");
    TwAddVarRW(bar, "Move Speed", TW_TYPE_UINT8, &movespeed, " min = 0 max = 25 step = 1 group = 'Camera Attribute' ");

    TwAddVarRW(bar, "Position x", TW_TYPE_FLOAT, &camera.getPosition().x,
        " min = -100 max = 100 step = 0.01 group = 'Camera Attribute' ");
    TwAddVarRW(bar, "Position y", TW_TYPE_FLOAT, &camera.getPosition().y,
        " min = -100 max = 100 step = 0.01 group = 'Camera Attribute' ");
    TwAddVarRW(bar, "Position z", TW_TYPE_FLOAT, &camera.getPosition().z,
        " min = -100 max = 100 step = 0.01 group = 'Camera Attribute' ");
    
    TwAddVarRW(bar, "Aperture", TW_TYPE_FLOAT, &aperture,
        " min = 0.001 max = 10 step = 0.001 group = 'Camera Attribute' ");
    TwAddVarRW(bar, "Focal", TW_TYPE_FLOAT, &focal,
        " min = 0.0001 max = 0.9999 step = 0.0001 group = 'Camera Attribute' ");
    /*//Light attributes
    TwAddVarRW(bar, "position x", TW_TYPE_FLOAT, &light.getPosition().x,
        " min = -100 max = 100 step = 0.01 group = 'Light Attribute' ");
    TwAddVarRW(bar, "position y", TW_TYPE_FLOAT, &light.getPosition().y,
        " min = -100 max = 100 step = 0.01 group = 'Light Attribute' ");
    TwAddVarRW(bar, "position z", TW_TYPE_FLOAT, &light.getPosition().z,
        " min = -100 max = 100 step = 0.01 group = 'Light Attribute' ");
    //Light color
    TwAddVarRW(bar, "Color", TW_TYPE_COLOR3F, &light.getColor(), "group = 'Light Attribute'");//*/
}
开发者ID:duxing,项目名称:GPUFinal,代码行数:35,代码来源:main.cpp

示例7: AglVector3

bool Game::Initialize()
{
    DX11Application::Initialize();
    ShaderManager::GetInstance()->Initialize(mDevice, mDeviceContext);
    Camera::GetInstance()->Init(AglVector3(0, 0.0f, -2.25f), AglVector3(0, 0.0f, 0), AglVector3(0, 1, 0), mScreenWidth, mScreenHeight);
    TextureManager::GetInstance()->Init(mDevice, mDeviceContext);
    RasterManager::getInstance()->initialize(mDevice, mDeviceContext);

    ParticleStates::Init(mDevice, mDeviceContext);
    
    AGLLoader::GetInstance()->Init(mDevice, mDeviceContext);

    // Initialize AntTweakBar
    if (!TwInit(TW_DIRECT3D11, mDevice))
    {
        MessageBoxA(mWindowHandle, TwGetLastError(), "AntTweakBar initialization failed", MB_OK|MB_ICONERROR);
        Cleanup();
        return 0;
    }
    SceneDialog::GetInstance();


    m_cameraController = new CameraController(mWindowHandle);

    SPHEREMESH = new SphereMesh(mDevice, mDeviceContext);
    BOXMESH = new BoxMesh(mDevice, mDeviceContext);

    return true;
}
开发者ID:MattiasLiljeson,项目名称:Amalgamation,代码行数:29,代码来源:Game.cpp

示例8: main

// Main
int main(int argc, char *argv[])
{	
    int mainWinID;

    // Initialize GLUT
    glutInit(&argc, argv);
    glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);
    glutInitWindowSize(960, 480);
    mainWinID = glutCreateWindow("AntTweakBar multi-window example");
    glutCreateMenu(NULL);
    glutDisplayFunc(DisplayMainWindow);
    glutReshapeFunc(ReshapeMainWindow);

    // Initialize AntTweakBar
    TwInit(TW_OPENGL, NULL);

    // Create two sub-windows
    g_SubWindowData[0].WinID = glutCreateSubWindow(mainWinID, 8, 8, 480, 464);
    SetupSubWindow(0);
    g_SubWindowData[1].WinID = glutCreateSubWindow(mainWinID, 488, 8, 464, 464);
    SetupSubWindow(1);
    
    atexit(Terminate);  // Called after glutMainLoop ends

    // Call the GLUT main loop
    glutMainLoop();

    return 0;
}
开发者ID:AGoodGameMaker,项目名称:opengl-tutorial-org,代码行数:30,代码来源:TwDualGLUT.c

示例9: glutPassiveMotionFunc

void RotationsViewer::initializeGui()
{
    glutPassiveMotionFunc((GLUTmousemotionfun)TwEventMouseMotionGLUT);
    TwGLUTModifiersFunc(glutGetModifiers);
    TwInit(TW_OPENGL, NULL);
    TwWindowSize(mWindowWidth, mWindowHeight);

    TwCopyStdStringToClientFunc(onCopyStdStringToClient);

    mDemoBar = TwNewBar("Demo controls");
    TwDefine(" 'Demo controls' size='200 175' position='5 5' iconified=false fontresizable=false alpha=200");

    TwEnumVal modeTypeEV[] = { { DEMO1, "Convert" }, { DEMO2, "Curve" } };
    modeType = TwDefineEnum("ModeType", modeTypeEV, 2);
    TwAddVarRW(mDemoBar, "Demo", modeType, &mMode, NULL);

    TwAddVarRW(mDemoBar, "X Angle", TW_TYPE_DOUBLE, &mXAngle, " group='Convert params' ");
    TwAddVarRW(mDemoBar, "Y Angle", TW_TYPE_DOUBLE, &mYAngle, " group='Convert params' ");
    TwAddVarRW(mDemoBar, "Z Angle", TW_TYPE_DOUBLE, &mZAngle, " group='Convert params' ");
    TwEnumVal rooTypeEV[] = { { XYZ, "XYZ" }, { XZY, "XZY" }, { YXZ, "YXZ" }, { YZX, "YZX" }, { ZXY, "ZXY" }, { ZYX, "ZYX" } };
    rooType = TwDefineEnum("RooType", rooTypeEV, 6);
    TwAddVarRW(mDemoBar, "Rot Order", rooType, &mRotOrder, " group='Convert params' ");

    TwEnumVal splineTypeEV[] = { { ASplineQuat::LINEAR, "Linear" }, { ASplineQuat::CUBIC, "Cubic" } };
    splineType = TwDefineEnum("SplineType", splineTypeEV, 2);
    TwAddVarCB(mDemoBar, "Spline type", splineType, onSetStyleCb, onGetStyleCb, this, " group='Curve params'");
}
开发者ID:codemodo,项目名称:animation_toolkit,代码行数:27,代码来源:RotationsViewer.cpp

示例10: m_game

Gui::Gui(Scene& scene,
         Game& game,
         Camera& camera,
         Input& input,
         Timer& timer) :
    m_game(game),
    m_camera(camera),
    m_scene(scene),
    m_timer(timer)
{
    TwInit(TW_OPENGL_CORE, nullptr);
    TwWindowSize(WINDOW_WIDTH, WINDOW_HEIGHT);

    const std::string barname = "GraphicsTweaker";
    m_tweakbar = TwNewBar(barname.c_str());
    m_tweaker = std::make_unique<Tweaker>(m_tweakbar);
    
    const int border = 10;
    std::ostringstream stream;
    stream << barname << " label='Graphics Tweaker' " 
        << "position='" << border << " " << border << "' "
        << "size='250 " << WINDOW_HEIGHT-border*2 << "' "
        << "alpha=180 text=light valueswidth=80 color='0 0 0' "
        << "refresh=0.05 iconified=false resizable=true "
        << "fontsize=2 fontresizable=false ";
    TwDefine(stream.str().c_str());

    FillTweakBar();

    auto AddKeyCallback = [&input](unsigned int key, unsigned int code)
    {
        input.AddCallback(key, false, [code]()
        { 
            TwKeyPressed(code, 0);
        });
    };

    // Keys required for modifying entries in the tweak bar
    AddKeyCallback(GLFW_KEY_0, '0');
    AddKeyCallback(GLFW_KEY_1, '1');
    AddKeyCallback(GLFW_KEY_2, '2');
    AddKeyCallback(GLFW_KEY_3, '3');
    AddKeyCallback(GLFW_KEY_4, '4');
    AddKeyCallback(GLFW_KEY_5, '5');
    AddKeyCallback(GLFW_KEY_6, '6');
    AddKeyCallback(GLFW_KEY_7, '7');
    AddKeyCallback(GLFW_KEY_8, '8');
    AddKeyCallback(GLFW_KEY_9, '9');
    AddKeyCallback(GLFW_KEY_PERIOD, '.');
    AddKeyCallback(GLFW_KEY_MINUS, '-');
    AddKeyCallback(GLFW_KEY_ENTER, TW_KEY_RETURN);
    AddKeyCallback(GLFW_KEY_LEFT, TW_KEY_LEFT);
    AddKeyCallback(GLFW_KEY_RIGHT, TW_KEY_RIGHT);
    AddKeyCallback(GLFW_KEY_TAB, TW_KEY_TAB);
    AddKeyCallback(GLFW_KEY_END, TW_KEY_END);
    AddKeyCallback(GLFW_KEY_HOME, TW_KEY_HOME);
    AddKeyCallback(GLFW_KEY_BACKSPACE, TW_KEY_BACKSPACE);

    LogInfo("GUI: Tweak bar initialised");
}
开发者ID:karajensen,项目名称:tiny-toon-tanks,代码行数:60,代码来源:Gui.cpp

示例11: glutCreateMenu

void DemoWindow::initTWBar()
{
    glutCreateMenu(NULL);
    // Initialize AntTweakBar
    TwInit(TW_OPENGL, NULL);

    //// Set GLUT event callbacks
 //   // - Directly redirect GLUT mouse button events to AntTweakBar
 //   glutMouseFunc((GLUTmousebuttonfun)TwEventMouseButtonGLUT);
 //   // - Directly redirect GLUT mouse motion events to AntTweakBar
 //   glutMotionFunc((GLUTmousemotionfun)TwEventMouseMotionGLUT);
 //   // - Directly redirect GLUT mouse "passive" motion events to AntTweakBar (same as MouseMotion)
 //   glutPassiveMotionFunc((GLUTmousemotionfun)TwEventMouseMotionGLUT);
 //   // - Directly redirect GLUT key events to AntTweakBar
 //   glutKeyboardFunc((GLUTkeyboardfun)TwEventKeyboardGLUT);
 //   // - Directly redirect GLUT special key events to AntTweakBar
 //   glutSpecialFunc((GLUTspecialfun)TwEventSpecialGLUT);
    // - Send 'glutGetModifers' function pointer to AntTweakBar;
    //   required because the GLUT key event functions do not report key modifiers states.
    TwGLUTModifiersFunc(glutGetModifiers);
    bar = TwNewBar("TweakBar");
    TwWindowSize(100, 100);
    TwDefine(" GLOBAL help='This example shows how to integrate AntTweakBar with GLUT and OpenGL.' "); // Message added to the help bar.
    TwDefine(" TweakBar size='200 400' color='96 216 224' "); // change default tweak bar size and color

}
开发者ID:billhj,项目名称:Etoile,代码行数:26,代码来源:DemoWindow.cpp

示例12: initGUI

void initGUI() {
    // Initialize AntTweakBar GUI
    if (!TwInit(TW_OPENGL, NULL))
    {
        assert(0);
    }

    TwWindowSize(g_WindowWidth, g_WindowHeight);
    TwBar *controlBar = TwNewBar("Controls");
    TwDefine(" Controls position='10 10' size='200 320' refresh=0.1 ");

    TwAddVarCB(controlBar, "use_shaders", TW_TYPE_BOOLCPP, cbSetShaderStatus, cbGetShaderStatus, NULL, " label='shaders' key=s help='Turn programmable pipeline on/off.' ");

    // Shader panel setup
    TwAddVarRW(controlBar, "vs", TW_TYPE_BOOLCPP, &g_UseVertexShader, " group='Shaders' label='vertex' key=v help='Toggle vertex shader.' ");
    TwAddVarRW(controlBar, "gs", TW_TYPE_BOOLCPP, &g_UseGeometryShader, " group='Shaders' label='geometry' key=g help='Toggle geometry shader.' ");
    TwAddVarRW(controlBar, "fs", TW_TYPE_BOOLCPP, &g_UseFragmentShader, " group='Shaders' label='fragment' key=f help='Toggle fragment shader.' ");
    TwAddButton(controlBar, "build", cbCompileShaderProgram, NULL, " group='Shaders' label='build' key=b help='Build shader program.' ");
    //TwDefine( " Controls/Shaders readonly=true "); 

    // Render panel setup
    TwAddVarRW(controlBar, "wiremode", TW_TYPE_BOOLCPP, &g_WireMode, " group='Render' label='wire mode' key=w help='Toggle wire mode.' ");
    TwAddVarRW(controlBar, "face_culling", TW_TYPE_BOOLCPP, &g_FaceCulling, " group=Render label='face culling' key=c help='Toggle face culling.' ");

    // Scene panel setup
    TwEnumVal geometry_type[] = { 
        { ELEPHANT_GEOMETRY    , "Elephant"},
        { CUBE_GEOMETRY        , "Cube"    },
    };
    TwType geom_type = TwDefineEnum("Model", geometry_type, NUM_GEOMETRY_TYPES);
    TwAddVarRW(controlBar, "model", geom_type, &g_GeometryType, " group='Scene' keyIncr=Space help='Change model.' ");
    TwAddVarRW(controlBar, "auto-rotation", TW_TYPE_BOOLCPP, &g_SceneRotEnabled, " group='Scene' label='rotation' key=r help='Toggle scene rotation.' ");
    TwAddVarRW(controlBar, "Translate", TW_TYPE_FLOAT, &g_SceneTraZ, " group='Scene' label='translate' min=1 max=1000 step=0.5 keyIncr=t keyDecr=T help='Scene translation.' ");
    TwAddVarRW(controlBar, "SceneRotation", TW_TYPE_QUAT4F, &g_SceneRot, " group='Scene' label='rotation' open help='Toggle scene orientation.' ");
}
开发者ID:Bublafus,项目名称:NPR-techniques,代码行数:35,代码来源:AntTweakConfiguration.cpp

示例13: main

int main(int args, char **argv)
{
  glutInit(&args, argv);
  glutInitWindowSize(800, 600);
  glutInitDisplayMode(GLUT_RGBA | GLUT_DEPTH | GLUT_DOUBLE);
  glutCreateWindow("simple vertex shader");

  TwInit(TW_OPENGL, NULL);
  TwBar *bar = TwNewBar("myBar");
  TwDefine("myBar size='200 400' color = '96 216 224'");

  TwAddVarRW(bar, "ObjectRotate", TW_TYPE_QUAT4F, &g_Rotate, "label='Object Rotation' opened=true");
  TwAddVarRW(bar, "LightDir", TW_TYPE_DIR3F, &g_lightPos, "label='light Pos' opened=true");
  glutMouseFunc((GLUTmousebuttonfun)TwEventMouseButtonGLUT);
  glutMotionFunc((GLUTmousemotionfun)TwEventMouseMotionGLUT);
  glutPassiveMotionFunc((GLUTmousemotionfun)TwEventMouseMotionGLUT);
  glutKeyboardFunc((GLUTkeyboardfun)TwEventKeyboardGLUT);
  TwGLUTModifiersFunc(glutGetModifiers);
  glutDisplayFunc(RenderScene);
  glutReshapeFunc(ChangeSize);
  SetupRC();
  glutMainLoop();
  Terminate();
  return 0;
}
开发者ID:RamboWu,项目名称:openglex,代码行数:25,代码来源:simple.cpp

示例14: init

void init(void)
{
    

    // Define técnica de shading: GL_FLAT, GL_SMOOTH
    glShadeModel(GL_SMOOTH);
    
    glPolygonMode(GL_FRONT, GL_FILL); // GL_LINE, GL_POINT, GL_FILL

    // Activa o teste de profundidade
    glEnable(GL_DEPTH_TEST);
    glEnable(GL_TEXTURE_2D); 
    //glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); 
    TwInit(TW_OPENGL, NULL);

    mainBar = TwNewBar("Parameters");
    TwAddVarRW(mainBar, "Time Scale", TW_TYPE_FLOAT, &TimeScale,
        " group='Simulation' keyincr=U keydecr=I help='Simulation's time scale'");
    TwAddVarRW(mainBar, "Speed", TW_TYPE_FLOAT, &camSpeed,
        " group='Camera' keyincr=S keydecr=X help='Camera movement speed' ");
    TwAddVarRW(mainBar, "Manual", TW_TYPE_BOOL16, &manualCam,
        " group='Camera' keyincr=C help='Toogle camera mode' ");
    TwAddVarRW(mainBar, "Show Orbits", TW_TYPE_BOOL16, &orbits,
        " group='Orbits' keyincr=O help='Toogle orbits' ");

    // Compila o modelo
    createFloorToDL();
}
开发者ID:vvolkgang,项目名称:YASS,代码行数:28,代码来源:main.c

示例15: initGUI

/** Initializes GUI - only AntweakBar menu creation */
void initGUI()
{
    // Initialize AntTweakBar GUI
    if (!TwInit(TW_OPENGL, NULL))
    {
        assert(0);
    }

    TwWindowSize(g_WindowWidth, g_WindowHeight);
    TwBar *controlBar = TwNewBar("Controls");
    TwDefine("Controls position='10 10' size='200 300' refresh=0.1  color='130 140 150'");
    
    TwAddVarCB(controlBar, "gpu", TW_TYPE_BOOLCPP, cbSetGPUUsage, cbGetGPUUsage, NULL, " group='CUDA' label='Compute on:' true='GPU' false='CPU' ");
    //TwAddVarRW(controlBar, "restart", TW_TYPE_BOOLCPP, &g_initData, " group='PROGRAM' label='Restart: ' true='' false='restart' ");
    
    TwAddVarRW(controlBar, "melt", TW_TYPE_BOOLCPP, &g_melt, " group='Render' label='Melt' key=m help='Start melting' ");
    TwAddVarRW(controlBar, "wiremode", TW_TYPE_BOOLCPP, &g_WireMode, " group='Render' label='Wire mode' key=w help='Toggle wire mode.' ");
    TwAddVarRW(controlBar, "march", TW_TYPE_BOOLCPP, &g_useMarchingCubes, " group='Render' label='March. Cubes' help='Toggle marching cubes.' ");
    
    TwAddVarRW(controlBar, "auto-rotation", TW_TYPE_BOOLCPP, &g_SceneRotEnabled, " group='Scene' label='rotation' key=r help='Toggle scene rotation.' ");
    TwAddVarRW(controlBar, "Translate", TW_TYPE_FLOAT, &g_SceneTraZ, " group='Scene' label='translate' min=1 max=1000 step=10 keyIncr=t keyDecr=T help='Scene translation.' ");
    TwAddVarRW(controlBar, "SceneRotation", TW_TYPE_QUAT4F, &g_SceneRot, " group='Scene' label='rotation' open help='Toggle scene orientation.' ");
    
    TwAddVarRO(controlBar, "fps", TW_TYPE_FLOAT, &g_fps, " group='INFO' label='Current fps' ");
    TwAddVarRO(controlBar, "ice", TW_TYPE_FLOAT, &g_iceParticles, " group='INFO' label='Ice particles' ");
    
}
开发者ID:Jaa-c,项目名称:GPU-led,代码行数:28,代码来源:main.cpp


注:本文中的TwInit函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。