Skip to content

Commit 95e6c7f

Browse files
committed
Fixed examples after TextureTarget change. Note that examples/Redbook4/CubeMap.hs is broken.
1 parent 2aa5735 commit 95e6c7f

File tree

13 files changed

+25
-25
lines changed

13 files changed

+25
-25
lines changed

examples/RedBook4/Checker.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ myInit = do
4747
textureWrapMode Texture2D T $= (Repeated, Repeat)
4848
textureFilter Texture2D $= ((Nearest, Nothing), Nearest)
4949
withCheckImage checkImageSize 0x8 (\c -> Color4 c c c 255) $
50-
texImage2D Nothing NoProxy 0 RGBA' checkImageSize 0
50+
texImage2D Texture2D NoProxy 0 RGBA' checkImageSize 0
5151
return mbTexName
5252

5353
display :: Maybe TextureObject -> DisplayCallback

examples/RedBook4/Combiner.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ myInit = do
5555
textureFilter Texture2D $= ((Nearest, Nothing), Nearest)
5656
-- horiz b & w stripes
5757
makeImage imageSize (\i _ -> let c = if i .&. 2 == 0 then 255 else 0 in Color4 c c c 255) $
58-
texImage2D Nothing NoProxy 0 RGBA' imageSize 0
58+
texImage2D Texture2D NoProxy 0 RGBA' imageSize 0
5959

6060
textureBinding Texture2D $= Just texName1
6161
textureWrapMode Texture2D S $= (Repeated, Repeat)
@@ -64,7 +64,7 @@ myInit = do
6464
textureFunction $= Decal
6565
-- wider vertical 50% cyan and black stripes
6666
makeImage imageSize (\_ j -> let c = if j .&. 4 /= 0 then 128 else 0 in Color4 0 c c 255) $
67-
texImage2D Nothing NoProxy 0 RGBA' imageSize 0
67+
texImage2D Texture2D NoProxy 0 RGBA' imageSize 0
6868

6969
-- smooth-shaded polygon with multiple texture coordinates
7070
let vert :: TexCoord2 GLfloat -> Color3 GLfloat -> Vertex3 GLfloat -> IO ()

examples/RedBook4/CubeMap.hs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ withCheckImage (TextureSize2D w h) n f act =
3939
makeImage :: CubeMapTarget -> (GLubyte -> (Color4 GLubyte)) -> IO ()
4040
makeImage target f =
4141
withCheckImage imageSize 0x1 f $
42-
texImage2D (Just target) NoProxy 0 RGBA' imageSize 0
42+
texImage2D (TextureCubeMap target) NoProxy 0 RGBA' imageSize 0
4343

4444
myInit :: IO ()
4545
myInit = do
@@ -48,10 +48,10 @@ myInit = do
4848
shadeModel $= Smooth
4949

5050
rowAlignment Unpack $= 1
51-
textureWrapMode TextureCubeMap S $= (Repeated, Repeat)
52-
textureWrapMode TextureCubeMap T $= (Repeated, Repeat)
53-
textureWrapMode TextureCubeMap R $= (Repeated, Repeat)
54-
textureFilter TextureCubeMap $= ((Nearest, Nothing), Nearest)
51+
textureWrapMode (TextureCubeMap undefined) S $= (Repeated, Repeat) -- TODO: WRONG!!!
52+
textureWrapMode (TextureCubeMap undefined) T $= (Repeated, Repeat) -- TODO: WRONG!!!
53+
textureWrapMode (TextureCubeMap undefined) R $= (Repeated, Repeat) -- TODO: WRONG!!!
54+
textureFilter (TextureCubeMap undefined) $= ((Nearest, Nothing), Nearest) -- TODO: WRONG!!!
5555

5656
makeImage TextureCubeMapPositiveX (\c -> Color4 c c c 255)
5757
makeImage TextureCubeMapNegativeX (\c -> Color4 0 c c 255)
@@ -66,7 +66,7 @@ myInit = do
6666

6767
textureFunction $= Modulate
6868

69-
texture TextureCubeMap $= Enabled
69+
texture (TextureCubeMap undefined) $= Enabled -- TODO: WRONG!!!
7070
lighting $= Enabled
7171
light (Light 0) $= Enabled
7272
autoNormal $= Enabled

examples/RedBook4/Mipmap.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import Graphics.UI.GLUT
1919
makeImage :: Level -> TextureSize2D -> Color4 GLubyte -> IO ()
2020
makeImage level size@(TextureSize2D w h) col =
2121
withArray (replicate (fromIntegral (w * h)) col) $
22-
texImage2D Nothing NoProxy level RGBA' size 0 . PixelData RGBA UnsignedByte
22+
texImage2D Texture2D NoProxy level RGBA' size 0 . PixelData RGBA UnsignedByte
2323

2424
makeImages :: [Color4 GLubyte] -> IO ()
2525
makeImages colors = sequence_ $ zipWith3 makeImage levels sizes colors

examples/RedBook4/MultiTex.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ specifyTexture :: TextureSize2D -> (GLubyte -> GLubyte -> Color4 GLubyte) -> IO
1414
specifyTexture size@(TextureSize2D w h) f =
1515
withArray [ f i j | i <- [ 0 .. fromIntegral w - 1 ],
1616
j <- [ 0 .. fromIntegral h - 1] ] $
17-
texImage2D Nothing NoProxy 0 RGBA' size 0 . PixelData RGBA UnsignedByte
17+
texImage2D Texture2D NoProxy 0 RGBA' size 0 . PixelData RGBA UnsignedByte
1818

1919
myInit :: IO ()
2020
myInit = do

examples/RedBook4/ShadowMap.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ makeState = do
4848

4949
myInit :: IO ()
5050
myInit = do
51-
texImage2D Nothing NoProxy 0 DepthComponent' shadowMapSize 0
51+
texImage2D Texture2D NoProxy 0 DepthComponent' shadowMapSize 0
5252
(PixelData DepthComponent UnsignedByte nullPtr)
5353

5454
position (Light 0) $= lightPos
@@ -177,7 +177,7 @@ generateShadowMap torusAngle' showShadow' = do
177177
matrixMode $= Projection
178178
matrixMode $= Modelview 0
179179

180-
copyTexImage2D Nothing 0 DepthComponent' (Position 0 0) shadowMapSize 0
180+
copyTexImage2D Texture2D 0 DepthComponent' (Position 0 0) shadowMapSize 0
181181

182182
when showShadow' $ do
183183
let numShadowMapPixels = fromIntegral (shadowMapWidth * shadowMapHeight)

examples/RedBook4/TexBind.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,15 @@ myInit = do
4141
textureWrapMode Texture2D T $= (Repeated, Clamp)
4242
textureFilter Texture2D $= ((Nearest, Nothing), Nearest)
4343
withCheckImage checkImageSize 0x08 (\c -> Color4 c c c 255) $
44-
texImage2D Nothing NoProxy 0 RGBA' checkImageSize 0
44+
texImage2D Texture2D NoProxy 0 RGBA' checkImageSize 0
4545

4646
textureBinding Texture2D $= Just texName1
4747
textureWrapMode Texture2D S $= (Repeated, Clamp)
4848
textureWrapMode Texture2D T $= (Repeated, Clamp)
4949
textureFilter Texture2D $= ((Nearest, Nothing), Nearest)
5050
textureFunction $= Decal
5151
withCheckImage checkImageSize 0x10 (\c -> Color4 c 0 0 255) $
52-
texImage2D Nothing NoProxy 0 RGBA' checkImageSize 0
52+
texImage2D Texture2D NoProxy 0 RGBA' checkImageSize 0
5353
texture Texture2D $= Enabled
5454
return (texName0, texName1)
5555

examples/RedBook4/TexGen.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ myInit = do
5353

5454
textureWrapMode Texture1D S $= (Repeated, Repeat)
5555
textureFilter Texture1D $= ((Linear', Nothing), Linear')
56-
withStripeImage $ texImage1D NoProxy 0 RGBA' stripeImageWidth 0
56+
withStripeImage $ texImage1D Texture1D NoProxy 0 RGBA' stripeImageWidth 0
5757

5858
textureFunction $= Modulate
5959
textureGenMode S $= Just (ObjectLinear xEqualZero)

examples/RedBook4/TexProx.hs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,15 @@ import Graphics.UI.GLUT
1717
myInit :: IO ()
1818
myInit = do
1919
let check = do
20-
ok <- get (textureProxyOK (Left Texture2D) 0)
20+
ok <- get (textureProxyOK Texture2D 0)
2121
putStrLn ("proxy allocation " ++ if ok then "succeeded" else "failed")
2222

23-
texImage2D Nothing Proxy 0 RGBA8 (TextureSize2D 64 64) 0 (PixelData RGBA UnsignedByte nullPtr)
23+
texImage2D Texture2D Proxy 0 RGBA8 (TextureSize2D 64 64) 0 (PixelData RGBA UnsignedByte nullPtr)
2424
check
2525

2626
-- Note: We use a larger texture size here to demonstrate failure,
2727
-- modern graphic cards can handle the original size.
28-
texImage2D Nothing Proxy 0 RGBA16 (TextureSize2D 8192 8192) 0 (PixelData RGBA UnsignedShort nullPtr)
28+
texImage2D Texture2D Proxy 0 RGBA16 (TextureSize2D 8192 8192) 0 (PixelData RGBA UnsignedShort nullPtr)
2929
check
3030

3131

examples/RedBook4/TexSub.hs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ myInit = do
4949
textureWrapMode Texture2D S $= (Repeated, Repeat)
5050
textureWrapMode Texture2D T $= (Repeated, Repeat)
5151
textureFilter Texture2D $= ((Nearest, Nothing), Nearest)
52-
texImage2D Nothing NoProxy 0 RGBA' checkImageSize 0 checkImage
52+
texImage2D Texture2D NoProxy 0 RGBA' checkImageSize 0 checkImage
5353
return (texName, checkImage, subImage)
5454

5555
display :: TextureObject -> DisplayCallback
@@ -89,11 +89,11 @@ keyboard :: TextureObject -> Image -> Image -> KeyboardMouseCallback
8989
keyboard texName checkImage subImage (Char c) Down _ _ = case toLower c of
9090
's' -> do
9191
textureBinding Texture2D $= Just texName
92-
texSubImage2D Nothing 0 (TexturePosition2D 12 44) subImageSize subImage
92+
texSubImage2D Texture2D 0 (TexturePosition2D 12 44) subImageSize subImage
9393
postRedisplay Nothing
9494
'r' -> do
9595
textureBinding Texture2D $= Just texName
96-
texImage2D Nothing NoProxy 0 RGBA' checkImageSize 0 checkImage
96+
texImage2D Texture2D NoProxy 0 RGBA' checkImageSize 0 checkImage
9797
postRedisplay Nothing
9898
'\27' -> exitWith ExitSuccess
9999
_ -> return ()

examples/RedBook4/Texture3D.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ myInit = do
4040
textureWrapMode Texture3D T $= (Repeated, Clamp)
4141
textureWrapMode Texture3D R $= (Repeated, Clamp)
4242
textureFilter Texture3D $= ((Nearest, Nothing), Nearest)
43-
withImage $ texImage3D NoProxy 0 RGB' imageSize 0
43+
withImage $ texImage3D Texture3D NoProxy 0 RGB' imageSize 0
4444
texture Texture3D $= Enabled
4545

4646
display :: DisplayCallback

examples/RedBook4/TextureSurf.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ myInit = do
6262
textureWrapMode Texture2D S $= (Repeated, Repeat)
6363
textureWrapMode Texture2D T $= (Repeated, Repeat)
6464
textureFilter Texture2D $= ((Nearest, Nothing), Nearest)
65-
withImage $ texImage2D Nothing NoProxy 0 RGB' imageSize 0
65+
withImage $ texImage2D Texture2D NoProxy 0 RGB' imageSize 0
6666
texture Texture2D $= Enabled
6767
depthFunc $= Just Less
6868
shadeModel $= Flat

examples/RedBook4/Wrap.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ myInit = do
5151
textureWrapMode Texture2D T $= (Repeated, Repeat)
5252
textureFilter Texture2D $= ((Nearest, Nothing), Nearest)
5353
withCheckImage checkImageSize 0x8 (\c -> Color4 c c c 255) $
54-
texImage2D Nothing NoProxy 0 RGBA' checkImageSize 0
54+
texImage2D Texture2D NoProxy 0 RGBA' checkImageSize 0
5555
return mbTexName
5656

5757
display :: Maybe TextureObject -> DisplayCallback

0 commit comments

Comments
 (0)