Skip to main content
gamedev.net
🔒 Locked

->CopyRects

Started by Geeman 1 reply 250+ views
Original Post
Geeman
Geeman
Hi Im currently learning how to program directx 8 using a book i brought. The book goes from GDI, DirectX 2D then DirectX 3D and im currently at the DirectX 2D part but having trouble with some code. Basically i want to be able to use DirectX to load a bitmap onto a surface, then copy that to the backbuffer which in turn becomes the primary buffer at the end of the render function. This is roughly what the book says on how to do it . Create a new Surface that holds the bitmap using pDevice->CreateImageSurface then load the bitmap from file into the surface just created using D3DXLoadSurfaceFromFile Once that is done, copy the bitmap to the backbuffer with pDevice->CopyRects then pDevice->Present see the results now i understand that, but when i try it, it doesnt work, the screen is just blank because of the ->Clear I can draw pixels onto the backbuffer fine, its just bitmaps im having trouble with, and thats a subject i do not want to skip Hope ye can help thanks.
tok_junior
tok_junior
Before copying to the backbuffer, you need to lock it,
so it''s writeable.

T

--
MFC is sorta like the swedish police... It''''s full of crap, and nothing can communicate with anything else.
Geeman
Geeman
no matter, as usual i find everything from that lil search button up there

The Zen of Direct3D Programming

is the culprit, it was book error and infact i had to REMOVE the locking of the surface
stupid book


thanks anyway

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.