// This test is intended to verify that proper synchronization is done when
// rendering into an FBO.
TEST_F(SurfaceTextureFBOTest, BlitFromCpuFilledBufferToFbo) {
    const int texWidth = 64;
    const int texHeight = 64;

    ASSERT_EQ(NO_ERROR, native_window_set_buffers_geometry(mANW.get(),
            texWidth, texHeight, HAL_PIXEL_FORMAT_RGBA_8888));
    ASSERT_EQ(NO_ERROR, native_window_set_usage(mANW.get(),
            GRALLOC_USAGE_SW_READ_OFTEN | GRALLOC_USAGE_SW_WRITE_OFTEN));

    android_native_buffer_t* anb;
    ASSERT_EQ(NO_ERROR, native_window_dequeue_buffer_and_wait(mANW.get(),
            &anb));
    ASSERT_TRUE(anb != NULL);

    sp<GraphicBuffer> buf(new GraphicBuffer(anb, false));

    // Fill the buffer with green
    uint8_t* img = NULL;
    buf->lock(GRALLOC_USAGE_SW_WRITE_OFTEN, (void**)(&img));
    fillRGBA8BufferSolid(img, texWidth, texHeight, buf->getStride(), 0, 255,
            0, 255);
    buf->unlock();
    ASSERT_EQ(NO_ERROR, mANW->queueBuffer(mANW.get(), buf->getNativeBuffer(),
            -1));

    ASSERT_EQ(NO_ERROR, mST->updateTexImage());

    glBindFramebuffer(GL_FRAMEBUFFER, mFbo);
    drawTexture();
    glBindFramebuffer(GL_FRAMEBUFFER, 0);

    for (int i = 0; i < 4; i++) {
        SCOPED_TRACE(String8::format("frame %d", i).string());

        ASSERT_EQ(NO_ERROR, native_window_dequeue_buffer_and_wait(mANW.get(),
                &anb));
        ASSERT_TRUE(anb != NULL);

        buf = new GraphicBuffer(anb, false);

        // Fill the buffer with red
        ASSERT_EQ(NO_ERROR, buf->lock(GRALLOC_USAGE_SW_WRITE_OFTEN,
                (void**)(&img)));
        fillRGBA8BufferSolid(img, texWidth, texHeight, buf->getStride(), 255, 0,
                0, 255);
        ASSERT_EQ(NO_ERROR, buf->unlock());
        ASSERT_EQ(NO_ERROR, mANW->queueBuffer(mANW.get(),
                buf->getNativeBuffer(), -1));

        ASSERT_EQ(NO_ERROR, mST->updateTexImage());

        drawTexture();

        EXPECT_TRUE(checkPixel( 24, 39, 255, 0, 0, 255));
    }

    glBindFramebuffer(GL_FRAMEBUFFER, mFbo);

    EXPECT_TRUE(checkPixel( 24, 39, 0, 255, 0, 255));
}
TEST_F(SurfaceTextureGLToGLTest, TexturingFromPreRotatedGLFilledBuffer) {
    enum { texWidth = 64 };
    enum { texHeight = 16 };

    // This test requires 3 buffers to complete run on a single thread.
    mST->setDefaultMaxBufferCount(3);

    // Set the transform hint.
    mST->setTransformHint(NATIVE_WINDOW_TRANSFORM_ROT_90);

    // Set the default buffer size.
    mST->setDefaultBufferSize(texWidth, texHeight);

    // Do the producer side of things
    EXPECT_TRUE(eglMakeCurrent(mEglDisplay, mProducerEglSurface,
            mProducerEglSurface, mProducerEglContext));
    ASSERT_EQ(EGL_SUCCESS, eglGetError());

    // This is needed to ensure we pick up a buffer of the correct size and the
    // new rotation hint.
    eglSwapBuffers(mEglDisplay, mProducerEglSurface);

    glClearColor(0.6, 0.6, 0.6, 0.6);
    glClear(GL_COLOR_BUFFER_BIT);

    glEnable(GL_SCISSOR_TEST);
    glScissor(24, 4, 1, 1);
    glClearColor(1.0, 0.0, 0.0, 1.0);
    glClear(GL_COLOR_BUFFER_BIT);

    eglSwapBuffers(mEglDisplay, mProducerEglSurface);

    // Do the consumer side of things
    EXPECT_TRUE(eglMakeCurrent(mEglDisplay, mEglSurface, mEglSurface,
            mEglContext));
    ASSERT_EQ(EGL_SUCCESS, eglGetError());

    glDisable(GL_SCISSOR_TEST);

    // Skip the first frame, which was empty
    ASSERT_EQ(NO_ERROR, mST->updateTexImage());
    ASSERT_EQ(NO_ERROR, mST->updateTexImage());

    glClearColor(0.2, 0.2, 0.2, 0.2);
    glClear(GL_COLOR_BUFFER_BIT);

    glViewport(0, 0, texWidth, texHeight);
    drawTexture();

    EXPECT_TRUE(checkPixel( 0,  0, 153, 153, 153, 153));
    EXPECT_TRUE(checkPixel(63,  0, 153, 153, 153, 153));
    EXPECT_TRUE(checkPixel(63, 15, 153, 153, 153, 153));
    EXPECT_TRUE(checkPixel( 0, 15, 153, 153, 153, 153));

    EXPECT_TRUE(checkPixel(24,  4, 255,   0,   0, 255));
    EXPECT_TRUE(checkPixel(25,  5, 153, 153, 153, 153));
    EXPECT_TRUE(checkPixel(23,  3, 153, 153, 153, 153));
    EXPECT_TRUE(checkPixel(45, 13, 153, 153, 153, 153));
    EXPECT_TRUE(checkPixel(12,  8, 153, 153, 153, 153));
}
TEST_F(SurfaceTextureGLToGLTest, TexturingFromUserSizedGLFilledBuffer) {
    enum { texWidth = 64 };
    enum { texHeight = 64 };

    // This test requires 3 buffers to complete run on a single thread.
    mST->setDefaultMaxBufferCount(3);

    // Set the user buffer size.
    native_window_set_buffers_user_dimensions(mANW.get(), texWidth, texHeight);

    // Do the producer side of things
    EXPECT_TRUE(eglMakeCurrent(mEglDisplay, mProducerEglSurface,
            mProducerEglSurface, mProducerEglContext));
    ASSERT_EQ(EGL_SUCCESS, eglGetError());

    // This is needed to ensure we pick up a buffer of the correct size.
    eglSwapBuffers(mEglDisplay, mProducerEglSurface);

    glClearColor(0.6, 0.6, 0.6, 0.6);
    glClear(GL_COLOR_BUFFER_BIT);

    glEnable(GL_SCISSOR_TEST);
    glScissor(4, 4, 1, 1);
    glClearColor(1.0, 0.0, 0.0, 1.0);
    glClear(GL_COLOR_BUFFER_BIT);

    eglSwapBuffers(mEglDisplay, mProducerEglSurface);

    // Do the consumer side of things
    EXPECT_TRUE(eglMakeCurrent(mEglDisplay, mEglSurface, mEglSurface,
            mEglContext));
    ASSERT_EQ(EGL_SUCCESS, eglGetError());

    glDisable(GL_SCISSOR_TEST);

    // Skip the first frame, which was empty
    ASSERT_EQ(NO_ERROR, mST->updateTexImage());
    ASSERT_EQ(NO_ERROR, mST->updateTexImage());

    glClearColor(0.2, 0.2, 0.2, 0.2);
    glClear(GL_COLOR_BUFFER_BIT);

    glViewport(0, 0, texWidth, texHeight);
    drawTexture();

    EXPECT_TRUE(checkPixel( 0,  0, 153, 153, 153, 153));
    EXPECT_TRUE(checkPixel(63,  0, 153, 153, 153, 153));
    EXPECT_TRUE(checkPixel(63, 63, 153, 153, 153, 153));
    EXPECT_TRUE(checkPixel( 0, 63, 153, 153, 153, 153));

    EXPECT_TRUE(checkPixel( 4,  4, 255,   0,   0, 255));
    EXPECT_TRUE(checkPixel( 5,  5, 153, 153, 153, 153));
    EXPECT_TRUE(checkPixel( 3,  3, 153, 153, 153, 153));
    EXPECT_TRUE(checkPixel(45, 52, 153, 153, 153, 153));
    EXPECT_TRUE(checkPixel(12, 36, 153, 153, 153, 153));
}
예제 #4
0
/*
    Tests that the pixels inside rect in image all have the given color.
*/
bool GuiTester::isFilled(const QImage image, const QRect &rect, const QColor &color)
{
    for (int y = rect.top(); y <= rect.bottom(); ++y)
        for (int x = rect.left(); x <= rect.right(); ++x) {
            const QColor pixel = image.pixel(x, y);
            if (checkPixel(pixel, color) == false) {
//                qDebug()<< "Wrong pixel value at" << x << y << pixel.red() << pixel.green() << pixel.blue();
                return false;
            }
        }
    return true;
}
예제 #5
0
/*
    Tests that stuff is painted to the pixels inside rect.
    This test fails if any lines in the given direction have pixels
    of only one color.
*/
bool GuiTester::isContent(const QImage image, const QRect &rect, Directions directions)
{
    if (directions & Horizontal) {
        for (int y = rect.top(); y <= rect.bottom(); ++y) {
            QColor currentColor = image.pixel(rect.left(), y);
            bool fullRun = true;
            for (int x = rect.left() + 1; x <= rect.right(); ++x) {
                if (checkPixel(image.pixel(x, y), currentColor) == false) {
                    fullRun = false;
                    break;
                }
            }
            if (fullRun) {
//                qDebug() << "Single-color line at horizontal line " << y  << currentColor;
                return false;
            }
        }
        return true;
    }

    if (directions & Vertical) {
        for (int x = rect.left(); x <= rect.right(); ++x) {
            QRgb currentColor = image.pixel(x, rect.top());
            bool fullRun = true;
            for (int y = rect.top() + 1; y <= rect.bottom(); ++y) {
                if (checkPixel(image.pixel(x, y), currentColor) == false) {
                    fullRun = false;
                    break;
                }
            }
            if (fullRun) {
//                qDebug() << "Single-color line at vertical line" << x << currentColor;
                return false;
            }
        }
        return true;
    }
    return false; // shut the compiler up.
}
예제 #6
0
    /**
     * @brief conv2d methods defines a convolution operations
     * @param _input
     * @param _kernel
     * @param dst
     */
    void conv2d(Mat _input,Mat _kernel,Mat &_out)
    {
            _image_height=_input.rows;
            _image_width =_input.cols;
            _kernel_height=_kernel.rows;
            _kernel_width=_kernel.cols;
            _image_channels=_input.channels ();
            _kernel_channels=_kernel.channels ();

            //dst.create (_image_height,_image_width,_input.type ());

            for(int y=0;y<_image_height;y++)
            {

            for(int x=0;x<_image_width;x++)
            {


                //performs computation for pixels in the valid range
                Point p=Point(x,y);

                //local variable used  to store convolution sum
                float value=0;
                //loop over the rows of the pixel neighborhood
                //loop over the columns of the pixels neighborhood
                for(int i=0;i<_kernel_height;i++)
                for(int j=0;j<_kernel_width;j++)
                {
                    Point pixel=Point(y+i-(_kernel_height/2),(x+j-(_kernel_width/2)));
                    //condition defines pixels lying within the image borders
                    bool flag=checkPixel (pixel);
                    if(flag==true)
                    {
                    T val=getPixelValue(_input,pixel);
                    value=value+val;
                    }
                   }

                //setting the result in the destination matrix
                setPixelValue (_out,Point(x,y),value);
            }


            }

            }
예제 #7
0
TArray<FVector> PrivateLeapImage::TrackFromLeapImage(const int32 SrcWidth, const int32 SrcHeight, uint8* imageBuffer, const uint8 brightnessThresholdIn, const uint8 brightnessThresholdOut)
{
	// Initialize search
	uint8* SrcPtr = NULL;
	FVector blob;
	int stackLimit;
	TArray<FVector> blobs2D;

	std::vector<uint8> checkPixel(SrcWidth*SrcHeight);

	for (int32 x = 0; x < SrcHeight * SrcWidth; x++)
		checkPixel[x] = 0;

	pixelsFound = 0;
	pixelLimit = 400;

	uint8 Value;
	int32 blobIndex = -1;

	for (int32 y = 0; y<SrcHeight; y++)
	{
		//		DestPtr = &MipData[(SrcHeight - 1 - y) * SrcWidth * sizeof(uint8)];
		for (int32 x = 0; x<SrcWidth; x++)
		{
			SrcPtr = (&imageBuffer[y * SrcWidth + x]);
			Value = *SrcPtr;
			if ((Value > brightnessThresholdIn) && (checkPixel[y * SrcWidth + x] == 0)) {
				pixelsFound = 0;
				stackLimit = 1;
				blob = FindBlob(SrcWidth, SrcHeight, y * SrcWidth + x, checkPixel, 0, imageBuffer, &stackLimit, brightnessThresholdIn, brightnessThresholdOut);
				if (stackLimit == 2) {
					UE_LOG(LeapPluginLog, Warning, TEXT("Blob too large!"));
				}
				if ((blob != FVector(0.f, 0.f, 0.f)) && (stackLimit == 1)) {
					blobIndex++;
					blobs2D.Add(FVector(-blob.X / blob.Z, -blob.Y / blob.Z, 1.f));
				}
			}
		}
	}

	return blobs2D;
}
예제 #8
0
int main()
{
	int arrayTwo[25344],temp2[25344],Npixels=25344;
        uchar numbers[25344];
	int indices[25344];
	int pixelClass[144][176];
	int *temp3;
	uchar *arrayOne;
	temp3 = (int*)pixelClass;

//initialize indices
for (int i=0;i<25344;i++)
{
indices[i]=i;
temp3[i]=0;
}

//read image
Mat image=imread("distance4.png",0);
cvtColor(image,image2,CV_GRAY2RGB);
//merge sort pixel depth values
arrayOne = image.data;
originalImage= image.data;

for (int i=0;i<25344;i++)
{
numbers[i]=arrayOne[i];
}
mergeSort(numbers,indices,arrayTwo, temp2, 25344);

/*
	for (int i = 0; i < 25344; i++)
	{
	
        {//cout<<"ha"<<i<<" "<<indices[i]<<" ";
	cout<<int(numbers[i])<<" ";}
	}
*/

int xmax,xmin,ymax,ymin,zmax,zmin,objectNo,j2;
objectNo=1;

//run through pixels considering the closest pixel first (check this)
for (int i=0;i<Npixels;i++)
{
//if pixel is not classified as object yet, seed the pixel
xmax=0;xmin=imageWidth-1;ymax=0;ymin=imageHeight-1;zmax=0;zmin=255,j2=0;

//if (i>25270) {cout<<"man"<<indices[i]/imageWidth<<" "<<indices[i]%imageWidth;cin>>temp2[2];}
   if (pixelClass[indices[i]/imageWidth][indices[i]%imageWidth]==0 && numbers[i]<thresh2 && numbers[i]>thresh3)
       {
	//cout<<objectNo<<" "<<indices[i]%imageWidth<<" "<<indices[i]/imageWidth<<" "<<i;cin>>temp2[2];
	checkPixel(indices[i]%imageWidth,indices[i]/imageWidth,pixelClass,xmax,xmin,ymax,ymin,zmax,zmin,objectNo,j2);
	
	//Store details of segmented object location,width,hieght and depth of bb 
        objects[objectNo][0]=xmin;objects[objectNo][1]=xmax;objects[objectNo][2]=ymin;objects[objectNo][3]=ymax;
        objects[objectNo][4]=zmin;objects[objectNo][5]=zmax;
        if (j2>1500) 
	    {
//cout<<xmin<<" ";
	     objectNo++;
	     rectangle(image2, cvPoint(xmin,ymin), cvPoint(xmax,ymax), CV_RGB( rand()&255, rand()&255, rand()&255 ), 1);
//imwrite("answer.bmp",image2);cin>>temp2[2];
	    }

        }
}
imwrite("answer.bmp",image2);

return 0;
}//end main2
TEST_F(SurfaceTextureGLToGLTest, TexturingFromGLFilledRGBABufferPow2) {
    const int texWidth = 64;
    const int texHeight = 64;

    mST->setDefaultBufferSize(texWidth, texHeight);

    // This test requires 3 buffers to complete run on a single thread.
    mST->setDefaultMaxBufferCount(3);

    // Do the producer side of things
    EXPECT_TRUE(eglMakeCurrent(mEglDisplay, mProducerEglSurface,
            mProducerEglSurface, mProducerEglContext));
    ASSERT_EQ(EGL_SUCCESS, eglGetError());

    // This is needed to ensure we pick up a buffer of the correct size.
    eglSwapBuffers(mEglDisplay, mProducerEglSurface);

    glClearColor(0.6, 0.6, 0.6, 0.6);
    glClear(GL_COLOR_BUFFER_BIT);

    glEnable(GL_SCISSOR_TEST);
    glScissor(4, 4, 4, 4);
    glClearColor(1.0, 0.0, 0.0, 1.0);
    glClear(GL_COLOR_BUFFER_BIT);

    glScissor(24, 48, 4, 4);
    glClearColor(0.0, 1.0, 0.0, 1.0);
    glClear(GL_COLOR_BUFFER_BIT);

    glScissor(37, 17, 4, 4);
    glClearColor(0.0, 0.0, 1.0, 1.0);
    glClear(GL_COLOR_BUFFER_BIT);

    eglSwapBuffers(mEglDisplay, mProducerEglSurface);

    // Do the consumer side of things
    EXPECT_TRUE(eglMakeCurrent(mEglDisplay, mEglSurface, mEglSurface,
            mEglContext));
    ASSERT_EQ(EGL_SUCCESS, eglGetError());

    glDisable(GL_SCISSOR_TEST);

    // Skip the first frame, which was empty
    ASSERT_EQ(NO_ERROR, mST->updateTexImage());
    ASSERT_EQ(NO_ERROR, mST->updateTexImage());

    glClearColor(0.2, 0.2, 0.2, 0.2);
    glClear(GL_COLOR_BUFFER_BIT);

    glViewport(0, 0, texWidth, texHeight);
    drawTexture();

    EXPECT_TRUE(checkPixel( 0,  0, 153, 153, 153, 153));
    EXPECT_TRUE(checkPixel(63,  0, 153, 153, 153, 153));
    EXPECT_TRUE(checkPixel(63, 63, 153, 153, 153, 153));
    EXPECT_TRUE(checkPixel( 0, 63, 153, 153, 153, 153));

    EXPECT_TRUE(checkPixel( 4,  7, 255,   0,   0, 255));
    EXPECT_TRUE(checkPixel(25, 51,   0, 255,   0, 255));
    EXPECT_TRUE(checkPixel(40, 19,   0,   0, 255, 255));
    EXPECT_TRUE(checkPixel(29, 51, 153, 153, 153, 153));
    EXPECT_TRUE(checkPixel( 5, 32, 153, 153, 153, 153));
    EXPECT_TRUE(checkPixel(13,  8, 153, 153, 153, 153));
    EXPECT_TRUE(checkPixel(46,  3, 153, 153, 153, 153));
    EXPECT_TRUE(checkPixel(30, 33, 153, 153, 153, 153));
    EXPECT_TRUE(checkPixel( 6, 52, 153, 153, 153, 153));
    EXPECT_TRUE(checkPixel(55, 33, 153, 153, 153, 153));
    EXPECT_TRUE(checkPixel(16, 29, 153, 153, 153, 153));
    EXPECT_TRUE(checkPixel( 1, 30, 153, 153, 153, 153));
    EXPECT_TRUE(checkPixel(41, 37, 153, 153, 153, 153));
    EXPECT_TRUE(checkPixel(46, 29, 153, 153, 153, 153));
    EXPECT_TRUE(checkPixel(15, 25, 153, 153, 153, 153));
    EXPECT_TRUE(checkPixel( 3, 52, 153, 153, 153, 153));
}
예제 #10
0
/**
 * Add error checking.
 *
 * orig - buffered tiff elevation model
 * minNorthing - ulNorthing
 * minEasting - ulEasting
 */
int findTreeTops(float **orig, double * mpsData, int imageLength, int imageWidth, double ulEasting, double ulNorthing, 
	int run_range3, float range3_min, float range3_max, 
	int run_range5, float range5_min, float range5_max,
	int run_range7, float range7_min, float range7_max,
	int run_range9, float range9_min, float range9_max, 
	int run_range11, float range11_min, float range11_max, 
	SHPHandle hshp, DBFHandle hdbf, int smooth_type, int add_noise)
{
	puts("findTreeTops");

	int i, j, length, width;
	float **gridded;
	
	// dimensions of gridded
	length  = imageLength + 4;
	width   = imageWidth  + 4;
	
	gridded = smoothAndPad(orig, imageLength, imageWidth, smooth_type);
	if(!gridded)
		return 0;
	
	if (add_noise) {
		for(i = 1; i < length - 1; i++)
			for(j = 1; j < width - 1 ; j++)
				gridded[i][j] += box_muller(0,1)*0.001;
	}
	
	//determine if necessary
	extrapolateEdges(gridded, length, width);
	
	puts("Checking pixels.");
	
	for(j = 2; j < width-2; j++)//each col
	{ 
		for(i = 2; i < length-2; i++) //each row
		{
			float height = gridded[i][j];
			
			// 3 = 1 + 2
			if(i >= 3 && j >= 3 && i < length-3 && j < width-3 && run_range3 && height >= range3_min && height < range3_max)
			{
				checkPixel(gridded, orig, i, j, 3, 9, mpsData, ulEasting, ulNorthing, hshp, hdbf);
			}
			// 4 = 2 + 2 = half_window+buffer
			else if(i >= 4 && j >= 4 && i < length-4 && j < width-4 && run_range5 && height >= range5_min && height < range5_max)
			{
				checkPixel(gridded, orig, i, j, 5, 25, mpsData, ulEasting, ulNorthing, hshp, hdbf);
			}
			else if(i >= 5 && j >= 5 && i < length-5 && j < width-5 && run_range7 && height >= range7_min && height < range7_max)
			{
				checkPixel(gridded, orig, i, j, 7, 49, mpsData, ulEasting, ulNorthing, hshp, hdbf);
			}
			else if(i >= 6 && j >= 6 && i < length-6 && j < width-6 && run_range9 && height >= range9_min && height < range9_max)
			{
				checkPixel(gridded, orig, i, j, 9, 81, mpsData, ulEasting, ulNorthing, hshp, hdbf);
			}
			else if(i >= 7 && j >= 7 && i < length-7 && j < width-7 && run_range11 && height >= range11_min && height < range11_max)
			{
				checkPixel(gridded, orig, i, j, 11, 121, mpsData, ulEasting, ulNorthing, hshp, hdbf);
			}
		}
	}
	
	freef2d(gridded, length);
	freef2d(orig, imageLength);
	
	return 1;
}
예제 #11
0
int map (struct DIVERSsysteme *systeme,struct typeFORthreads *online,struct PACKbouton *bouton ,struct PACKobjet *objet,
        struct PERSO *perso,struct DIVERSinventaire *inventaire,struct DIVERSdeplacement *deplacement,
		struct DIVERStemps *temps,struct DIVERSui *ui,struct DIVERSchat *chat,struct DIVERScraft *craft,
		struct PACKrecompense *recompense,struct typeFORevent *FORevent,struct TIR *TIR)
{
    int index;
    chargement(systeme);
    #if CHEAT == 1

    for (index = 0 ; index < TAILLESAC ; index++)
    {
        videemplacement(&FORevent->objet->sac1[index]);
    }
    for (index = 0 ; index < 10 ; index++)
    {
		insertionsac(objet, 0);
		insertionsac(objet, 2);
		insertionsac(objet, 7);
	}
	insertionsac(objet, 3);
	insertionsac(objet, 1);
	insertionsac(objet, 4);
	insertionsac(objet, 5);
	insertionsac(objet, 6);
	insertionsac(objet, 8);
	insertionsac(objet, 9);

    #endif

    struct DONJON dj0;
    initdonjon(&dj0, systeme);
    LoadDonjon(&dj0, "dj0");

    systeme->djisloaded = true;

    online->jeuxACTIF = 1;

    for(index = 0 ; index < MAX_JOUEURS ; index++)
    {
        online->joueurs[index].ppseudo.x = 20000;
        online->joueurs[index].ppseudo.y = 20000;
        online->joueurs[index].position.w = 0;
        online->joueurs[index].position.h = 0;
    }
    checkandrefreshstuff(perso, objet, systeme, ui);
    checkinventaire(objet, inventaire);

    glMatrixMode( GL_PROJECTION );
    glLoadIdentity();
    gluOrtho2D(0,screenw,0,screenh);
    glMatrixMode( GL_MODELVIEW );
    glLoadIdentity();

/*#############################################################################################################################################################
											##################### Boucle De Jeu #####################																					#
######################################################################################################################################################################*/
systeme->continuer = 1;
    while (systeme->continuer == 1)
    {

        temps->tpact = SDL_GetTicks();

        if (temps->tpact - temps->tpapr >= 15) /*15   ms*/
        {
            temps->tpapr = temps->tpact;
            temps->i++;

			/*sichronisation des données*/
			sinchronisation(craft, systeme, online, perso, &dj0);
			SyncMob(&dj0, perso);
            /*calcul direction joueur client*/
            deplacement->direction.direction = directionperso(&deplacement->direction);
            /*deplacement*/
            checkPixel(&dj0.map, perso, systeme);
            move_map(perso, &deplacement->direction, &dj0.origin);
            /*gestion des dégats*/
            hitboxplayer (&dj0, perso, systeme);
            /*recupération coordonées souris*/
            SDL_GetMouseState(&systeme->pointeur.pos.x, &systeme->pointeur.pos.y);
            systeme->pointeur.pos.y = (systeme->pointeur.pos.y - screenh + systeme->pointeur.pos.h) * -1;
            /*gestion de l'ui*/
            gestionui(systeme, ui, craft, bouton, chat, inventaire, objet, perso);
            /*detection des combats*/
           // detectioncombat(monstre, inventaire, ui, deplacement, objet, perso, systeme, recompense, false);
            /*gestion des evenement*/
            boucleevent(&online->chat.lancermessage, FORevent, TIR);
            /*gestion du chat*/
            gestionchat(chat, systeme, online);

            if (TIR->letirdemander == true)
            {
                gestiontir(TIR, systeme, perso, &dj0);
            }
            COMBATgestionprojectile (TIR, &dj0);


/*##################################################################################################################################################################################
											##################### AFFICHAGE #####################																	#
##################################################################################################################################################################################*/

            /*effacage de l'écran*/
                glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT) ;

            /*affichage de la carte*/
            draw_pict(&dj0.map.pict);
            for (index=0 ; index<dj0.nombremonstre ; index++)
            {
                if(dj0.mob[index].BarreDeVie->life > 0)
                {
                    turn_draw_hookpict(dj0.mob[index].angle, &dj0.mob[index].hookpict, &dj0.map.pict.pos);
                    CalculerBarreDeVie(dj0.mob[index].BarreDeVie->baselife , dj0.mob[index].BarreDeVie->life, 68);
                    setPos2rect(&dj0.mob[index].BarreDeVie->pBG, dj0.mob[index].hookpict.pict.pos.x-1 + ((dj0.mob[index].hookpict.pict.pos.w-68)/2),
                                dj0.mob[index].hookpict.pict.pos.y + dj0.mob[index].hookpict.pict.pos.h+4);
                    setPos4(&dj0.mob[index].BarreDeVie->pbarre, dj0.mob[index].hookpict.pict.pos.x + ((dj0.mob[index].hookpict.pict.pos.w-68)/2),
                                dj0.mob[index].hookpict.pict.pos.y + dj0.mob[index].hookpict.pict.pos.h+5,
                                CalculerBarreDeVie(dj0.mob[index].BarreDeVie->baselife , dj0.mob[index].BarreDeVie->life, 68), 5);

                    draw(systeme->BGnoir, &dj0.mob[index].BarreDeVie->pBG);
                    draw(systeme->BGblanc, &dj0.mob[index].BarreDeVie->pbarre);
                }
            }

            /*affichage des joueurs*/
            afficherJOUEURS(perso, deplacement, systeme, online, temps);

            BattleDraw_Projectile(TIR, &dj0);
            /*affichage du chat*/
            if (ui->chat_open == true)
            {
                afficherCHAT(chat, ui, online->chat.lenbuffer, systeme);
            }
            /*affichage de l'inventaire*/
            else if (ui->inventaire_open == true)
            {
                afficherINVENTAIRE(inventaire, ui, objet, systeme);
            }
            /*affichage de l'interface utilisateur*/
            afficherUI(online->isonline, ui, bouton, temps, perso, inventaire, systeme, recompense, objet);
            /*affichage de l'interface de crafting*/
            if (ui->craft_open == true)
            {
                afficherCRAFT(craft, ui, bouton, objet, inventaire, systeme);
            }
            /*affichage du pointeur*/
            afficherPOINTEUR(systeme, objet);

            /*rendu éran*/
            glFlush();
            glFinish();
            SDL_GL_SwapWindow(systeme->screen);
        }
        else
        {
			SDL_Delay(5);
		}

/*###########################################################################################################################
								##################### Frame Par Secondes #####################								#
###########################################################################################################################*/

        if (temps->tpact - temps->tpap >= 1000)
        {
            temps->temptotal++;

			/*if it's the first second of this player*/
            if (temps->temptotal == 5)
            {
                char texte[2548] = "\nprisonnier :  \n   salut ... \n ça tombe bien,\n j'avais besoin d'un coup de main !\n tiens ! prend ce lance pierre et vas nous chercher\nquelques rat !\n\n\n\n\n\n\n\n\n\n\n\n\n\n   APPUIE SUR ENTRÉE POUR CONTINUER";
                ui->dialogue_text.texture = fenetredialogue(screenw*0.4, screenh*0.8, &ui->dialogue_back.pos, &ui->dialogue_text.pos, texte, BLANC, systeme);
                ui->dialogueactif = 1;
                insertionsac(objet, 3);
            }

            if (temps->temptotal - temps->oldipourregen >= 3)
            {
                if (perso->life < perso->lifemax)
                {
                    perso->life += REGEN;
                    perso->life += perso->regenlife;
                    if (perso->life > perso->lifemax)
					{
						perso->life = perso->lifemax;
					}
                    temps->oldipourregen = temps->temptotal;
                }

            }
            else
			{
				if (perso->life < perso->lifemax)
                {
                    perso->life += perso->regenlife;
                    if (perso->life > perso->lifemax)
					{
						perso->life = perso->lifemax;
					}
                }
			}
            if (temps->temptotal - temps->tpspoursave >= 30)
            {
                sauvegardetout(systeme->sauvegarde, dj0.map.pict.pos, perso, temps->temptotal, 0, objet->sac1, TAILLESAC, ui);
                temps->tpspoursave = temps->temptotal;
            }

            sprintf(temps->StringI, "IPS => %d", temps->i);
            sprintf(perso->slife, "vie : %0.0f/%d", perso->life, perso->lifemax);
            sprintf(temps->stringtempstotal, "age du personnage : %dj %dh %dmin %dsec", calcultempsjours(temps->temptotal), calcultempsheures(temps->temptotal), calcultempsminutes(temps->temptotal), calcultempssecondes(temps->temptotal));

            temps->fps.texture = imprime (temps->StringI, screenw, BLANC, systeme, NULL, NULL);
            perso->tlife.texture = imprime (perso->slife, screenw, BLANC, systeme, NULL, NULL);
            temps->temps.texture = imprime (temps->stringtempstotal, screenw, BLANC, systeme, NULL, NULL);

            for(index = 0; index < 10 ; index++)
            {
                if(online->chat.schat[index][0] != '\0')
                {
                    chat->pstringchat[index].y = (screenh*0.5)+(online->chat.poschat[index]*(screenh*0.047));
                    SDL_DestroyTexture(chat->tstringchat[index]);
                  //  chat->tstringchat[index] = imprime(online->chat.schat[index], screenw, BLANC, systeme, NULL, NULL);
                }
            }

            temps->i = 0;
            temps->tpap = temps->tpact;
        }
    }

/*###########################################################################################################################
																															#
								##################### Fin de Fonction #####################									#
																														#
###########################################################################################################################*/

    sauvegardetout(systeme->sauvegarde, dj0.map.pict.pos, perso, temps->temptotal, 0, objet->sac1, TAILLESAC, ui);

    return 1;
}
    void runTest()
    {
        // Firstly ensure that no errors have been hit.
        EXPECT_GL_NO_ERROR();

        GLint viewportSize[4];
        glGetIntegerv(GL_VIEWPORT, viewportSize);

        // Clear to green. Might be a scissored clear, if scissorSize != window size
        glClearColor(0, 1, 0, 1);
        glClear(GL_COLOR_BUFFER_BIT);

        // Draw a red quad centered in the middle of the viewport, with dimensions 25% of the size of the viewport.
        drawQuad(mProgram, "position", 0.5f, 0.25f);

        GLint centerViewportX = viewportSize[0] + (viewportSize[2] / 2);
        GLint centerViewportY = viewportSize[1] + (viewportSize[3] / 2);

        GLint redQuadLeftSideX   = viewportSize[0] + viewportSize[2] * 3 / 8;
        GLint redQuadRightSideX  = viewportSize[0] + viewportSize[2] * 5 / 8;
        GLint redQuadTopSideY    = viewportSize[1] + viewportSize[3] * 3 / 8;
        GLint redQuadBottomSideY = viewportSize[1] + viewportSize[3] * 5 / 8;

        // The midpoint of the viewport should be red.
        checkPixel(centerViewportX, centerViewportY, true);

        // Pixels just inside the red quad should be red.
        checkPixel(redQuadLeftSideX,      redQuadTopSideY,        true);
        checkPixel(redQuadLeftSideX,      redQuadBottomSideY - 1, true);
        checkPixel(redQuadRightSideX - 1, redQuadTopSideY,        true);
        checkPixel(redQuadRightSideX - 1, redQuadBottomSideY - 1, true);

        // Pixels just outside the red quad shouldn't be red.
        checkPixel(redQuadLeftSideX - 1,  redQuadTopSideY - 1, false);
        checkPixel(redQuadLeftSideX - 1,  redQuadBottomSideY,  false);
        checkPixel(redQuadRightSideX,     redQuadTopSideY - 1, false);
        checkPixel(redQuadRightSideX,     redQuadBottomSideY,  false);

        // Pixels just within the viewport shouldn't be red.
        checkPixel(viewportSize[0],                        viewportSize[1],                       false);
        checkPixel(viewportSize[0],                        viewportSize[1] + viewportSize[3] - 1, false);
        checkPixel(viewportSize[0] + viewportSize[2] - 1,  viewportSize[1],                       false);
        checkPixel(viewportSize[0] + viewportSize[2] - 1,  viewportSize[1] + viewportSize[3] - 1, false);
    }