daily pastebin goal
35%
SHARE
TWEET

Tgui bugreport

AI_UBI Oct 19th, 2016 61 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. tg::Panel::Ptr main_panel = theme->load("Panel");
  2.     main_panel->setSize(tg::bindSize(gui));
  3.  
  4.     tg::VerticalLayout::Ptr v_l = std::make_shared<tg::VerticalLayout>();
  5.     v_l->setSize(tg::bindSize(main_panel));
  6.  
  7.     tg::MenuBar::Ptr tool_panel = theme->load("MenuBar"); //Main buttons dock
  8.     tool_panel->addMenu("File");
  9.     tool_panel->addMenuItem("File", "Load");
  10.     tool_panel->addMenuItem("File", "Save");
  11.     tool_panel->addMenuItem("File", "Save As");
  12.     tool_panel->addMenuItem("File", "Render to file");
  13.     tool_panel->addMenuItem("File", "Exit");
  14.  
  15.     tool_panel->addMenu("Options");
  16.     tool_panel->addMenuItem("Options", "Editor");
  17.     tool_panel->addMenuItem("Options", "Theme");
  18.     tool_panel->addMenuItem("Options", "Window");
  19.  
  20.     tool_panel->addMenu("Compile");
  21.     tool_panel->addMenuItem("Compile", "All");
  22.     tool_panel->addMenuItem("Compile", "Vertex Shader");
  23.     tool_panel->addMenuItem("Compile", "Fragment Shader");
  24.  
  25.     tool_panel->addMenu("Help");
  26.     tool_panel->addMenuItem("Help", "Predefined values");
  27.     tool_panel->addMenuItem("Help", "Vertex Shader");
  28.     tool_panel->addMenuItem("Help", "Fragment Shader");
  29.     //
  30.     tg::HorizontalLayout::Ptr dev_panel = std::make_shared<tg::HorizontalLayout>(); //Render and Editor dock
  31.     v_l->add(dev_panel, "DevPanel");
  32.     v_l->setRatio(dev_panel, 20);
  33.     v_l->add(tool_panel, "ToolPanel");
  34.     tg::Picture::Ptr result_layer = std::make_shared<tg::Picture>(); //Left Render Texture window
  35.     dev_panel->add(result_layer, "RenderResult");
  36.  
  37.     tg::VerticalLayout::Ptr editors_box = std::make_shared<tg::VerticalLayout>(); //Editors box
  38.     dev_panel->add(editors_box, "EditorsBox");
  39.    
  40.     //Vertex shader
  41.     tg::EditBox::Ptr vertex_editor = theme->load("EditBox");
  42.     vertex_editor->setTextSize(12);
  43.     vertex_editor->setText("\
  44. void main()\n\
  45. {\n\
  46.     // transform the vertex position\n\
  47.     gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;\n\n\
  48.     // transform the texture coordinates\n\
  49.     gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;\n\n\
  50.     // forward the vertex color\n\
  51.     gl_FrontColor = gl_Color;\n\
  52. }");
  53.     editors_box->add(vertex_editor, "VertexShaderEditor");
  54.  
  55.     //Fragment shader
  56.     tg::TextBox::Ptr fragment_editor = theme->load("TextBox");
  57.     fragment_editor->setTextSize(12);
  58.     fragment_editor->setText("uniform sampler2D texture;\n\
  59. void main()\n\
  60. {\n\
  61.     // lookup the pixel in the texture\n\
  62.     vec4 pixel = texture2D(texture, gl_TexCoord[0].xy);\n\n\
  63.     // multiply it by the color\n\
  64.     gl_FragColor = gl_Color * pixel;\n\
  65. }");
  66.    
  67.     editors_box->add(fragment_editor, "FragmentShaderEditor");
  68.    
  69.     main_panel->add(v_l);
  70.    
  71.     gui.add(main_panel, "MainPanel");
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top