Jump to content
  • Advertisement
Sign in to follow this  
Prune

Direct state access problem

This topic is 3172 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

glNamedBufferDataEXT can be used so it's not necessary to bind a buffer. Now, in my code I use glTextureSubImage2DEXT with the void *pixels parameter as null, which makes it update the texture with data from the GL_PIXEL_UNPACK_BUFFER The problem is, how do I use direct state access here, when there's no function allowing me to specify both the named buffer and texture? Or am I forced to bind the buffer first? For example, unsigned char *pbo(static_cast<unsigned char *>(glMapNamedBufferEXT(_vidBuff, GL_WRITE_ONLY))); _video.Frame2Buff(pbo); glUnmapNamedBufferEXT(_vidBuff); glBindBuffer(GL_PIXEL_UNPACK_BUFFER, _vidBuff); glPixelStorei(GL_UNPACK_ALIGNMENT, 4); glTextureSubImage2DEXT(_vidTex, GL_TEXTURE_2D, 0, 0, 0, 1028, 608, GL_RGB, GL_UNSIGNED_BYTE, 0); glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0); Using mixed direct state and then binding a buffer looks bad. I mean what's the point even of the named buffer function if I can just bind buffer at the top and use glMapBuffer...

Share this post


Link to post
Share on other sites
Advertisement
That's because we are talking about 2 different objects : PBO and texture.
You have no choice to bind the PBO to operate on it.
If they create a new version of glTextureSubImage2DEXT that takes a PBO ID and texture ID, then no need for glBindBuffer.

PS : I don't think you need glPixelStorei

Share this post


Link to post
Share on other sites
Thanks.

I was getting black screens initially and specifying this alignment fixed it. Not sure why it doesn't work with alignment > 4... maybe it's the only alignment the mapping function guarantees.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

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

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!