Page 1 of 1

Why is setColor glitching my image?

Posted: Fri Aug 16, 2013 12:17 am
by thecodingotaku
I feel stupid for asking such a simple question, but I'm just really banging my head on this one. Basically what I'm trying to achieve is to draw a blue rectangle background in one color, and then switch back to the default color (which I belive is 255,255,255,255, correct?), to draw my other graphics (in this case a logo), except things are glitiching out.

The portion of my code where (I believe) this is happening is as follows:

Code: Select all

local logo = graphics.newImage 'img/logo.png'

function Titlescreen()
  return {
    draw = function()
      graphics.setColor { 100, 200, 255, 255 }
      graphics.rectangle('fill', 0, 0, the.canvas:getWidth(), the.canvas:getHeight()) 
      
      graphics.setColor(255, 255, 255, 255)
      graphics.draw(logo, 100, 30, 0, 0.3, 0.3)
    end,

    --[[ More codez here... ]]
  }
end
I attached a screenshot. As you can see, the logo is drawn as a pure white rectangle, rather than the logo itself (note that it has a transparent background.)

This is not the firs time setColor has messed me up :ehem:. Could someone explain why this is going on? Thanks!

Re: Why is setColor glitching my image?

Posted: Fri Aug 16, 2013 12:31 am
by slime
How big is the logo image? Many cheap integrated video cards (or very old ones) can't handle images with dimensions greater than 2048x2048.

Re: Why is setColor glitching my image?

Posted: Fri Aug 16, 2013 3:00 am
by Jasoco
Yeah, it's probably too big for your graphics card. Large images should always be broken up.