PDA

View Full Version : how to copy a portion of raw image into portion of opengl image



Jernej
07-09-2005, 12:21 AM
hi, i have this problem with opengl, i have a raw 32 bit image data and a opengl image object, now i want to copy portions of raw data image into opengl image like this:

http://gtamemory.gtaconnection.net/oglproblem.jpg
if you cannot see the image click here (http://gtamemory.gtaconnection.net/oglproblem.jpg)

i setup the skip_rows and skip_pixels but none of these seem to do
anything what the opengl documents say, here is my code:

glBindTexture(gl_texture_2d, car_tex);

glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
glPixelStorei(GL_PACK_SKIP_PIXELS, 10);
glPixelStorei(GL_PACK_ROW_LENGTH, 64);

glTexSubImage2D(gl_texture_2d, 0, deltarects[car_clear].rect.Left,
deltarects[car_clear].rect.Top, deltarects[car_clear].rect.Right -
deltarects[car_clear].rect.left, deltarects[car_clear].rect.bottom -
deltarects[car_clear].rect.top, GL_bgra_ext, GL_UNSIGNED_BYTE,
pointer(integer(ms.memory) + integer(deltarects[car_clear].dataptr)));

the data passed to glTexSubImage2D is correct, so there is no
problem with data, can someone please explain how to tell me how to do this properly in opengl?

Jernej
07-10-2005, 01:00 AM
okay, this problem then remains impossible to solve.

ZbuffeR
07-10-2005, 02:43 AM
And what about describing your actual problem ?

Jernej
07-10-2005, 11:53 AM
i did, i have a image that is data and a opengl image, now i want to read a subimage of data into subimage of opengl data, i read the books and they say to set GL_UNPACK_ALIGNMENT, GL_PACK_SKIP_PIXELS and GL_PACK_ROW_LENGTH, i did but opengl won't budge.