• surface.DrawTexturedRect not rendering correctly?
    5 replies, posted
I have the following code: [CODE]hook.Add('HUDPaint', 'TestHud', function() local mat = Material('test.png') surface.SetMaterial(mat) surface.SetDrawColor(255, 255, 255, 255) surface.DrawTexturedRect(32, 32, 1024, 1024) end)[/CODE] The material is a 256 X 256 png image, in theory, each pixel should scale up to be 4 pixels, what I get instead is this (without the 32px rulings) [IMG]http://i.imgur.com/W5kndqC.png[/IMG] The top side, and left side of the image get scaler to 2px, and the rest of the pixels get scaled to 4px. Am I doing something wrong, or is this a problem with gmod?
Post the test.png. Also, that doesn't look like 1024x1024.
Is the png file interlaced? Interlacing may cause rendering issues.
[QUOTE=Robotboy655;42872316]Post the test.png. Also, that doesn't look like 1024x1024.[/QUOTE] how so?
[QUOTE=Johnny Guitar;42875550]how so?[/QUOTE] From the screenshot, the offset from the corner is bigger then the box. I might be wrong though, but why leave the rest of the pixels transparent? Why not use 32x32 or 64x64 image?
According to photoshop, there is no interlacing on the image. I'm using 256 x 256 image (or how ever big) because most of it isn't drawn yet, I will eventually fill up the entire image, just haven't gotten that far yet. I'm hoping imgur doesn't compress it: [img]http://i.imgur.com/tamapRD.png[/img] It appears to do the same scaling BS even if I use a 32 x 32 image, for example. The reason it doesn't look like 1024x1024 is because I cropped it to the top left hand part of the image, there is no point in posting the entire image since you can see the mistake in the top left hand area. If it helps: [img]http://i.imgur.com/jMnQzuy.png[/img]
Sorry, you need to Log In to post a reply to this thread.