Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.



This topic is 5866 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

i''m trying to find out what is the equivalence of glReadPixels, glReadBuffer(GL_BACK),and glReadBuffer(GL_FRONT) in Directx? glReadPixels(0,0,lpbih->biWidth,lpbih->biHeight,GL_BGR_EXT,GL_UNSIGNED_BYTE,bmBits); i''m trying to conver this line to directx...plss help me! thnks .jm.

Share this post

Link to post
Share on other sites
You''ll have to lock the texture you''re trying to access, and read out the data at the pointer it returns to you, and unlock again.

IDirect3DTexture8::LockRect() I think, or something along those lines. See SDK.

- JQ
Full Speed Games. Coming soon.

Share this post

Link to post
Share on other sites
here is the sample code that i have which is in opengl...
what i would like to do is to be able to convert this in directx. suggestions anyone?

you could see the complete code of this at :

void CMainFrame::OnAvigenerationGenerate()
int i;

CAVIGenerator AviGen;
BYTE* bmBits;
CGL2AviView* pView=(CGL2AviView*)GetActiveView();

AviGen.SetRate(10); // set 20fps

AviGen.SetBitmapHeader(pView); // give info about bitmap

// retreiving size of image

// allocating memory

bmBits=new BYTE[lpbih->biSizeImage];


// reading back buffer

// render frame

// Copy from OpenGL to buffer

// send to avi engine


// releasing engine and memory

delete[] bmBits;


Share this post

Link to post
Share on other sites
Are you using D3D 8?

If so, you can get the display backbuffer as a IDirect3DSurface8 by calling IDirect3DDevice8::GetBackBuffer().

You can get the front buffer similarly:


There''s nothing that''s quite the same as glReadPixels, you need to parse the buffer pixel data yourself. Generally you''ll call IDirect3DSurface8::GetDesc to get the data you need from the surface (pixel format, size, pitch, etc) and use that to pull out specific x/y pixel values or regions.

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!