Archived

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

GL_WRITE_PIXEL_DATA_RANGE_NV

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

Recommended Posts

Hello I''m trying to use the GL_WRITE_PIXEL_DATA_RANGE_NV to render video in a texture and it works fine with 24bits textures but I can''t make it work with 32, I get trash on the screen and then a system crash. Here is how I initialize PDR:
m_texsize = width*height* (m_colorBits / 8);
m_pdrMemory = wglAllocateMemoryNV(m_texsize, 0.0f, 1.0f, 1.0f);
glPixelDataRangeNV(GL_WRITE_PIXEL_DATA_RANGE_NV, m_texsize,
m_pdrMemory);
glEnableClientState(GL_WRITE_PIXEL_DATA_RANGE_NV);
glEnable(GL_TEXTURE_RECTANGLE_NV);
glBindTexture(GL_TEXTURE_RECTANGLE_NV, m_videoTexture);
glTexImage2D(GL_TEXTURE_RECTANGLE_NV, 0, 3, width, height, 0,
GL_BGRA_EXT, GL_FLOAT, NULL);

And here how I copy the image:
memcpy(m_pdrMemory, (void*)m_pImage, m_texsize);
glFlushPixelDataRangeNV(GL_WRITE_PIXEL_DATA_RANGE_NV);
glTexSubImage2D(GL_TEXTURE_RECTANGLE_NV, 0, 0, 0, m_captureWidth,
m_captureHeight, m_colorFormat, m_colorBitFormat, (void*)m_pdrMemory);

For RGB32: m_colorFormat = GL_BGRA_EXT m_colorBits = 32 m_colorBitFormat = GL_UNSIGNED_BYTE For RGB24: m_colorFormat = GL_BGR_EXT m_colorBits = 24 m_colorBitFormat = GL_UNSIGNED_BYTE I''m not using glPixelStorei to change anything. Does anybody knows what is wrong here !? Thanks, wpr

Share on other sites
the data will be in 24bit format because video only consists of RGB data (8bits per channel) where as 32bit consists of RGBA (8bits per channel again), thus your data alignment would be wrong, thus corruption.
If you can find a way to adjust the format so it copies the RGB data and leaves a blank in the alpha it would work.

Why do you need 32bit RGBA?

Share on other sites
I''m getting video from Directshow, and some of them come in RGB32. That''s why I''m using GL_BGRA.
When I use norma glTexSub* it works fine, only using this NV ext. fails.
I''m trying to find the error since some days... no clue.
The garbage I get are some parts of my desktop, strange. If I pause the video, I get the right image.

Could this mean that even calling glFlushPixelDataRangeNV does not garantee that the pixels are actually copied !?

But them why it would work with GL_RGB and not with GL_RGBA. The funny thing is that I even tested with a very small video, 64x64. Same problem.

I don''t get it.

1. 1
2. 2
3. 3
4. 4
Rutin
18
5. 5

• 11
• 12
• 9
• 12
• 37
• Forum Statistics

• Total Topics
631420
• Total Posts
2999989
×