Forum Replies Created
- 
		AuthorPosts
 - 
		
			
				
Can’t see anything obviously wrong, but also of course can’t test it. Might be worth trying to change path:Byte Ptr to path:CString, though I suspect they work out the same…
This was my earlier effort at importing an external function, though slightly different circumstances… yours looks pretty much the same setup, though:
http://monkeycoder.co.nz/forums/topic/simple-win32-api-call-attempt/
What was the error message?
That’s pretty darn good, peterigz, but does it scale down OK?
I thought degac’s twin-tails thing for Monkey2 was clever, and makes for a visual double-take, a little more attention-grabbing than just… a normal monkey.
Try adding the 2 GCCollect()s to OnRender – this should give you some idea of real memory requirements, and should ‘settle’ immediately (but as mentioned above, will be slower).
That settles quicker, though it’s still about 40 seconds until it stops increasing — and still at about 58 MB here in total. Checked, and it is release version!
I literally added two GCCollects () just before line 33 in the above code.
Just tried GCSetTrigger (65536) and (1024 * 1024) as first line of Main () and it makes no obvious difference, still same usage and timescale — always starts at about 55 MB and works its way to 58 MB over about 40 seconds.
Pretty sure Max always did a similar sort of thing — assume if it stops increasing eventually then it’s basically working!
Just tested quickly — yep, it’s the codemap! Goes to 0-1% here when turned off, mostly 0%!
nerobot, wonder if you could have a look at CPU usage?
I noticed while running this code…
http://monkeycoder.co.nz/forums/topic/mark-troubling-memory-leak/#post-10079
… that CPU usage is a constant 5-7% CPU, which is quite a lot for an application that should be doing almost nothing (while my program runs)!
I’m on an AMD FX 6350 (approx 3.9 to 4.2 GHz as standard), probably a few years old now, but I know from past conversations that this is likely to be in the region of 10-15% CPU on slower processors (probably a lot more on Raspberry Pi, etc)…
I realise it’s basically using a ‘game’ app framework, but my understanding is that mojo should still just sit and wait for OS events, rather than constantly update, so I wonder where the CPU usage might be coming from if that’s correct.
Foe what it’s worth, here on crusty old unsupported Windows 7, it starts around 57 MB and keeps going up by 4-16k per second for a good few minutes (4-5?) — but then finally settles on 60 MB (solid 60212 K for 2-3 minutes, now 60232 K for last couple of minutes).
Think it’s working as it should! The expectation is that it would settle sooner, but I found similar results in BlitzMax, just takes time to get settled.
Still at a rock-solid 60232 K after another couple of mins!
Do you use Win10 and start Monkey2 (Windows).exe by desktop shortcut?
If yes – please create shortcut directly to \bin\ted2_windows\ted2.exe.
Ah, yes, that works — it seems the Monkey2… exe is just a per-platform launcher anyway.
I tried send these events:
<div id=”crayon-59a4566c23cd3099445240″ class=”crayon-syntax crayon-theme-tomorrow-night-copy crayon-font-droid-sans-mono crayon-os-pc print-yes notranslate” data-settings=” minimize scroll-mouseover”>
<div class=”crayon-main”>
<table class=”crayon-table”>
<tbody>
<tr class=”crayon-row”>
<td class=”crayon-nums ” data-settings=”show”>
<div class=”crayon-nums-content”>
<div class=”crayon-num” data-line=”crayon-59a4566c23cd3099445240-1″>1</div>
<div class=”crayon-num” data-line=”crayon-59a4566c23cd3099445240-2″>2</div>
</div></td>
<td class=”crayon-code”>
<div class=”crayon-pre”>
<div id=”crayon-59a4566c23cd3099445240-1″ class=”crayon-line”><span class=”crayon-e”>SendWindowEvent</span><span class=”crayon-sy”>(</span> <span class=”crayon-r”>New</span> <span class=”crayon-e”>WindowEvent</span><span class=”crayon-sy”>(</span> <span class=”crayon-v”>EventType</span><span class=”crayon-sy”>.</span><span class=”crayon-v”>WindowRestored</span><span class=”crayon-sy”>,</span><span class=”crayon-r”>Self</span> <span class=”crayon-sy”>)</span> <span class=”crayon-sy”>)</span></div>
<div id=”crayon-59a4566c23cd3099445240-2″ class=”crayon-line”><span class=”crayon-e”>SendWindowEvent</span><span class=”crayon-sy”>(</span> <span class=”crayon-r”>New</span> <span class=”crayon-e”>WindowEvent</span><span class=”crayon-sy”>(</span> <span class=”crayon-v”>EventType</span><span class=”crayon-sy”>.</span><span class=”crayon-v”>WindowGainedFocus</span><span class=”crayon-sy”>,</span><span class=”crayon-r”>Self</span> <span class=”crayon-sy”>)</span> <span class=”crayon-sy”>)</span></div>
</div></td>
</tr>
</tbody>
</table>
</div>
</div>
[…]But have no effect.
[EDIT: God, I f***ing hate these forums!!]
It looks like they’re not actually implemented in window.monkey2 -> OnWindowEvent, so that would probably explain it!
Browse Manuals – opens local docs in your browser. Rebuild docs give you a fresh version of docs here (useful when grab newest version from github).
Online Help – opens similar page but stored on the server. I don’t know what about actual state here.
Ah, I see… makes sense, but maybe not very clear from the descriptions! (Is there a benefit to having both?) I always liked the Blitz help being on a tab in the IDE, rather than having to launch a separate browser and wait for the page to load, etc, not show how hard that would be though! Maybe others prefer separate browser anyway…
Thanks for the reply — changing to direct ted2.exe also fixes opening by clicking .monkey2 files, as that wasn’t working for me for a long time!
I’ve tried the latest version and it’s really good, particularly (for me) having cut/copy/paste available in all different contexts.
Couple of minor points from me:
1) seems weird to have a Save All icon but not a Save icon (I don’t always want to save all) and
2) could it store whether or not the window is maximised when it exits? It opens up at the right size but I always have to maximise it manually!
Oh, and I don’t really understand the two separate Help menu options, Browse Manuals and Online Help… they seem to go to slightly different versions of the docs pages, and I can’t tell why (or which one I should use at any give time)! Is it maybe something that’s been left in error?
I am really liking Ted2Go now, great work.
Will hopefully get to try this soon, has my most-wanted additions, cut/copy/paste menus/toolbar icons, so thanks for adding these. The blue icons actually look fine to me, even though I don’t generally like “flat design”!
Really want this! Is the OpenVR problem related to the DK2 specifically, or Oculus in general? I couldn’t find any quick info on it…
I believe you get tied into either Steam or the Oculus Home thing either way (OpenVR is apparently only downloadable via Steam, and the Oculus SDK forces running Oculus Home on game launch), but I don’t believe you’re forced to sell through either store.
There’s a year-old discussion on the pluses and minuses of each SDK here:
https://www.reddit.com/r/oculus/comments/496qsm/oculus_sdk_vs_openvr_sdk/
The current Oculus SDK now takes care of the image warping/distortion/timewarping stuff as I understand it:
https://developer.oculus.com/documentation/pcsdk/latest/concepts/dg-render/#dg_render_distortion
Can we also have the effect that projects semi-transparent textures onto walls, etc, from a light? Can’t think what it’s called! Guess it would be part of shadows… ?
Wow, perfect here in Win 7 64, well done.
For anyone not sure how to test, rename the resulting yourapp.exe found in yourapp.products/Windows/ (after building) as yourapp.scr; right-click it and choose Install.
Just deletingyourapp.scr will take it out of the screensaver list.
Would never have imagined that would work!
Eek, maybe ignore all of this — my tweaked demo doesn’t use SetScale! Adding
Monkey1_ground.SetScale (100, 1, 100)causes it to fall through. I assumed the bounds would be updated, then the collider built using that updated bounds (ie. thought you were referring to resizing not working after the collider is built), but apparently bounds stays fixed…
[IGNORE: See last post! But see comment about tweaking ANGLE const in this demo!]
Here’s a stripped-down version of shapes.monkey2 showing mesh.bounds being used sucessfully for collider:
Monkey123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687Namespace myapp#Import "<std>"#Import "<mojo>"#Import "<mojo3d>"#Import "<mojo3d-physics>"#Import "assets/"Using std..Using mojo..Using mojo3d..Const ANGLE:Float = 40 ' 10-20 for weirdness!Class MyWindow Extends WindowField _scene:SceneField _camera:CameraField _light:LightField _ground:ModelMethod New( title:String="Simple mojo app",width:Int=640,height:Int=480,flags:WindowFlags=WindowFlags.Resizable )Super.New( title,width,height,flags )_scene=Scene.GetCurrent()'create camera'_camera=New Camera_camera.Move( 0,10,-10 )'create light'_light=New Light_light.Move (-10, 10, 10)_light.RotateX( 90 ) 'aim directional light 'down'.'create ground'Local groundBox:=New Boxf( -60,-1,-60,60,0,60 )_ground=Model.CreateBox( groundBox,16,16,16,New PbrMaterial( Color.Green ) )Local gcollider:Collider=New BoxCollider( groundBox )Local gbody:=New StaticBody( gcollider,_ground )'create some meshes/collidersLocal mesh:=New MeshLocal collider:=New Collidermesh=Mesh.CreateBox( New Boxf( -1,-5,-1,1,5,1 ),1,1,1 )collider=New BoxCollider(mesh.Bounds) ' USING MESH.BOUNDS ************Local material:= New PbrMaterial (New Color (255, 0, 255))Local model:=New Model( mesh,material )model.Move( 0,10,0 )model.Rotate (0, 0, ANGLE)Local body:=New DynamicBody( collider,model )_light.PointAt (_ground)_camera.PointAt (_ground)EndMethod OnRender( canvas:Canvas ) OverrideIf Keyboard.KeyHit (Key.Escape) Then App.Terminate ()If Keyboard.KeyDown (Key.Up) Then _camera.Rotate (1.0, 0.0, 0.0, True)If Keyboard.KeyDown (Key.Down) Then _camera.Rotate (-1.0, 0.0, 0.0, True)RequestRender()World.GetDefault().Update()_scene.Render( canvas,_camera )EndEndFunction Main()New AppInstanceNew MyWindowApp.Run()EndThis demo also highlights some weirdness I noticed in the original sometimes — change const ANGLE at the top to 10-20 and watch it settle at a strange angle!
Hi Mark, I thought that, but I’m not actually convinced!
[IGNORE: See last post!]
See my second paragraph — it works when I use that same method in shapes.monkey2, I think because I:
- create my box,
 - resize it,
 - pass that resized box (with, presumably, its resized .Bounds Boxf) to the collider setup.
 
So, collider setup should be using the .Bounds of the resized box model at that point, not scaling after creating the collider. Try this (modded shapes.monkey2):
[EDIT: See stripped-down version below.]
Also, using hard-coded values didn’t work — see the commented-out return values in CreateStatc/DynamicBox in first example.
 - 
		AuthorPosts