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



Recommended Posts

wpr    122
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,
glBindTexture(GL_TEXTURE_RECTANGLE_NV, m_videoTexture);
glTexImage2D(GL_TEXTURE_RECTANGLE_NV, 0, 3, width, height, 0,
And here how I copy the image:
memcpy(m_pdrMemory, (void*)m_pImage, m_texsize);
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 this post

Link to post
Share on other sites
_the_phantom_    11250
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 this post

Link to post
Share on other sites
wpr    122
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.

Share this post

Link to post
Share on other sites