import Graphics.Rendering.OpenGL import Graphics.UI.GLUT import Foreign main = do (progname, _) <- getArgsAndInitialize createWindow "Hello World" textureFilter Texture2D $= ((Nearest, Nothing), Nearest) textureWrapMode Texture2D S $= (Repeated, Clamp) textureWrapMode Texture2D T $= (Repeated, Clamp) --texName <- genObjectNames 1 nn <- newArray [0.1::Float , 0.2 , 0.8 , 1 , 1 , 0 , 1 ,0.2 , 1 , 0.3 , 0 ,1, 0.9 , 0 , 0 ,1] texImage2D Nothing NoProxy 0 RGBA' (TextureSize2D 2 2) 0 (PixelData RGBA Float nn ) --texName $= textureBinding Texture2D displayCallback $= display mainLoop display = do clear [ColorBuffer] --texName $= textureBinding Texture2D texture Texture2D $= Enabled renderPrimitive Quads $ do texCoord$ (TexCoord2 (0 ::GLfloat) 1) vertex $ (Vertex3 (0.0 ::GLfloat) 0.5 0.0) texCoord$ (TexCoord2 (0 ::GLfloat) 0) vertex $ (Vertex3 (0.0 ::GLfloat) 0.0 0.0) texCoord$ (TexCoord2 (1 ::GLfloat) 0) vertex $ (Vertex3 (0.5 ::GLfloat) 0.0 0.0) texCoord$ (TexCoord2 (1 ::GLfloat) 1) vertex $ (Vertex3 (0.5 ::GLfloat) 0.5 0.0) texCoord$ (TexCoord2 (0 ::GLfloat) 1) vertex $ (Vertex3 (0.7 ::GLfloat) 0.8 0.0) texCoord$ (TexCoord2 (0 ::GLfloat) 0) vertex $ (Vertex3 (0.8 ::GLfloat) 0.8 0.0) texCoord$ (TexCoord2 (1 ::GLfloat) 0) vertex $ (Vertex3 (0.8 ::GLfloat) 0.7 0.0) texCoord$ (TexCoord2 (1 ::GLfloat) 1) vertex $ (Vertex3 (0.7 ::GLfloat) 0.7 0.0) flush texture Texture2D $= Disabled