From a80ffc939e47f930a509bf856134877f9fedcb51 Mon Sep 17 00:00:00 2001 From: Daniel Rosengren Date: Sat, 7 Jul 2007 09:34:31 +0200 Subject: [PATCH] Fixed Texture/Image drawing. --- addons/Image/samples/test.io | 2 +- addons/OpenGL/io/Texture.io | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/addons/Image/samples/test.io b/addons/Image/samples/test.io index 16938dd..a5e2583 100755 --- a/addons/Image/samples/test.io +++ b/addons/Image/samples/test.io @@ -56,7 +56,7 @@ Viewer := Object clone do( glScaled(hr, hr, 1) ) - image drawScaledTexture + image drawTexture glPopMatrix diff --git a/addons/OpenGL/io/Texture.io b/addons/OpenGL/io/Texture.io index 9077903..2f6a356 100644 --- a/addons/OpenGL/io/Texture.io +++ b/addons/OpenGL/io/Texture.io @@ -54,11 +54,14 @@ Texture := Object clone do( self format = anImage glFormat ) + glPixelStorei(GL_UNPACK_ALIGNMENT, 1) + if (anImage sizeIsPowerOf2 == false, if (sizeIsSame == false, self width := roundToPowerOf2(originalWidth) self height := roundToPowerOf2(originalHeight) - glTexImage2D(GL_TEXTURE_2D, 0, format, width, height, 0, format, GL_UNSIGNED_BYTE, nil) + data := Sequence clone setSize(width * height * anImage componentCount) + glTexImage2D(GL_TEXTURE_2D, 0, format, width, height, 0, format, GL_UNSIGNED_BYTE, data) ) glPixelStorei(GL_UNPACK_ROW_LENGTH, originalWidth) -- 2.11.4.GIT