static void doSingleTest(uint32_t pgmNum, int tex) {
    const char *pgmTxt = gFragmentTests[pgmNum]->txt;
    int pgm = createProgram(gVertexShader, pgmTxt);
    if (!pgm) {
        printf("error running test\n");
        return;
    }
    int loc = glGetUniformLocation(pgm, "u_tex0");
    if (loc >= 0) glUniform1i(loc, 0);
    loc = glGetUniformLocation(pgm, "u_tex1");
    if (loc >= 0) glUniform1i(loc, 1);


    glActiveTexture(GL_TEXTURE0);
    glBindTexture(GL_TEXTURE_2D, tex);
    glActiveTexture(GL_TEXTURE1);
    glBindTexture(GL_TEXTURE_2D, tex);
    glActiveTexture(GL_TEXTURE0);

    glBlendFunc(GL_ONE, GL_ONE);
    glDisable(GL_BLEND);
    //sprintf(str2, "%i, %i, %i, %i, %i, 0",
            //useVarColor, texCount, modulateFirstTex, extraMath, tex0);
    //doLoop(true, pgm, w, h, str2);
    //doLoop(false, pgm, w, h, str2);

    glEnable(GL_BLEND);
    sprintf(gCurrentTestName, "%s, %i, %i, 1", gFragmentTests[pgmNum]->name, pgmNum, tex);
    doLoop(true, pgm, 100);
    doLoop(false, pgm, 100);
}
int main() {
    doSetup();

    while(1) {
        doLoop();
    }
}
示例#3
0
 void Parser::block(std::string l)
 {
     while (input.getChar() != '}') {
         fin();
         switch (input.getChar()) {
             case 'i':
                 doIf(l);
                 break;
             case 'w':
                 doWhile();
                 break;
             case 'l':
                 doLoop();
                 break;
             case 'r':
                 doDoWhile();
                 break;
             case 'f':
                 doFor();
                 break;
             case 'd':
                 doDo();
                 break;
             case 'b':
                 doBreak(l);
                 break;
             default:
                 assignment();
                 break;
         }
         fin();
     }
 }
/* analisa e traduz um bloco de comandos */
void block(int exitLabel)
{
	int follow;

	follow = 0;

	while (!follow) {
		switch (look) {
		  case 'i':
		   	doIf(exitLabel); break;
		  case 'w':
		   	doWhile(); break;
                  case 'p':
                        doLoop(); break;
                  case 'r':
                   	doRepeat(); break;
                  case 'f':
                        doFor(); break;
                  case 'd':
                        doDo(); break;
                  case 'b':
                        doBreak(exitLabel); break;
		  case 'e':
		  case 'l':
		  case 'u':
		   	follow = 1;
		   	break;
		  default:
		   	other(); break;
                }
	}
}
void EventLoop::entry()
{
	mCommunicationPolicy->init();
	if ( !hasEntryPoints() )
	{
		throw std::logic_error("EventLoop: This loop has no EntryPoints!");
	}

	// Run synchronously
	callEntryPoints(this);
	
	while(!mShouldExit)
		doLoop();

//	mCommunicationPolicy->deinit();
	mThreadingPolicy->stop();
}
示例#6
0
	bool Abstract::doExecute()
	{
		while (!doLoop())
			;
		return true;
	}
示例#7
0
// Welcome to Maine
int main(int argc, char *argv[])
{
    // Process arguments
    int i;
    for (i = 1; i < argc; i++)
    {
        std::string param = argv[i];
        if (param.compare("--help") == 0)
        {
            std::cout << USAGE_MSG;
            return 0;
        }
        else
        {
            size_t pos = param.find("=");
            if (pos == std::string::npos)
            {
                std::cout << "Error: Expected --option=VALUE (" << param << ")\n\n";
                std::cout << USAGE_MSG;
                return 1;
            }
            std::string option = param.substr(0, pos);
            std::string value;
            try
            {
                value = param.substr(pos + 1);
            }
            catch (const std::out_of_range& oor)
            {
                std::cout << "Error: No value supplied to option (" << option << ")\n";
                return 1;
            }
            if (option.compare("--bind-port") == 0)
            {
                try
                {
                    rcv_port = std::stoi(value);
                }
                catch (const std::invalid_argument& ia)
                {
                    std::cout << "Error: Bad number supplied to option (" << option << ")\n";
                    return 1;
                }
            }
            else if (option.compare("--send-port") == 0)
            {
                try
                {
                    snd_port = std::stoi(value);
                }
                catch (const std::invalid_argument& ia)
                {
                    std::cout << "Error: Bad number supplied to option (" << option << ")\n";
                    return 1;
                }
            }
            else if (option.compare("--send-addr") == 0)
            {
                snd_address = value;
            }
            else if (option.compare("--skip-bytes") == 0)
            {
                try
                {
                    skip_bytes = std::stoi(param.substr(13));
                }
                catch (const std::invalid_argument& ia)
                {
                    std::cout << "Error: Bad number supplied to option (" << option << ")\n";
                    return 1;
                }
                if (skip_bytes < 0)
                    skip_bytes = 0;
            }
            else
            {
                std::cout << "Error: Unknown option (" << option << ")\n\n";
                std::cout << USAGE_MSG;
                return 1;
            }
        }
    }

    // Modipulate: set up
    std::cout << PFX_INFO << "Modipulate: Setting up\n";
    err = modipulate_global_init();
    if (!MODIPULATE_OK(err))
    {
        std::cout << PFX_ERR << "Modipulate: " << modipulate_global_get_last_error_string() << "\n";
        goto cleanup_post;
    }

    // oscpkt: setup
    socketSend.connectTo(snd_address, snd_port);
    if (!socketSend.isOk())
    {
        std::cout << PFX_ERR << "Error opening port " << snd_port << ": " << socketSend.errorMessage() << "\n";
        goto cleanup_modipulate;
    }

    socketReceive.bindTo(rcv_port);
    if (!socketReceive.isOk())
    {
        std::cout << PFX_ERR << "Error opening port " << rcv_port << ": " << socketReceive.errorMessage() << "\n";
        goto cleanup_modipulate;
    }


    // Let's a-go!
    std::cout << PFX_INFO << "Listening for OSC messages on port " << rcv_port << "\n";
    std::cout << PFX_INFO << "Sending OSC messages to " << snd_address << ":" << snd_port << "\n";
    if (skip_bytes > 0)
        std::cout << PFX_INFO << "Skipping " << skip_bytes << " bytes of incoming packets\n";
    doLoop();
    // ...and we're done.


cleanup_modipulate:
    // Modipulate: shut down
    std::cout << PFX_INFO << "Closing up Modipulate...\n";
    err = modipulate_global_deinit();
    if (!MODIPULATE_OK(err))
        std::cout << PFX_ERR << "Modipulate: " << modipulate_global_get_last_error_string() << "\n";

cleanup_post:
    std::cout << "\nHave a nice day.\n\n";

    return 0;
}