Ejemplo n.º 1
0
void GLCanvasCubeTest(void)
{
  Ihandle *dlg, *canvas, *box;

  IupGLCanvasOpen();

  box = IupVbox(NULL);
  IupSetAttribute(box, "MARGIN", "5x5");

  canvas = IupGLCanvas(NULL);
  IupSetCallback(canvas, "ACTION", action);
  IupSetCallback(canvas, "BUTTON_CB", (Icallback)button_cb);
  IupSetCallback(canvas, "MOTION_CB", (Icallback)motion_cb);
//  IupSetAttribute(canvas, "BUFFER", "DOUBLE");
  IupSetAttribute(canvas, "RASTERSIZE", "300x300");
  IupAppend(box, canvas);

  dlg = IupDialog(IupSetAttributes(IupFrame(box), "TITLE=Test"));
  IupSetAttribute(dlg, "TITLE", "IupGLCanvas Test");
//  IupSetAttribute(dlg, "COMPOSITED", "YES");

  IupMap(dlg);

  IupGLMakeCurrent(canvas);
//  init();
  printf("Vendor: %s\n", glGetString(GL_VENDOR));
  printf("Renderer: %s\n", glGetString(GL_RENDERER));
  printf("Version: %s\n", glGetString(GL_VERSION));
  IupSetAttribute(canvas, "RASTERSIZE", NULL);

  IupShowXY(dlg, IUP_CENTER, IUP_CENTER);
}
Ejemplo n.º 2
0
int main(int argc, char **argv)
{
  Ihandle *dlg;
  Ihandle *config;

  IupOpen(&argc, &argv);
  IupGLCanvasOpen();
  IupImageLibOpen();

  config = IupConfig();
  IupSetAttribute(config, "APP_NAME", "simple_paint");
  IupConfigLoad(config);

  dlg = create_main_dialog(config);

  /* show the dialog at the last position, with the last size */
  IupConfigDialogShow(config, dlg, "MainWindow");

  /* open a file from the command line (allow file association in Windows) */
  if (argc > 1 && argv[1])
  {
    const char* filename = argv[1];
    open_file(dlg, filename);
  }

  /* initialize the current file, if not already loaded */
  check_new_file(dlg);

  IupMainLoop();

  IupClose();
  return EXIT_SUCCESS;
}
int main(void) {

	Ihandle *dlg;
	int res;
	extern void (*routine_drawPixel) (float x, float y);

	srand((unsigned int) time(0));                  /* Seed to current time value */
	
	routine_drawPixel = clipal_drawPixel;

	list_init(&pointList, free);
	res = util_readFromFile("clip_rectangle.txt");
	printf("Clip Rectangle loaded, return value: %d\n", res);
	
	if (res == -1) {
		printf("File read error\n");\
		getche();
		goto TERMINATE;
	}

	IupOpen(0, 0);
		IupGLCanvasOpen();

		dlg = createMainWindow();
		IupShowXY(dlg, IUP_CENTER, IUP_CENTER);

		IupMainLoop();
	IupClose();
	
	TERMINATE:
	list_destroy(&pointList);
	return 0;
}
Ejemplo n.º 4
0
int main(int argc, char **argv)
{
  Ihandle *canvas, *finale, *dg;

  IupOpen(&argc, &argv);
  IupGLCanvasOpen();

  canvas = IupGLCanvas(NULL);
  IupSetCallback(canvas, "ACTION", (Icallback) redraw);
  IupSetAttribute(canvas, IUP_BUFFER, IUP_DOUBLE);
  IupSetAttribute(canvas, "RASTERSIZE", "123x200");

  finale = IupHbox(IupFill(), 
                   canvas, 
                   IupFill(), 
                   NULL);

  dg = IupDialog(finale);
  IupSetAttribute(dg, "TITLE", "IupGLCanvas");

  IupShow(dg);
  IupMainLoop();
  IupClose();

  return EXIT_SUCCESS;
}
Ejemplo n.º 5
0
/*-------------------------------------------------------------------------*/
void main(int argc, char* argv[]) {
    IupOpen(&argc,&argv);
    IupGLCanvasOpen();
    //IconLibOpen();
    if ( init() )
		IupMainLoop();
    IupClose();
}
Ejemplo n.º 6
0
int iupgllua_open(lua_State * L)
{
  if (iuplua_opencall_internal(L))
    IupGLCanvasOpen();

  iuplua_get_env(L);
  iupglcanvaslua_open(L);
  return 0;
}
Ejemplo n.º 7
0
Archivo: glcube.c Proyecto: defdef/iup
/*-----------------------*/
int main(int argc, char* argv[]) 
{
  Ihandle* dialog;

  IupOpen(&argc, &argv);                       /* opens the IUP lib */
  IupGLCanvasOpen();                          /* enable the use of OpenGL to draw in canvas */

  dialog = initDialog();                      /* local function to create a dialog with buttons and canvas */
  IupShowXY(dialog, IUP_CENTER, IUP_CENTER);  /* shows dialog in the center of screen */

  IupMainLoop();                              /* handle the program control to the IUP lib until a return IUP_CLOSE */

  IupClose();                               /* closes the IUP lib */ 
}
Ejemplo n.º 8
0
int main(int argc, char* argv[])
{
  IupOpen(&argc, &argv);
  IupControlsOpen();

#ifdef USE_OPENGL
  IupGLCanvasOpen();
#endif

  PreDialogsTest();

  IupMainLoop();

  IupClose();

  return EXIT_SUCCESS;
}
Ejemplo n.º 9
0
int main(int argc, char* argv[]) 
{
  /* IUP initialization */
  IupOpen();
  IupGLCanvasOpen();

  /* Create and show the main dialog */
  mainDialogCreate();

  /* IUP event loop */
  IupMainLoop();

  /* IUP closing */
  IupClose();

  return 0;
}
Ejemplo n.º 10
0
static void factoryCache_Init() {
  InitializeCriticalSection(&cs_factoryCache);

#ifdef IUP
  /* iup initialization */
  IupOpen();
  #ifndef NO_CPICONTROLS
  IupGLCanvasOpen();
  IupControlsOpen();
  #endif
  #ifdef SPEECH_SDK
  IupSpeechOpen();
  #endif
#endif
  factoryCache = luaL_newstate();
  lua_newtable(factoryCache);
  lua_setglobal(factoryCache,"factories");
}
Ejemplo n.º 11
0
int main( int argc, char **argv )
{
    //Inicializa IUP.
    IupOpen( &argc, &argv );

    //Abre o canvas OpenGL.
    IupGLCanvasOpen( );

    //Instancia a janela.
    Window *window = new Window( );

    //Exibe a Janela.
    window->show( );

    IupMainLoop( );
    delete window;
    IupClose( );
    return EXIT_SUCCESS;
}
Ejemplo n.º 12
0
void PreDialogsTest(void)
{
    char* msg = "Press a key for a pre-defined dialog:\n"
                "e = IupMessageDlg(ERROR)\n"
                "i = IupMessageDlg(INFORMATION)\n"
                "w = IupMessageDlg(WARNING)\n"
                "q = IupMessageDlg(QUESTION)\n"
                "--------------------\n"
                "o = IupFileDlg(OPEN)\n"
                "O = IupFileDlg(OPEN+PREVIEW)\n"
                "G = IupFileDlg(OPEN+PREVIEW+OPENGL)\n"
                "s = IupFileDlg(SAVE)\n"
                "d = IupFileDlg(DIR)\n"
                "--------------------\n"
                "c = IupColorDlg\n"
                "f = IupFontDlg\n"
                "--------------------\n"
                "m = IupMessage\n"
                "a = IupAlarm\n"
                "t = IupGetText\n"
                "g = IupGetFile\n"
                "l = IupListDialog\n"
                "y = IupLayoutDialog\n"
                "--------------------\n"
                "Esc = quit";
    Ihandle *dlg = IupDialog(IupVbox(IupLabel(msg), NULL));

#ifdef USE_OPENGL
    IupGLCanvasOpen();
#endif

    IupSetHandle("_MAIN_DIALOG_TEST_", dlg);

    IupSetAttribute(dlg, "TITLE", "Pre-defined Dialogs Test");
    IupSetAttribute(dlg, "MARGIN", "10x10");

    IupSetCallback(dlg, "K_ANY",    (Icallback)k_any);
    IupSetCallback(dlg, "CLOSE_CB", (Icallback)close_cb);

    IupShow(dlg);
}
Ejemplo n.º 13
0
// -------------------------------------------------------------------------------------------------
// -------------------------------------------------------------------------------------------------
int main (int argc, char** argv)
{
  // Init
  //glutInit(&argc, argv);
  IupOpen(&argc, &argv);
  IupGLCanvasOpen();
  IupImageLibOpen();

  // Create dialog
  cMainDialog *main_dialog = new cMainDialog();

  //glewExperimental = GL_TRUE;
  GLenum err = glewInit();
  if(GLEW_OK != err) 
  {
    fprintf(stderr, "GLEW Error: %s\n", glewGetErrorString(err));
    return EXIT_FAILURE;
  }

  printf("Glew Version: %s\n", glewGetString(GLEW_VERSION));
  printf("GL Vendor: %s\n", glGetString(GL_VENDOR));
  printf("GL Renderer: %s\n", glGetString(GL_RENDERER));
  printf("\nGL Version: %s\n", glGetString(GL_VERSION));
  
  //This is the new way for getting the GL version.
	//It returns integers. Much better than the old glGetString(GL_VERSION).
  int OpenGLVersion[2];
  glGetIntegerv(GL_MAJOR_VERSION, &OpenGLVersion[0]);
  glGetIntegerv(GL_MINOR_VERSION, &OpenGLVersion[1]);
  printf("OpenGL major version = %d\n", OpenGLVersion[0]);
  printf("OpenGL minor version = %d\n", OpenGLVersion[1]);
  
  // For all versions of OpenGL 3.3 and above, 
  // the corresponding GLSL version matches the OpenGL version. 
  // So GL 4.1 uses GLSL 4.10.
  printf("Shader Version: %s\n\n", glGetString(GL_SHADING_LANGUAGE_VERSION));
  
  int major, minor, rev; 
  _glfwParseGLVersion(&major, &minor, &rev);

  cRender::m_new_render = major <= 2 ? false: true;

  g_model = new cModel();

  if(!g_render_att)
    g_render_att = new cRenderAtt();

  if(cRender::m_new_render)
  {
    if(!g_shader)
    {
      g_shader = new cShader();
      if(!g_shader->create())
      {
        delete g_shader;
        g_shader = NULL;
      }
    }

    if(!g_shader2)
    {
      g_shader2 = new cShader();
      if(!g_shader2->create())
      {
        delete g_shader2;
        g_shader2 = NULL;
      }
    }
  }

  init_opengl();

  main_dialog->show_dialog();

  IupMainLoop();
  IupClose();

  delete main_dialog;
  //delete obj_dialog;

  return EXIT_SUCCESS;
}
Ejemplo n.º 14
0
int main ( int argc, char **argv )
{
    IupOpen(&argc, &argv);
#ifndef IUPLUA_NO_GL
    IupGLCanvasOpen();
#endif
#ifndef IUPLUA_NO_CD
    IupControlsOpen();
    IupPPlotOpen();
#endif

    lua_open();

    lua_setdebug(1);

    lua_iolibopen( );
    lua_strlibopen( );
    lua_mathlibopen( );

    iuplua_open( );
    iupkey_open( );
#ifndef IUPLUA_NO_GL
    iupgllua_open();
#endif
#ifndef IUPLUA_NO_CD
    iupcontrolslua_open();
    iup_pplotlua_open();
    cdlua_open();
    cdluaiup_open();
#endif
#ifndef IUPLUA_NO_IM
    iupimlua_open();
    imlua_open();
#endif

    if (argc <= 1)
    {
        if(!iuplua_dofile("console3.lua"))
        {
#ifdef TEC_BIGENDIAN
#ifdef TEC_64
#include "loh/console3_be64.loh"
#else
#include "loh/console3_be32.loh"
#endif
#else
#ifdef TEC_64
#ifdef WIN64
#include "loh/console3_le64w.loh"
#else
#include "loh/console3_le64.loh"
#endif
#else
#include "loh/console3.loh"
#endif
#endif
        }
    }
    else
    {
        int ok = 1,
            i  = 1;

        /* Running all .lua given as arguments */
        while(ok & (i < argc))
        {
            ok = iuplua_dofile(argv[i]);
            i++;
        }

        if(!ok)
        {
            return EXIT_FAILURE;
        }
    }

#ifndef IUPLUA_NO_CD
    cdlua_close();
    IupControlsClose();
#endif
    IupClose();

    lua_close();

    return EXIT_SUCCESS;
}
Ejemplo n.º 15
0
void GLCanvasCubeTest(void)
{
  Ihandle *dlg, *canvas, *box, *gtoggle, *gtoggle1, *gtoggle2,
    *hbox, *vbox, *glabel, *gsep1, *gsep2, *gbutton1, *gbutton2,
    *pbar1, *pbar2, *glink, *gval1, *gval2, *gframe1, *gframe2,
    *gexp1, *gexp2, *image_open, *image_close, *image_high,
    *gframe3, *vbox2, *gtoggle3, *gtoggle4, *gtoggle5, *gsbox,
    *text, *vbox3, *matrix, *image_val;

  IupGLCanvasOpen();
  IupGLControlsOpen();
  IupControlsOpen();

  glabel = IupGLLabel("Label");
//  IupSetAttribute(glabel, "FGCOLOR", "255 255 255");
  IupSetAttribute(glabel, "FONT", "Helvetica, 24");
  IupSetAttributeHandle(glabel, "IMAGE", load_image_Tecgraf());

  gbutton1 = IupGLButton("Button");
  IupSetAttribute(gbutton1, "PADDING", "5x5");
  //IupSetAttribute(gbutton1, "BGCOLOR", "245 0 245 92");
  IupSetCallback(gbutton1, "ACTION", button_action_cb);
  IupSetAttribute(gbutton1, "NAME", "button1");
  IupSetAttribute(gbutton1, "TIP", "Button Tip");
  //  IupSetAttribute(gbutton1, "RASTERSIZE", "x100");

  if (0)
  {
    Ihandle* pressed_back = IupLoadImage("../test/pressed_back.png");
    Ihandle* enabled_back = IupLoadImage("../test/enabled_back.png");
    Ihandle* highlighted_back = IupLoadImage("../test/highlighted_back.png");

    IupSetAttributeHandle(gbutton1, "BACKIMAGE", enabled_back);
    IupSetAttributeHandle(gbutton1, "BACKIMAGEPRESS", pressed_back);
    IupSetAttributeHandle(gbutton1, "BACKIMAGEHIGHLIGHT", highlighted_back);
    IupSetAttribute(gbutton1, "BORDERCOLOR", "0 0 0 0");
  }

  gbutton2 = IupGLButton(NULL);
  IupSetAttribute(gbutton2, "PADDING", "5x5");
  IupSetAttributeHandle(gbutton2, "IMAGE", load_image_FileSave());
  IupSetCallback(gbutton2, "ACTION", button_action_cb);
  IupSetAttribute(gbutton2, "NAME", "button2");

  gtoggle = IupGLToggle("Toggle");
  IupSetAttribute(gtoggle, "PADDING", "5x5");
  IupSetCallback(gtoggle, "ACTION", (Icallback)toggle_action_cb);
  IupSetAttribute(gtoggle, "NAME", "toggle");

  gtoggle1 = IupGLToggle(NULL);
  IupSetAttribute(gtoggle1, "PADDING", "5x5");
  IupSetAttributeHandle(gtoggle1, "IMAGE", load_image_Test());
  IupSetCallback(gtoggle1, "ACTION", (Icallback)toggle_action_cb);
  IupSetAttribute(gtoggle1, "NAME", "toggle1");

  gtoggle2 = IupGLToggle(NULL);
  IupSetAttribute(gtoggle2, "PADDING", "5x5");
  IupSetAttributeHandle(gtoggle2, "IMAGE", load_image_Test());
  IupSetCallback(gtoggle2, "ACTION", (Icallback)toggle_action_cb);
  IupSetAttribute(gtoggle2, "NAME", "toggle2");

  gsep1 = IupGLSeparator();

  glink = IupGLLink("http://www.tecgraf.puc-rio.br/iup", "IUP Toolkit");
  IupSetCallback(glink, "ACTION", (Icallback)link_action_cb);

  pbar1 = IupGLProgressBar();
  IupSetAttribute(pbar1, "VALUE", "0.3");
  IupSetAttribute(pbar1, "SHOWTEXT", "Yes");

  //image_val = IupLoadImage("../test/slider_handler.png");

  gval1 = IupGLVal();
  IupSetAttribute(gval1, "VALUE", "0.3");
  IupSetCallback(gval1, "VALUECHANGED_CB", val_action_cb);
  IupSetAttribute(gval1, "PROGRESSBAR", (char*)pbar1);
  IupSetAttribute(gval1, "NAME", "val1");
  IupSetAttribute(gval1, "TIP", "Val Tip");
  //IupSetAttributeHandle(gval1, "IMAGE", image_val);

  hbox = IupHbox(glabel, gsep1, gbutton1, gtoggle, glink, pbar1, gval1, NULL);
  IupSetAttribute(hbox, "ALIGNMENT", "ACENTER");
  IupSetAttribute(hbox, "MARGIN", "5x5");
  IupSetAttribute(hbox, "GAP", "5");

  pbar2 = IupGLProgressBar();
  IupSetAttribute(pbar2, "VALUE", "0.3");
  IupSetAttribute(pbar2, "ORIENTATION", "VERTICAL");

  gval2 = IupGLVal();
  IupSetAttribute(gval2, "VALUE", "0.3");
  IupSetAttribute(gval2, "ORIENTATION", "VERTICAL");
  IupSetCallback(gval2, "VALUECHANGED_CB", val_action_cb);
  IupSetAttribute(gval2, "PROGRESSBAR", (char*)pbar2);
  IupSetAttribute(gval2, "NAME", "val2");

  gsep2 = IupGLSeparator();
  IupSetAttribute(gsep2, "ORIENTATION", "HORIZONTAL");

  vbox = IupVbox(gbutton2, gsep2, 
    IupRadio(IupSetAttributes(IupVbox(gtoggle1, gtoggle2, NULL), "MARGIN=0x0")),
    pbar2,
    gval2,
    NULL);
  IupSetAttribute(vbox, "ALIGNMENT", "ACENTER");
  IupSetAttribute(vbox, "MARGIN", "5x5");
  IupSetAttribute(vbox, "GAP", "5");

  gtoggle5 = IupGLToggle("Toggle");
  IupSetAttribute(gtoggle5, "PADDING", "5x5");
  IupSetCallback(gtoggle5, "ACTION", (Icallback)toggle_action_cb);
  IupSetAttribute(gtoggle5, "NAME", "toggle5");
  IupSetAttribute(gtoggle5, "CHECKMARK", "Yes");
//  IupSetAttribute(gtoggle5, "RIGHTBUTTON", "Yes");

  gtoggle3 = IupGLToggle("Radio Toggle");
  IupSetAttribute(gtoggle3, "PADDING", "5x5");
  IupSetCallback(gtoggle3, "ACTION", (Icallback)toggle_action_cb);
  IupSetAttribute(gtoggle3, "NAME", "toggle3");
  IupSetAttribute(gtoggle3, "CHECKMARK", "Yes");

  gtoggle4 = IupGLToggle("Radio Toggle");
  IupSetAttribute(gtoggle4, "PADDING", "5x5");
  IupSetAttributeHandle(gtoggle4, "IMAGE", load_image_Test());
  IupSetCallback(gtoggle4, "ACTION", (Icallback)toggle_action_cb);
  IupSetAttribute(gtoggle4, "NAME", "toggle4");
  IupSetAttribute(gtoggle4, "CHECKMARK", "Yes");
//  IupSetAttribute(gtoggle4, "RIGHTBUTTON", "Yes");

  vbox2 = IupVbox(
    IupRadio(IupSetAttributes(IupVbox(gtoggle3, gtoggle4, NULL), "MARGIN=0x0")),
    gtoggle5,
    NULL);

  gsbox = IupSetAttributes(IupGLScrollBox(vbox2), "RASTERSIZE=90x90");
  gsbox = IupGLSizeBox(gsbox);

  gframe1 = IupSetAttributes(IupGLFrame(hbox), "TITLE=Frame1");
  gframe2 = IupSetAttributes(IupGLFrame(vbox), "BACKCOLOR=\"250 250 160 128\", FRAMECOLOR=\"250 250 160\"");
  gframe3 = IupSetAttributes(IupGLFrame(gsbox), "TITLE=Frame3, TITLEBOX=Yes");
//  IupSetAttributeHandle(gframe3, "TITLEBACKIMAGE", load_image_Tecgraf());

  gexp1 = IupSetAttributes(IupGLExpander(gframe1), "TITLE=Expander");
  gexp2 = IupSetAttributes(IupGLExpander(gframe2), "BARPOSITION=LEFT");

  text = IupText(NULL);
  IupSetAttribute(text, "VALUE", "Text");

  matrix = IupMatrix(NULL);
  IupSetAttribute(matrix, "NUMLIN", "3");
  IupSetAttribute(matrix, "NUMCOL", "2");
  IupSetAttribute(matrix, "NUMLIN_VISIBLE", "3");
  IupSetAttribute(matrix, "NUMCOL_VISIBLE", "2");
  IupSetAttribute(matrix, "0:0", "Inflation");
  IupSetAttribute(matrix, "1:0", "Medicine");
  IupSetAttribute(matrix, "2:0", "Food");
  IupSetAttribute(matrix, "3:0", "Energy");
  IupSetAttribute(matrix, "0:1", "January 2000");
  IupSetAttribute(matrix, "0:2", "February 2000");
  IupSetAttribute(matrix, "1:1", "5.6");
  IupSetAttribute(matrix, "2:1", "2.2");
  IupSetAttribute(matrix, "3:1", "4.1");
  IupSetAttribute(matrix, "1:2", "10");
  IupSetAttribute(matrix, "2:2", "1");
  IupSetAttribute(matrix, "3:2", "0.5");
//  IupSetAttribute(matrix, "EXPAND", "No");
  IupSetAttribute(matrix, "SCROLLBAR", "No");

  vbox3 = IupVbox(
    text,
    matrix,
    NULL);

  vbox3 = IupSetAttributes(IupGLFrame(vbox3), "TITLE=Frame4");

  canvas = IupGLCanvasBox(
    IupSetAttributes(gexp1, "HORIZONTALALIGN=ACENTER, VERTICALALIGN=ATOP, MOVEABLE=Yes, MOVETOTOP=Yes"),
    IupSetAttributes(gexp2, "HORIZONTALALIGN=ALEFT, VERTICALALIGN=ACENTER"),
    IupSetAttributes(gframe3, "MOVEABLE=Yes, POSITION=\"550,200\", MOVETOTOP=Yes"),
    IupSetAttributes(vbox3, "MOVEABLE=Yes, POSITION=\"250,350\""),
    NULL);
    
  IupSetAttribute(canvas, "DEPTH_SIZE", "16");

  image_open = IupImage(16, 16, img_open);
  image_close = IupImage(16, 16, img_close);
  image_high = IupImage(16, 16, img_close);
  IupSetAttribute(image_open, "0", "BGCOLOR");
  IupSetAttribute(image_open, "1", "192 192 192");
  IupSetAttribute(image_close, "0", "BGCOLOR");
  IupSetAttribute(image_close, "1", "192 192 192");
  IupSetAttribute(image_high, "1", "192 192 192");

  //  IupSetAttribute(gexp1, "BARSIZE", "50");
  //  IupSetAttributeHandle(gexp1, "IMAGE", image_close);
  //  IupSetAttributeHandle(gexp1, "IMOPEN", image_open);
  //  IupSetAttribute(gexp1, "IMAGE", "img1");
  IupSetCallback(gexp1, "ACTION", (Icallback)expand_cb);
  IupSetAttribute(gexp1, "EXTRABUTTONS", "3");
  IupSetCallback(gexp1, "EXTRABUTTON_CB", (Icallback)extrabutton_cb);
  IupSetAttributeHandle(gexp1, "IMAGEEXTRA1", image_close);
  IupSetAttributeHandle(gexp1, "IMAGEEXTRAPRESS1", image_open);
  IupSetAttributeHandle(gexp1, "IMAGEEXTRAHIGHLIGHT1", image_high);
  IupSetAttributeHandle(gexp1, "IMAGEEXTRA2", image_close);
  IupSetAttributeHandle(gexp1, "IMAGEEXTRAPRESS2", image_open);
  IupSetAttributeHandle(gexp1, "IMAGEEXTRAHIGHLIGHT2", image_high);
  IupSetAttributeHandle(gexp1, "IMAGEEXTRA3", image_close);
  IupSetAttributeHandle(gexp1, "IMAGEEXTRAPRESS3", image_open);
  IupSetAttributeHandle(gexp1, "IMAGEEXTRAHIGHLIGHT3", image_high);
  //IupSetAttribute(gexp1, "REDRAWALL", "No");

  IupSetCallback(canvas, "ACTION", action);
  IupSetCallback(canvas, "BUTTON_CB", (Icallback)button_cb);
  IupSetCallback(canvas, "MOTION_CB", (Icallback)motion_cb);
  IupSetAttribute(canvas, "BUFFER", "DOUBLE");
  IupSetAttribute(canvas, "MARGIN", "10x10");

  box = IupVbox(canvas, NULL);
  IupSetAttribute(box, "MARGIN", "25x25");

  dlg = IupDialog(box);
  IupSetAttribute(dlg, "TITLE", "IupGLCanvas Test");
  IupSetAttribute(dlg, "RASTERSIZE", "800x600");

  IupMap(dlg);

  IupGLMakeCurrent(canvas);
  printf("Vendor: %s\n", glGetString(GL_VENDOR));
  printf("Renderer: %s\n", glGetString(GL_RENDERER));
  printf("Version: %s\n", glGetString(GL_VERSION));

  IupShowXY(dlg, IUP_CENTER, IUP_CENTER);
  IupSetAttribute(dlg, "RASTERSIZE", NULL);
}
Ejemplo n.º 16
0
int main(int argc, char** argv)
{
  IupOpen(&argc, &argv);                        

#ifdef USE_CONTEXTPLUS
  cdInitContextPlus();
#endif
#ifdef USE_OPENGL
  IupGLCanvasOpen();
#endif

  simple_loadled();
#ifdef USE_OPENGL
  {
    Ihandle* dialog = IupGetHandle("SimpleDialog");
    Ihandle* canvas = IupGetHandle("SimpleCanvas");
    IupDestroy(canvas);
    canvas = IupGLCanvas("SimpleRepaint");
    IupSetAttribute(canvas, "BUFFER", "DOUBLE");
    IupSetHandle("SimpleCanvas", canvas);
    IupAppend(dialog, canvas);
  }
#endif

  IupSetAttribute(IupGetHandle("SimpleDialog"), "SIZE", "HALFxHALF");
  IupSetAttribute(IupGetHandle("SimpleDialog"), "PLACEMENT", "MAXIMIZED");
  IupShow(IupGetHandle("SimpleDialog"));
  IupSetAttribute(IupGetHandle("SimpleDialog"), "SIZE", NULL);

  SimpleCreateCanvas((char*)IupGetHandle("SimpleCanvas"));

  IupSetFunction("cmdExit", (Icallback) cmdExit);

  IupSetFunction("SimplePlayClipboard", (Icallback) SimplePlayClipboard);
  IupSetFunction("SimplePlayCGMText", (Icallback) SimplePlayCGMText);
  IupSetFunction("SimplePlayCGMBin", (Icallback) SimplePlayCGMBin);
  IupSetFunction("SimplePlayMetafile", (Icallback) SimplePlayMetafile);
  IupSetFunction("SimplePlayWMF", (Icallback) SimplePlayWMF);
  IupSetFunction("SimplePlayEMF", (Icallback) SimplePlayEMF);

  IupSetFunction("SimpleDrawDebug", (Icallback) SimpleDrawDebug);
  IupSetFunction("SimpleDrawWindow", (Icallback) SimpleDrawWindow);
  IupSetFunction("SimpleDrawCGMText", (Icallback) SimpleDrawCGMText);
  IupSetFunction("SimpleDrawCGMBin", (Icallback) SimpleDrawCGMBin);
  IupSetFunction("SimpleDrawDXF", (Icallback) SimpleDrawDXF);
  IupSetFunction("SimpleDrawDGN", (Icallback) SimpleDrawDGN);
  IupSetFunction("SimpleDrawEMF", (Icallback) SimpleDrawEMF);
  IupSetFunction("SimpleDrawMetafile", (Icallback) SimpleDrawMetafile);
  IupSetFunction("SimpleDrawPDF", (Icallback) SimpleDrawPDF);
  IupSetFunction("SimpleDrawPS", (Icallback) SimpleDrawPS);
  IupSetFunction("SimpleDrawEPS", (Icallback) SimpleDrawEPS);
  IupSetFunction("SimpleDrawSVG", (Icallback) SimpleDrawSVG);
  IupSetFunction("SimpleDrawWMF", (Icallback)SimpleDrawWMF);
  IupSetFunction("SimpleDrawPPTX", (Icallback)SimpleDrawPPTX);
  IupSetFunction("SimpleDrawPrint", (Icallback)SimpleDrawPrint);
  IupSetFunction("SimpleDrawPrintDialog", (Icallback) SimpleDrawPrintDialog);
  IupSetFunction("SimpleDrawClipboardBitmap", (Icallback) SimpleDrawClipboardBitmap);
  IupSetFunction("SimpleDrawClipboardMetafile", (Icallback) SimpleDrawClipboardMetafile);
  IupSetFunction("SimpleDrawClipboardEMF", (Icallback) SimpleDrawClipboardEMF);
  IupSetFunction("SimpleDrawImage", (Icallback) SimpleDrawImage);
  IupSetFunction("SimpleDrawImageRGB", (Icallback) SimpleDrawImageRGB);
  IupSetFunction("SimpleDrawSimulate", (Icallback) SimpleDrawSimulate);

#ifdef USE_OPENGL
  IupSetFunction("SimpleDrawGL", (Icallback) SimpleDrawGL);
#endif

  IupSetFunction("SimpleNotXor", (Icallback) SimpleNotXor);
  IupSetFunction("SimpleXor", (Icallback) SimpleXor);
  IupSetFunction("SimpleReplace", (Icallback) SimpleReplace);
  IupSetFunction("SimpleClippingOff", (Icallback) SimpleClippingOff);
  IupSetFunction("SimpleClippingArea", (Icallback) SimpleClippingArea);
  IupSetFunction("SimpleClippingPolygon", (Icallback) SimpleClippingPolygon);
  IupSetFunction("SimpleClippingRegion", (Icallback) SimpleClippingRegion);
  IupSetFunction("SimpleContextPlus", (Icallback) SimpleContextPlus);
  IupSetFunction("SimpleTransform", (Icallback) SimpleTransform);

  IupSetFunction("SimpleAll", (Icallback) SimpleAll);
  IupSetFunction("SimpleTextAlign", (Icallback)SimpleTextAlign);
  IupSetFunction("SimpleTextFonts", (Icallback)SimpleTextFonts);
  IupSetFunction("SimpleTest", (Icallback) SimpleTest);

  IupSetFunction("SimpleRepaint", (Icallback) SimpleRepaint);

  SimpleDrawWindow();

#ifdef USE_OPENGL
  SimpleUpdateSize(NULL);
  IupUpdate(IupGetHandle("SimpleCanvas"));
#endif

  IupMainLoop();

  SimpleKillCanvas();

#ifdef USE_CONTEXTPLUS
  cdFinishContextPlus();
#endif

  IupClose();

  return EXIT_SUCCESS;
}