texSubImage2D BugFix
texSubImage2D BugFix
www.tinyurl.com/BOMB-CODE
https://github.com/KanjiCoder/AIM
Email Me : KanjiCoder@Gmail.com
Discord : KANJICODER#0255
THE_BUG:
After 16 videos worth of writing the "HARDTEX" system,
I have visual confirmation that the bug in my code is comming
from the call to WebGlContext.texSubImage2D (GL.texSubImage2D).
This is progress, as the dirty sector management code
that helps efficiently update out-of-date-chunks of my
texture memory is very complex, and I was afraid the
bug was in that code. But I had already looked over
that code previously in search of the bug and after
double checking it, the logic seemed sound.
This gives me sanity of mind, because now I can focus in
on "texSubImage2D" and figure out why it is broken.
THE_FIX:
Found the bug in my sub texture push code. Before calling
GL.texSubImage2D , you need to call GL.pixelStorei( GL.UNPACK_ROW_LENGTH , 2048 ).
Well, 2048 for me because my main texture that stores all GPU game memory is in a 2048x2048 texture. For you it will be whatever the width in pixels of the texture you are trying to update is.
Assuming the CPU-side texture and GPU-side texture are the exact
same size. I down know about if they aren't, or if there is even a
proper use case for when the textures are of two different sizes.
-KanjiCoder #AtomicIvy #AtomicAlice #AtomicIvyMMO
GL.texSubImage2D , you need to call GL.pixelStorei( GL.UNPACK_ROW_LENGTH , 2048 ).
Well, 2048 for me because my main texture that stores all GPU game memory is in a 2048x2048 texture. For you it will be whatever the width in pixels of the texture you are trying to update is.
Assuming the CPU-side texture and GPU-side texture are the exact
same size. I down know about if they aren't, or if there is even a
proper use case for when the textures are of two different sizes.
-KanjiCoder #AtomicIvy #AtomicAlice #AtomicIvyMMO
Comments
Post a Comment