Viewports ignore Y in all images

Archives Forums/BlitzMax Bug Reports/Viewports ignore Y in all images

MoriartyL(Posted 2009) [#1]
A program I was working on was messing up the viewports, and I couldn't figure out what the cause was. So I made a much simpler program, and discovered that the glitch was with BlitzMax rather than my code. Here's the program I made to test it.
Graphics 800,600, 32,0
Local img:TImage=LoadImage("background.jpg")
Local y

While Not KeyHit(Key_Escape)
Cls

If KeyDown(Key_Down) Then y:+10
If KeyDown(Key_Up) Then y:-10
SetViewport 50,y,400,25
DrawImage img,0,0
DrawOval 0,0,800,600

SetViewport 0,0,800,600
Flip
Wend


Background.jpg can be any 800x600 image. When I run this code, the oval is cropped properly but the image is not. The image is only cropped on the X axis, but moving y up and down doesn't effect its appearance at all.

I'm using BlitzMax 1.34 on Windows XP. I would appreciate a quick response, because I can't continue working on my program until this is resolved.


TaskMaster(Posted 2009) [#2]
View Ports do not work for all video cards. They are not reliable. Do not use them. One person said the bug was a DirectX only problem and they work fine in OpenGL. I do not know this for sure.


MoriartyL(Posted 2009) [#3]
What's the alternative to using viewports? They're extremely useful.


MoriartyL(Posted 2009) [#4]
You were right; I tried it on a different computer, and there was no problem.

If viewports are known to be unreliable, then I've got to rewrite my entire code to not use them. What else can I use that does the same thing?


Zeke(Posted 2009) [#5]
DrawImageArea? http://www.blitzmax.com/Community/posts.php?topic=85478#969578


MoriartyL(Posted 2009) [#6]
Okay, thanks. I'll see what I can do with this.


MoriartyL(Posted 2009) [#7]
Using DrawImageArea is going to be complicated, if I can ever get it to work at all. Are you sure there's no way to get viewports to work?!


TaskMaster(Posted 2009) [#8]
I started work on a mod that uses the DrawImageArea and replaces setviewport. I have it working to some degree in my ifsoGUI mod. But, it only includes the basics that are needed by ifsoGUI. It is not feature complete to replace SetViuewPort yet. I will get back to it, but currently I am battling a bunch of real life issues that are keeping me from getting a lot of programming done. The only thing I am working on now is ifsoGUI itself.


MoriartyL(Posted 2009) [#9]
I wrote a function to mimic SetViewport with DrawImageArea. It sort of works, in the sense that you can look at the results and say, "Yeah, that kind of resembles what it looked like with viewports", but it looks broken. All the images are being drawn in very imprecise places; I don't know whether that's because of DrawImageArea itself or because of the function I've made, but this isn't working. I've given it my best shot, and it's simply inadequate.

So I have to go back to my original question: how can I get viewports to work on all graphics cards?


TaskMaster(Posted 2009) [#10]
Use OpenGL only...

Supposedly OpenGL doesn't suffer from the problem.


MoriartyL(Posted 2009) [#11]
You're right. I tried using OpenGL and the problems went away.