[SDL] SDL_RenderCopy android

Gabriel Jacobo gabomdq at gmail.com
Fri Mar 8 03:35:02 PST 2013


2013/3/8 Dimitris Zenios <dimitris.zenios at gmail.com>

> Ok in order for everyone to be more clear.Attached you will find the
> simple application.It doesn matter if i use two textures or just one which
> at first i blit with NULL rects and then i pass a rect.
>
>
> Below is the more important part.
>
>     SDL_Rect rect;
>
>     rect.x = 0;
>     rect.y = 0;
>     rect.w = 128;
>     rect.h = 128;
>
>
> SDL_LockTexture(MooseTexture,NULL,&texture_surface->pixels,&texture_surface->pitch);
>     SDL_BlitSurface((SDL_Surface*)surface, NULL, texture_surface,NULL);
>     SDL_UnlockTexture(MooseTexture);
>
>     SDL_RenderClear(renderer);
>     SDL_RenderCopy(renderer, MooseTexture, NULL, NULL);
>     SDL_RenderPresent(renderer);
>
>     /* Loop, waiting for QUIT or the escape key */
>     while (!done) {
>         while (SDL_PollEvent(&event)) {
>             switch (event.type) {
>             case SDL_KEYDOWN:
>                 if (event.key.keysym.sym == SDLK_ESCAPE) {
>                     done = SDL_TRUE;
>                 }
>                 break;
>             case SDL_QUIT:
>                 done = SDL_TRUE;
>                 break;
>             }
>         }
>
>
>         SDL_RenderCopy(renderer, MooseTexture, &rect, &rect);
>         SDL_RenderPresent(renderer);
>     }
>
> I first draw the whole texture and present and then in a loop i only draw
> a portion of a texture and present.I end up seeing only the portion.You can
> see than i dont call anywhere in the loop RenderClear.Only copy and present.
>
> I have also tried with a static texture instead of streaming with the same
> results.
>
> I am using GLES2.
>
> Please tell me if you need anything else
>
> P.S:I could not upload bg.jpeg cause of size limits.Its an empty white
> background with some text in it
>
>
>

It's quite possible the system is using double buffering. If you run
SDL_RenderCopy(renderer,
MooseTexture, NULL, NULL); every frame, does it look like you want it to?


-- 
Gabriel.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20130308/5857fb92/attachment-0009.htm>


More information about the SDL mailing list