MOJO2

Monkey Forums/Monkey Programming/MOJO2

cgrossi(Posted 2016) [#1]
WTF!!! Why no image is displayed???

Import mojo2

Function Main()
    New MyGame()
End

Class MyGame Extends App

	Field canvas:Canvas
	Field img:Image

	Method OnCreate()
		canvas=New Canvas
		SetUpdateRate 60
		img=Image.Load("banco.png",0,0)
	End Method
	
	Method OnUpdate()
	End Method
	
	Method OnRender()	
		canvas.Clear()		
		canvas.DrawImage img,10,10		
		canvas.Flush()	
	End Method
End



Even if I change "canvas.Clear()" to "canvas.Clear(255,255,255)" just a black square - the image's size - is displayed on an white canvas.

If I run in HTML5 the image is displayed correctly.


ImmutableOctet(SKNG)(Posted 2016) [#2]
It's working fine here. Are you sure it's actually loading the image? Because it sounds like it's just in the wrong place or has the wrong name. Have you tried a different image?


cgrossi(Posted 2016) [#3]
On HTML5 it's working fine...


ImmutableOctet(SKNG)(Posted 2016) [#4]
That's even weirder. Maybe it's a driver issue? Do the official examples work? They're located in "modules/mojo2/bananas".


cgrossi(Posted 2016) [#5]
yes, the examples work... don't know what to do.... :(


ImmutableOctet(SKNG)(Posted 2016) [#6]
If you don't mind uploading the file, I could try it myself.

Is it possible you're using a file with the wrong file extension? For example, a JPG file named PNG, despite being the JPEG format. In HTML5's case, it doesn't really care what the format is, as long as the browser can load it.


cgrossi(Posted 2016) [#7]
no, no problem.. here go the code and images.. I'm thinking it's something with the image, because I copied one image from another sample and it did work fine, although my image is correct.

https://drive.google.com/open?id=0B8T1s0TV53yeWmIxZTNfUlA5VjA


ImmutableOctet(SKNG)(Posted 2016) [#8]
Okay, I'm not sure what's wrong, either. It's working on my machine, even under regular GLFW3:




cgrossi(Posted 2016) [#9]
with regular GLFW3 I can't run mojo2 and with mojo the image is displayed perfectly...


ImmutableOctet(SKNG)(Posted 2016) [#10]
Hang on, what about GLFW3+ANGLE, then? (Assuming you're on Windows)

By the way, what version of Monkey are you using?


cgrossi(Posted 2016) [#11]
I just can use mojo2 on GLFW3+ANGLE, not with GLFW. And I'm using the 85E.


ImmutableOctet(SKNG)(Posted 2016) [#12]
It doesn't display the image on GLFW3+ANGLE, then, right? Or does it only work with regular GLFW3?

As a side note, if regular GLFW3 doesn't work, it's probably due to bad OpenGL drivers. ANGLE on the other hand doesn't use OpenGL.

I'd say it could be a driver issue, but then again, your browser displays it fine, and you said the examples worked.

To be honest, I'm lost.


cgrossi(Posted 2016) [#13]
when I run mojo2 with GLFW3 only, I got this error: Memory Access Violation on that line:

	glGenerateMipmap GL_TEXTURE_2D


of method UpdateMipmaps (graphics.monkey)


ImmutableOctet(SKNG)(Posted 2016) [#14]
Sounds like a lack of OpenGL 3 support to me. Regardless, ANGLE should be working fine for you. I'm not sure why your image wasn't working, though. You could try messing around with the image flags, I guess.


cgrossi(Posted 2016) [#15]
I use Image.Filter and the image appear.. Figure it out... kkkkkkk Anyway, I'll do others tries. Thanks a lot.