Original Post
I am trying to edit a texture by drawing it, then getting its surface, set it to be the render target and then drawing a small yellow circle, however when I run the program the screen just flashes yellow..
void Direct3D::draw_sprite(SpriteInstance *sprt_instance)
{
set_view();
D3DXMATRIX matrix;
D3DXVECTOR2 center;
center.x = sprt_instance->sprt->width/2;
center.y = sprt_instance->sprt->height/2;
D3DXVECTOR2 pos = scale(sprt_instance->pos);
RECT frame;
frame.left = sprt_instance->col * sprt_instance->sprt->width;
frame.right = frame.left + sprt_instance->sprt->width;
frame.top = 0;
frame.bottom = frame.top + sprt_instance->sprt->height;
D3DXMatrixTransformation2D(&matrix,
NULL, //scaling Center
NULL, //scaling Rotation
NULL, //scaling
¢er, //rotation Center
sprt_instance->rot, //rotation (radians)
&pos); //translation(position)
d3d_sprite->SetTransform(&matrix);
//Texture to be drawn
d3d_sprite->Draw(sprt_instance->sprt->tex, &frame, NULL, NULL, 0xFFFFFFFF);
//Editing texture
IDirect3DSurface9 *surface;
sprt_instance->sprt->tex->GetSurfaceLevel(0, &surface);
d3d_device->SetRenderTarget(0, surface);
//Yellow Circle
d3d_sprite->Draw(tex, &frame, NULL, NULL, 0xFFFFFFF);
}