本文整理汇总了C++中sf::RenderWindow::Capture方法的典型用法代码示例。如果您正苦于以下问题:C++ RenderWindow::Capture方法的具体用法?C++ RenderWindow::Capture怎么用?C++ RenderWindow::Capture使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sf::RenderWindow
的用法示例。
在下文中一共展示了RenderWindow::Capture方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: renderFrame
void renderFrame() {
//perform HSI converison
GL_CHECK(glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT));
GLuint programID = hsi->programID();
GL_CHECK(glUseProgram(programID));
DrawQuad(programID);
GL_CHECK(glUseProgram(0));
*frame = window.Capture();
//perform dilation
GL_CHECK(glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT));
programID = dilation->programID();
GL_CHECK(glUseProgram(programID));
DrawQuad(programID);
GL_CHECK(glUseProgram(0));
*frame = window.Capture();
dilate = false;
//perform erosion
GL_CHECK(glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT));
programID = erosion->programID();
GL_CHECK(glUseProgram(programID));
DrawQuad(programID);
GL_CHECK(glUseProgram(0));
*frame = window.Capture();
Blob* boundaries[BASE_SIZE];
int nBlob = 0;
memset(boundaries,0,sizeof(boundaries));
sf::Image *labels = new sf::Image(frame->GetWidth(), frame->GetHeight());
LabelRegions(frame, labels, boundaries, &nBlob);
//printf("%d\n", nBlob);
// draw rectangles
for (int i=1; i<= nBlob; i++){
// find the points
BlobPoint ll, ur;
ll.x = 99999;
ll.y = 99999;
ur.x = 0;
ur.y = 0;
Blob* blob = boundaries[i];
BlobPoint* next = blob->points;
printf("%d\n", blob->numPoints);
while(next != NULL)
{
if(next->x < ll.x) ll.x = next->x;
if(next->y < ll.y) ll.y = next->y;
if(next->x > ur.x) ur.x = next->x;
if(next->y > ur.y) ur.y = next->y;
next = next->nextPoint;
}
ll.x -= 2;
ll.y -= 2;
ur.x += 2;
ur.y += 2;
bool fillBlack = false;
if (!circleTest(blob)) {
fillBlack = true;
}
drawRectangle(frame, ll, ur, sf::Color(0,0,255), fillBlack);
}
GL_CHECK(glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT));
programID = dead->programID();
GL_CHECK(glUseProgram(programID));
DrawQuad(programID);
GL_CHECK(glUseProgram(0));
FreeAllRegions(boundaries, nBlob);
}