Page 1 of 1

CSapphireWnd::CalcCursorMapPos error: - gluUnProject failed

PostPosted: Thu Oct 25, 2012 1:29 pm
by VovoNauta
After several days working on my project only get this error in the log file:

======================
CSapphireWnd::CalcCursorMapPos error:
- gluUnProject failed (1)

CSapphireWnd::CalcCursorMapPos error:
- gluUnProject failed (1)

CSapphireWnd::CalcCursorMapPos error:
- gluUnProject failed (1)

CSapphireWnd::CalcCursorMapPos error:
- gluUnProject failed (1)

CSapphireWnd::CalcCursorMapPos error:
- gluUnProject failed (1)

CSapphireWnd::CalcCursorMapPos error:
- gluUnProject failed (1)

CSapphireWnd::CalcCursorMapPos error:
- gluUnProject failed (1)
======================================

Creating a new project this error also occurs.

What would that be?

tks

Re: CSapphireWnd::CalcCursorMapPos error: - gluUnProject fa

PostPosted: Thu Oct 25, 2012 2:56 pm
by VovoNauta
Resolved.

I uninstalled and reinstalled. Working.

tks

Re: CSapphireWnd::CalcCursorMapPos error: - gluUnProject fa

PostPosted: Fri Oct 26, 2012 2:17 pm
by Aaron
Hi VovoNauta,

Thank you for reporting this fault. Please let me know if it comes back.

Best regards,
Aaron.

Re: CSapphireWnd::CalcCursorMapPos error: - gluUnProject fa

PostPosted: Fri Feb 08, 2013 4:07 pm
by falconsan
Hello,

same Problem here. After hours of work, the Programm says me the following Error:

CSapphireWnd::CalcCursorMapPos error:
- gluUnProject failed (1)

The Reinstall takes no effect. The Error still occurs and the Cursor in the Heightfield Editor 3d doesn't work properly.

Sorry for my terrible bad English. I haven't use this Language since 1988.. :)

with best regrads

Re: CSapphireWnd::CalcCursorMapPos error: - gluUnProject fa

PostPosted: Thu Feb 14, 2013 10:50 am
by Aaron
Hi falconsan,

I apologise for the delay in my reply, and for the inconvenience caused by this bug. Can you please send me the log file? (see here for how).

Also, have you tried to update the drivers for your 3D accelerator?

Best regards,
Aaron.

Re: CSapphireWnd::CalcCursorMapPos error: - gluUnProject fa

PostPosted: Tue Jun 25, 2013 6:10 am
by sampei
Happened to me as well, reinstalled and now works like a charm

Re: CSapphireWnd::CalcCursorMapPos error: - gluUnProject fa

PostPosted: Thu Feb 20, 2014 11:42 pm
by bendragon1337
I got this bug by simply generating a heightmap in the 3D view, and pressing - on my keypad till the view goes to 0. And then it doesn't let me do anything other then use the design screen.

I got this error in less then a minute of installation and running.

Edit: I notice the last post was made over a year ago, and the problem isn't fixed?

Re: CSapphireWnd::CalcCursorMapPos error: - gluUnProject fa

PostPosted: Fri Feb 21, 2014 11:44 am
by Aaron
Hi bendragon1337,

I apologise for this inconvenience. Can you please send me the logfile? You can get to it by clicking on the 'All programs->Bundysoft->L3DT [version]->L3DT logs' shortcut in the Windows Start menu. That shortcut will open a directory, in which you will find a file called 'log.txt'. Please send it to aaron@bundysoft.com. With the logfile, I may be able to work out what is going wrong.

Also, just in case this is a problem in the 3D renderer's settings, can you please also send the settings file located at:

C:\Users\[your windows user name]\AppData\Roaming\Bundysoft\L3DT\All versions\Settings\Sapphire.ini.xml

[note that 'AppData' is hidden by default in explorer, so you'll need to show hidden files and folders in Explorer's folder options.]

bendragon1337 wrote:Edit: I notice the last post was made over a year ago, and the problem isn't fixed?


Indeed. I've not been able to reproduce this yet, and I've not yet been lucky enough to have a user send me a logfile from when this occurs. I would be most grateful if you could do so.

Best regards,
Aaron.

Re: CSapphireWnd::CalcCursorMapPos error: - gluUnProject fa

PostPosted: Fri Feb 21, 2014 2:28 pm
by bendragon1337
Hi Aaron, I've identified where the problem lies, it lies within the renderer.

You see, there's "-" on the keypad, which, according to http://www.bundysoft.com/wiki/doku.php?id=plugins:sapphire:userguide:controls, reduces the rendering distance, which makes sense, and there's also an accompanying "+" which increases the rendering distance, which fails to work. so what tends to happen would be the rendering distance gets turned down to 0 and there's no way to increase it again, which returns the error, a reinstall suggested above resets the rendering distance and thus, fixs the problem (not sure how this error and the renderer's max view distance relates to one another).

This view distance translates down to many other views in the program.

Can you please validate if it happens on your edition too?

It would be nice if there was a way to do it in the GUI as well as a keyboard shortcut.

This happens in the standard release and beta release of the free program.

Since I can't really access my E-mail account at the moment, I have to supplement another method instead of it.

Edit: The log file, http://filesmelt.com/dl/log36.txt

Edit: The Sapphire.ini.xml, http://filesmelt.com/dl/Sapphire.ini_.xmlt

Hope this added detail helps.

Re: CSapphireWnd::CalcCursorMapPos error: - gluUnProject fa

PostPosted: Sat Feb 22, 2014 2:31 am
by Aaron
Hi bendragon1337,

Thanks for the info. I get the same behaviour on my system with the view distance set to zero.The event handler for the '-' and '+' keys step the view distance down/up by 20%. The problem was, when the view distance gets smaller than 1, it is truncated to zero (integer handling), so pressing '+' to step it up won't do anything, since 120% of 0 is still 0. There's no reason to have a very short view distance (thus I never tested it, I guess), so I've modified the plugin to have a minimum value of 256 vertices. The clipping distance now is validated in the menu/toolbar/keyboard event handler, and also when loading settings so that existing installations get automatically fixed when the plugin is updated.

The updated plugin will be included in the next developmental build. In the mean-time, you can manually correct the dodgy value in your installation by using the 'Extensions->Sapphire->Renderer settings' menu option in L3DT. In the settings dialog, set the 'Terrain.FarDistance' setting to 256 or so.

I've checked the other event handlers in Sapphire (e.g. changing the texture LOD bias, triangle count, etc.) and they all had proper limits already and/or don't cause errors when given unusual values. I'm sure it's still possible to inject some invalid parameters using the settings window (see above), but it's hard to do that inadvertently, and users are free to deliberately misconfigure the software if they like.

not sure how this error and the renderer's max view distance relates to one another


The gluUnProject error occurs when the renderer tries to use the OpenGL projection matrix to map the 2D mouse cursor position into a 3D world-space vector, which I use to calculate the raycast intersection with the terrain so that I can work out what patch of the terrain the mouse is pointing at. If the far clipping distance is set to zero, the projection matrix is undefined, so the unprojection will fail.

Thanks again for the bug report and the info.

Best regards,
Aaron.

Re: CSapphireWnd::CalcCursorMapPos error: - gluUnProject fa

PostPosted: Sat Feb 22, 2014 11:00 am
by bendragon1337
Sorry, but I don't think that's the only problem, you see, the "+" doesn't increase the render distance either, can you check if yours does the same?

By the way, thanks for the fix.

Re: CSapphireWnd::CalcCursorMapPos error: - gluUnProject fa

PostPosted: Sat Feb 22, 2014 11:18 am
by Aaron
Hi bendragon1337,

No, the one change fixes the + key too, which only stopped working for clipping distances less than 5 due to integer rounding. For example, if the clipping distance is 4 and you hit the '+' key, the clipping distance would nominally be increased by 20%, making it 4.8. However, with integer rounding, 4.8 is truncated to 4, so there's no change, and the key apparently has no effect. For clipping distance values of 5 or greater, the 20% increment is always 1 or more. Thus, integer rounding will never prevent the clipping distance from being increased if the value is already 5 or more.

With a minimum clipping distance of 256 in the next build, the + key is guaranteed to always work.

Thanks again for the bug report, and for your effort and consideration in debugging this fault.

Best regards,
Aaron.