Remove glTexImage
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
module Shader.AuxAddition
|
||||
( addTexture
|
||||
, addTextureNoFilter
|
||||
, addTextureArray
|
||||
, addUniforms
|
||||
) where
|
||||
@@ -26,11 +27,26 @@ addTexture texturePath shad = do
|
||||
let texData = V.toList $ imageData tex
|
||||
wtex = fromIntegral $ imageWidth tex
|
||||
htex = fromIntegral $ imageHeight tex
|
||||
glTexStorage2D GL_TEXTURE_2D 3 GL_RGBA8 wtex htex
|
||||
withArray texData $ \ptr -> do
|
||||
texImage2D Texture2D NoProxy 0 RGBA8 (TextureSize2D wtex htex) 0
|
||||
(PixelData RGBA UnsignedByte ptr)
|
||||
glTexSubImage2D GL_TEXTURE_2D 0 0 0 wtex htex GL_RGBA GL_UNSIGNED_BYTE ptr
|
||||
textureFilter Texture2DArray $= ((Linear',Just Linear') , Linear')
|
||||
generateMipmap' Texture2D
|
||||
textureFilter Texture2D $= ((Linear',Just Linear') , Nearest)
|
||||
return $ shad & shaderTexture ?~ ShaderTexture {_textureObject = textureOb}
|
||||
|
||||
addTextureNoFilter :: String -> FullShader -> IO FullShader
|
||||
addTextureNoFilter texturePath shad = do
|
||||
Right cmap <- readImage texturePath
|
||||
let tex = convertRGBA8 cmap
|
||||
textureOb <- genObjectName
|
||||
textureBinding Texture2D $= Just textureOb
|
||||
let texData = V.toList $ imageData tex
|
||||
wtex = fromIntegral $ imageWidth tex
|
||||
htex = fromIntegral $ imageHeight tex
|
||||
glTexStorage2D GL_TEXTURE_2D 1 GL_RGBA8 wtex htex
|
||||
withArray texData $ \ptr -> do
|
||||
glTexSubImage2D GL_TEXTURE_2D 0 0 0 wtex htex GL_RGBA GL_UNSIGNED_BYTE ptr
|
||||
textureFilter Texture2DArray $= ((Nearest,Nothing) , Nearest)
|
||||
return $ shad & shaderTexture ?~ ShaderTexture {_textureObject = textureOb}
|
||||
|
||||
addTextureArray :: String -> FullShader -> IO FullShader
|
||||
|
||||
Reference in New Issue
Block a user