<div dir="ltr">Hola!<div><br></div><div>Con SDL 2.0 es más sencillo que todo eso dibujar pixels o líneas, no necesitas manipular los pixels de esa manera salvo que quieras actualizar directamente una textura o superficie.</div>
<div>Para dibujar puntos, líneas o rectángulos sobre la pantalla, usa:</div><div>1) SDL_SetRenderDrawColor(SDL_Renderer* renderer, Uint 8 r, Uint8 g, Uint8 b, Uint8 a)</div><div>//Con esta función defines el color con el que el renderer realizará las operaciones de SDL_RenderDrawPoint, SDL_RenderDrawLine, etc... y también SDL_RenderClear.</div>
<div><br></div><div>2) Después usa la función adecuada para dibujar un punto, línea, rectángulo o serie de éstos, echa un vistazo a <a href="http://wiki.libsdl.org/CategoryRender">http://wiki.libsdl.org/CategoryRender</a> para consultar todas las funciones disponibles.</div>
<div><br></div><div>Espero haber servido de ayuda, la verdad es que SDL 2.0 todavía no está demasiado documentado y migrar de la 1.2 a la 2.0 cuesta un poco al principio, pero luego resulta fácil.</div><div><br></div><div>
Un saludo.</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">2013/11/10 Hl3 <span dir="ltr"><<a href="mailto:halowin3@gmail.com" target="_blank">halowin3@gmail.com</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hola Asdruba, gracias por responder.<br>
Lo acabo de conseguir, dejo aqui el programa por si le puede ayudar a alguien.<br>
<br>
#include <stdio.h><br>
#include <SDL2/SDL.h><br>
//#include <SDL2/SDL_image.h><br>
#include<math.h><br>
<br>
<br>
#define PI 3.141592<br>
#define SCREEN_WIDTH 640<br>
#define SCREEN_HEIGHT 480<br>
<br>
int main(int argc, char **argv){<br>
        int x,y;<br>
        double fx,angulo;<br>
//      Uint8* posicion;<br>
        Uint32 color;<br>
<br>
        SDL_Window *win = SDL_CreateWindow("y=sin(x)", 100,100, 640, 480, 0);<br>
<br>
<br>
//      SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_INFORMATION,"info", "Window creada",win);<br>
        SDL_Renderer *ren = SDL_CreateRenderer(win, -1, SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC);<br>
<br>
        /* Create surface */<br>
        SDL_Surface *surface = SDL_CreateRGBSurface(0,SCREEN_WIDTH,SCREEN_HEIGHT,32,0,0,0,0);<br>
<br>
        //get the pixels<br>
        Uint32 *pixels = (Uint32*)surface->pixels;<br>
<br>
        /* Lock the surface */<br>
        SDL_LockSurface(surface);<br>
<br>
        color = SDL_MapRGB(surface->format, 255, 0, 0);<br>
        for(x=0;x<360;x++){<br>
                angulo=x*PI/180;<br>
                fx=240+50*sin(angulo);<br>
                y=round(fx);<br>
                pixels[ ( y * surface->w ) + x ] = color;<br>
        }<br>
<br>
        /* Unlock the surface */<br>
        SDL_UnlockSurface(surface);<br>
<br>
        //imprescindible<br>
        SDL_Texture *tex = SDL_CreateTextureFromSurface(ren, surface);<br>
        SDL_RenderCopy(ren,tex,NULL,NULL);<br>
<br>
        //imprescindible<br>
        SDL_RenderPresent(ren);<br>
<br>
        SDL_Delay(10000);<br>
<br>
  return 0;<br>
<div class="HOEnZb"><div class="h5"><br>
}<br>
_______________________________________________<br>
Lista de correo Cconclase <a href="mailto:Cconclase@listas.conclase.net">Cconclase@listas.conclase.net</a><br>
<a href="http://listas.conclase.net/mailman/listinfo/cconclase_listas.conclase.net" target="_blank">http://listas.conclase.net/mailman/listinfo/cconclase_listas.conclase.net</a><br>
Bajas: <a href="http://listas.conclase.net/index.php?gid=2&mnu=FAQ" target="_blank">http://listas.conclase.net/index.php?gid=2&mnu=FAQ</a><br>
</div></div></blockquote></div><br></div>