Archived

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

Saandman

Blitting

Recommended Posts

Say I want to blit an image to the screen. OK I''ll use glDrawPixels(). But that won''t let me define a rectangle from which to blit! I want to define where to start reading the pixels, you know? In DX you have the Blt() func which takes source and destination rects.. glDrawPixels() only lets you define the width and height to blit!

Share this post


Link to post
Share on other sites
I think you better use ortho mode and draw a textured quad to the screen (it will probably be faster then glDrawPixels).

But if you wanna use glDrawPixels (from the MSDN):
quote:

The glDrawPixels function reads pixel data from memory and writes it into the framebuffer relative to the current raster position. Use glRasterPos to set the current raster position, and use glGet with argument GL_CURRENT_RASTER_POSITION to query the raster position.

Share this post


Link to post
Share on other sites
Actually, I am!

It''s just.. I have a tile manager class which loads whole tilesets. What if I want to extract a specific tile from the tileset (BMP for example)? I have a formula to get the coordinates in the image for a specific tile, but what now? Tricky

Share this post


Link to post
Share on other sites
Sorry I don''t speak OGL, but: couldn''t you load your image onto an auxilliary buffer within the Framebuffer and then use glCopyPixels*(?)(...); to copy a texel of that buffer? And then write those pixels to your chosen drawing buffer? I don''t know if it''s glRead or glCopy, I''m too lazy to get off my ass and refer to my book

Share this post


Link to post
Share on other sites