Use glTexStorage when resizing framebuffers
This commit is contained in:
@@ -11,6 +11,8 @@ import Codec.Picture
|
||||
import qualified Data.Vector.Storable as V
|
||||
import Control.Lens
|
||||
import Graphics.Rendering.OpenGL hiding (Point,translate,scale,imageHeight)
|
||||
import Graphics.GL.Core43
|
||||
--import Graphics.GL.Groups
|
||||
--import Text.RawString.QQ
|
||||
|
||||
-- I am not sure if this assumes that the shader is constructed directly before
|
||||
@@ -39,11 +41,9 @@ addTextureArray texturePath shad = do
|
||||
textureBinding Texture2DArray $= Just textureOb
|
||||
let texData = tilesToLine 128 8 .
|
||||
V.toList $ imageData tex
|
||||
--wtex = fromIntegral $ imageWidth tex
|
||||
--htex = fromIntegral $ imageHeight tex
|
||||
glTexStorage3D GL_TEXTURE_2D_ARRAY 3 GL_RGBA8 32 32 64
|
||||
withArray texData $ \ptr -> do
|
||||
texImage3D Texture2DArray NoProxy 0 RGBA8 (TextureSize3D 32 32 64) 0
|
||||
(PixelData RGBA UnsignedByte ptr)
|
||||
glTexSubImage3D GL_TEXTURE_2D_ARRAY 0 0 0 0 32 32 64 GL_RGBA GL_UNSIGNED_BYTE ptr
|
||||
textureFilter Texture2DArray $= ((Linear',Just Linear') , Linear')
|
||||
generateMipmap' Texture2DArray
|
||||
return $ shad & shaderTexture ?~ ShaderTexture {_textureObject = textureOb}
|
||||
|
||||
Reference in New Issue
Block a user