void CTalkDlg::initAction() { connect(ui->pb_close, SIGNAL(clicked()), this, SLOT(close())); connect(m_link, SIGNAL(connectedsuccessful()), this, SLOT(connected2server())); connect(m_link, SIGNAL(connectionFailedSignal()),this, SLOT(connect2serverFaild())); connect(m_link, SIGNAL(dataIsReady(string)), this, SLOT(readBack(string))); }
//same comment as for copyFromHostToGPU(bool enforceBlockOrUnblock) apply ;( void BufferInterface::readBack(bool enforceBlockOrUnblock)throw(BufferException) { cl_bool blockGlobalTmp = PARA_COMP_MANAGER->getBlockAfterEnqueue(); //override global state; PARA_COMP_MANAGER->setBlockAfterEnqueue(enforceBlockOrUnblock ? CL_TRUE : CL_FALSE ); //standard readback function; readBack(); //restore global blocking stuff PARA_COMP_MANAGER->setBlockAfterEnqueue(blockGlobalTmp); }
TEST(Image, RoundTrip) { nyra::Image originalImage( nyra::Constants::APP_PATH + "../data/unittests/lena.png"); const std::string writePathname( nyra::Constants::APP_PATH + "../data/unittests/image_test.png"); originalImage.write(writePathname); nyra::Image readBack(writePathname); EXPECT_EQ(originalImage, readBack); }
void main(int argc, char ** argv) { int argc_ = 1; char *argv_[1] = {(char *)"something"}; glutInit(&argc_, argv_); // initialize the toolkit glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB); // set the display mode glutInitWindowSize(screenWidth, screenWidth); // set the window size glutInitWindowPosition(0, 0); // set the window position on screen glutCreateWindow("opengl fbo example"); // open the screen window //if(!glfwInit()) { // printf("glfwinit fail"); // return ; //} #ifndef FBO glutDisplayFunc(renderFBO); // register the redraw function #endif GLenum err = glewInit(); if(GLEW_OK != err) { printf("glewInit Error: %s\n", glewGetErrorString(err)); getchar(); return ; } myInit(); glslProcess(); #ifdef FBO for(int i=1;i<3;++i) { char filename[30]; sprintf(filename, "%d.png", i+1); img = cv::imread(filename); if(img.empty()) return ; //cv::cvtColor(img, img, CV_BGR2RGB); renderFBO(); readBack(); //cv::cvtColor(img1, img1, CV_BGR2RGB); printf("output img, width is %d, height is %d, %d\n", img1.cols, img1.rows, img1.channels()); sprintf(filename, "D:\\%d.bmp", 20+i); cv::imwrite(filename, img1); } //getchar(); #else glutMainLoop(); // go into a perpetual loop #endif }
TEST( VectorReference, OperatorValueType ) { bolt::BCKND::device_vector< int > dV( 5 ); dV[ 0 ] = 1; dV[ 1 ] = 2; dV[ 2 ] = 3; dV[ 3 ] = 4; dV[ 4 ] = 5; std::vector< int > readBack( 5 ); readBack[ 0 ] = dV[ 0 ]; readBack[ 1 ] = dV[ 1 ]; readBack[ 2 ] = dV[ 2 ]; readBack[ 3 ] = dV[ 3 ]; readBack[ 4 ] = dV[ 4 ]; EXPECT_EQ( readBack[ 0 ], dV[ 0 ] ); EXPECT_EQ( readBack[ 1 ], dV[ 1 ] ); EXPECT_EQ( readBack[ 2 ], dV[ 2 ] ); EXPECT_EQ( readBack[ 3 ], dV[ 3 ] ); EXPECT_EQ( readBack[ 4 ], dV[ 4 ] ); }
void init(void) { int i; for(i=0;i<numSpheres;i++){ spheres[i][0] = (rand()%600)-300;//XPOS spheres[i][1] = (rand()%600)-300;//YPOS spheres[i][2] = rand()%400;//ZPOS spheres[i][3] = rand()%20;//SIZE spheres[i][4] = (rand()%20);//SPEED } MAXROT = 1.0/6.0*PI; glClearColor (0.0, 0.0, 0.0, 0.0); glEnable(GL_DEPTH_TEST); glShadeModel(GL_SMOOTH); pmodel = glmReadOBJ("city.obj"); if (!pmodel) fprintf(stderr,"Cannot parse vase.obj"); //glmUnitize(pmodel); // make model to fit in a unit cube glmFacetNormals(pmodel); // generate normals - is this needed? glmVertexNormals(pmodel, 90.0); // average joining normals - allow for hard edges. tmodel = glmReadOBJ("tower.obj"); glmFacetNormals(tmodel); // generate normals - is this needed? glmVertexNormals(tmodel, 90.0); // average joining normals - allow for hard edges. readTop(); readFront(); readBack(); readRight(); readLeft(); readFire(); glPixelStorei(GL_UNPACK_ALIGNMENT, 1); glGenTextures(1, &front); glGenTextures(1, &top); glGenTextures(1, &left); glGenTextures(1, &right); glGenTextures(1, &back); glGenTextures(1, &fire); qsphere = gluNewQuadric(); }
void Serialize::runHk() { setGeometry(); writeXMLtagfile(); readBack(); }
void test2() { readBack(); }
const T& max(unsigned w) const { T m=readBack(0); unsigned mi=0; for(unsigned i=1; i<w; ++i) if(readBack(i)>m){ m=readBack(i); mi=i; } return readBack(mi); }
void test1() { readBack(); }
void main(int argc, char ** argv) { int argc_ = 1; char *argv_[1] = {(char *)"something"}; //glutInit(&argc_, argv_); // initialize the toolkit //GLuint glutwindow = glutCreateWindow("something"); // open the screen window if(!glfwInit()) { printf("glfwinit fail"); return ; } CheckGlErrors("glfwInit"); GLFWwindow *glfwwindow = glfwCreateWindow(screenWidth, screenHeight, "example", NULL, NULL); CheckGlErrors("glfwCreateWindow"); if(glfwwindow == NULL) { printf("glfwCreateWindow fail"); glfwTerminate(); return ; } glfwHideWindow(glfwwindow); CheckGlErrors("glfwHideWindow"); glfwMakeContextCurrent(glfwwindow); CheckGlErrors("glfwMakeContextCurrent"); #ifndef FBO glutDisplayFunc(renderFBO); // register the redraw function #endif GLenum err = glewInit(); if(GLEW_OK != err) { printf("glewInit Error: %s\n", glewGetErrorString(err)); getchar(); return ; } myInit(); glslProcess(); #ifdef FBO for(int i=1;i<3;++i) { char filename[30]; sprintf(filename, "%d.png", i+1); img = cv::imread(filename); if(img.empty()) return ; //cv::cvtColor(img, img, CV_BGR2RGB); renderFBO(); readBack(); //cv::cvtColor(img1, img1, CV_BGR2RGB); printf("output img, width is %d, height is %d, %d\n", img1.cols, img1.rows, img1.channels()); sprintf(filename, "D:\\%d.bmp", 20+i); cv::imwrite(filename, img1); } //getchar(); #else glutMainLoop(); // go into a perpetual loop #endif glDeleteFramebuffers(1, &fb); glDeleteTextures(2, texId); //glutDestroyWindow(glutwindow); glfwTerminate(); getchar(); }