Possible Bug in DrawPoint!?

Monkey Forums/Monkey Programming/Possible Bug in DrawPoint!?

zoqfotpik(Posted 2014) [#1]
I've run into a strange situation. On my Windows 7 box, the following code should draw a solid line but in fact draws a solid line 1/3 across the screen and then a dotted line the rest of the way.

It happens with just the DrawPoint function and nothing else but I have included what I was working on at the time to show that for some reason there are vertical lines where DrawPoint apparently does not work. Move the mouse toward the right and you'll see what's happening.

This code works fine on OSX.

Import mojo
Import monkey.math

Global testplane:bitplane = New bitplane

Class bitplane
	Field r:Int[65535]
	Field g:Int[65535]
	Field b:Int[65535]
	
	Method writepix:Void(x:Int, y:Int, myr:Int, myg:Int, myb:Int)
		Local i:Int 
		i = y*256+x
		r[i]=myr
		g[i]=myg
		b[i]=myb
	End Method
	
	Method setcolorbypix:Void(x:Int,y:Int)
		Local i:Int
		i = y*256+x
		SetColor r[i],g[i],b[i]
	End Method
	
	Method drawplane:Void(x:Int, y:Int)  ' draws plane at x, y 
		Local i:Int
		Local j:Int
		For i = 0 To 255
		For j = 0 To 255
			setcolorbypix(i,j)
			DrawPoint(i+x, j+y)
		Next
		Next
	End method
End Class

Class myapp Extends App
	Method OnCreate ()
	
		For Local i:Int = 0 To 255
			For Local j:Int = 0 To 255
				testplane.writepix(i,j,i,j,Rnd(255))
			Next 
		next
		SetUpdateRate 60
	End

	Method OnUpdate ()
	
	End

	Method OnRender ()
		Cls(0, 0, 0)
		testplane.drawplane(MouseX(),MouseY())	
		Local i:Int 
		SetColor 255,255,255
		For i= 0 To DeviceWidth()
			DrawPoint(i,100)
		next	
	End
End

Function Main ()
	New myapp	
End


This is the first real WTF I've run into with Monkey and I'm really curious to know the reason for this strange behavior. The fact that it appears to happen with just DrawPoint and nothing else going on is the strangest thing.


zoqfotpik(Posted 2014) [#2]
Just to illustrate a real minimal case where the issue happens, I'll include this:

Import mojo
Import monkey.math



Class myapp Extends App
	Method OnCreate ()
		SetUpdateRate 60
	End

	Method OnUpdate ()
	
	End

	Method OnRender ()
		Cls(0, 0, 0)
		Local i:Int 
		SetColor 255,255,255
		For i= 0 To DeviceWidth()
			DrawPoint(i,100)
' Does not happen with DrawRect:
DrawRect(i,110,1,1)
		next	
	End
End

Function Main ()
	New myapp	
End



OvineByDesign(Posted 2014) [#3]
Works fine here on DESKTOP target, what target are you outputting to ?

/Stu


zoqfotpik(Posted 2014) [#4]
GLFW. I will post a screenshot later.


Goodlookinguy(Posted 2014) [#5]
I don't know about your specific issue and haven't tested any of your code, as I'm off right now, but I did post a bug report about DrawLine and DrawPoint behavior being different on the platforms: http://www.monkey-x.com/Community/posts.php?topic=7809


zoqfotpik(Posted 2014) [#6]
Here's the screenshot. I included the larger colored square (all points plotted individually with drawpoint) so you can see that it's not just a dashed line.



Works fine in HTML5.

My video card is an ATI 7950 if that matters.

One interesting note: Not all the black lines are equidistant.


Goodlookinguy(Posted 2014) [#7]
Oh yeah, that problem. I've had that before. I was going to report it but never got around to it. Report it, cause that's a separate issue I think...


therevills(Posted 2014) [#8]
What version of MonkeyX are you using?

I've just tried you min version and it works fine here on "Desktop" (new name for GLFW)...


zoqfotpik(Posted 2014) [#9]
That's a good question...


zoqfotpik(Posted 2014) [#10]
Version is 76d. My target shows up as Glfw.


therevills(Posted 2014) [#11]
I tried it on 77e... (sorry should have stated that before...)


zoqfotpik(Posted 2014) [#12]
I will give that a try as well.

My gut feeling is that it has something to do with ATI catalyst drivers. I am running a 3 monitor setup.