Page 1 of 2

How to use nGlide environment variables

Posted: Tue Mar 03, 2015 11:47 pm
by Zeus
nGlide 1.04 adds the support for nGlide environment variables. Below, you can find a tutorial how to use them.

WHAT IS THIS THING?
nGlide environment variables is just another way to control nGlide settings (next to nGlide configurator). With them you can override not only default wrapper settings but also those stored by nGlide configurator in windows registry.

DO I NEED IT?
If you need to use individual nGlide settings per game or you like to keep nGlide settings in a portable format, then environment variables are definitely for you. By using them you can not only have separate nGlide configurations per game. You can also have as many nGlide configuration sets per game as you want.

HOW TO USE IT?
The easiest way is to create a batch file (text file with extension renamed to *.bat) and use "set" command.
For example, if you want to change nGlide gamma setting to 0.9 you create a batch file with:

Code: Select all

set NGLIDE_GAMMA=4
start game.exe

.. and instead of launching game.exe directly, you launch the game with the batch file you created.

Settings not defined in a batch file will be taken from nGlide configurator. And if they won't be defined even there, nGlide will use its default settings. The settings chain now looks like this:
Environment variables (highest priority) -> nGlide configurator (medium priority) -> default settings (lowest priority)

This means if you want to be fully portable, you need to define all 6 nGlide settings in batch file.

For example, to run the game with 1920x1080,60Hz,Aspect=4:3,Vsync=enabled,Gamma=1.0,Splash=enabled you need this:

Code: Select all

set NGLIDE_RESOLUTION=21
set NGLIDE_ASPECT=1
set NGLIDE_REFRESH=1
set NGLIDE_VSYNC=1
set NGLIDE_GAMMA=5
set NGLIDE_SPLASH=1
start game.exe

And to run the game with default nGlide settings, this:

Code: Select all

set NGLIDE_RESOLUTION=0
set NGLIDE_ASPECT=0
set NGLIDE_REFRESH=0
set NGLIDE_VSYNC=1
set NGLIDE_GAMMA=5
set NGLIDE_SPLASH=1
start game.exe

Note: game.exe should be replaced with game executable name, e.g. to run Need For Speed 2 SE replace last line to
start nfs2sea.exe.

VARIABLE VALUES LEGEND
Values are identical with settings stored in windows registry by nGlide configurator.

Code: Select all

NGLIDE_RESOLUTION:

0 - "By app (Default)"
1 - "By desktop"
2 - "640 x 480"
3 - "800 x 600"
4 - "1024 x 600"
5 - "1024 x 768"
6 - "1152 x 864"
7 - "1280 x 720"
8 - "1280 x 768"
9 - "1280 x 800"
10 - "1280 x 960"
11 - "1280 x 1024"
12 - "1360 x 768"
13 - "1366 x 768"
14 - "1400 x 1050"
15 - "1440 x 900"
16 - "1440 x 1080"
17 - "1536 x 864"
18 - "1600 x 900"
19 - "1600 x 1200"
20 - "1680 x 1050"
21 - "1920 x 1080"
22 - "1920 x 1200"
23 - "1920 x 1440"
24 - "2048 x 1536"
25 - "2560 x 1440"
26 - "2560 x 1600"
27 - "3840 x 2160"
28 - "7680 x 4320"

Code: Select all

NGLIDE_ASPECT:

0 - "Fit to screen (Default)"
1 - "Preserve original"

Code: Select all

NGLIDE_REFRESH:

0 - "By app (Default)"
1 - "60 Hz"
2 - "70 Hz"
3 - "72 Hz"
4 - "75 Hz"
5 - "85 Hz"
6 - "90 Hz"
7 - "100 Hz"
8 - "120 Hz"
9 - "144 Hz"

Code: Select all

NGLIDE_VSYNC:

0 - "Off"
1 - "On (Default)"

Code: Select all

NGLIDE_GAMMA:

0 - "0.5"
1 - "0.6"
2 - "0.7"
3 - "0.8"
4 - "0.9"
5 - "1.0 (Default)"
6 - "1.1"
7 - "1.2"
8 - "1.3"
9 - "1.4"
10 - "1.5"

Code: Select all

NGLIDE_SPLASH:

0 - "Off"
1 - "On (Default)"

On Linux use "export" command:

Code: Select all

#!/bin/bash
export NGLIDE_RESOLUTION=0
export NGLIDE_ASPECT=0
export NGLIDE_REFRESH=0
export NGLIDE_VSYNC=1
export NGLIDE_GAMMA=5
export NGLIDE_SPLASH=1
wine game.exe

Here you can download the examples.

Re: How to use nGlide environment variables

Posted: Wed Mar 04, 2015 7:00 pm
by Stiletto
It'd be kinda neat if you supported the original Glide environment variables, although many would not apply and I'm not sure what purpose it would serve.

Anyhow, cool addition. :D

Re: How to use nGlide environment variables

Posted: Thu Mar 05, 2015 6:28 am
by NicoDE
Many thanks for the feature, it really helps with testing different configurations.

ps: If one does not want to set the variables permanently (export), one could use env.

Re: How to use nGlide environment variables

Posted: Wed Apr 22, 2015 5:25 am
by VEG
I propose to change format of NGLIDE_RESOLUTION to exact setting of needed resolution.

Using:

Code: Select all

By app:
NGLIDE_RESOLUTION=0 or NGLIDE_RESOLUTION= or NGLIDE_RESOLUTION=byapp or NGLIDE_RESOLUTION=app

By desktop:
NGLIDE_RESOLUTION=1 or NGLIDE_RESOLUTION=bydesktop or NGLIDE_RESOLUTION=desktop

Exact resolution:
NGLIDE_RESOLUTION=640x480

Motivation: currently you can't set many usable resolutions. For example, 5120 x 2880 (http://accessories.us.dell.com/sna/prod ... ku=UP275K3). And it's more vivid: user don't have to use table of resolutions to choose one needed.

Also I propose to change format of NGLIDE_ASPECT setting:

Code: Select all

Fit to screen (Default):
NGLIDE_ASPECT= or NGLIDE_ASPECT=0 or NGLIDE_ASPECT=fitscreen or NGLIDE_ASPECT=screen
By app (always square pixels):
NGLIDE_ASPECT=1 or NGLIDE_ASPECT=byapp or NGLIDE_ASPECT=app
4:3 exactly:
NGLIDE_ASPECT=4:3

Motivation: default glide library supports not only 4:3 resolutions. There is also 5:4, for example 1280×1024. And it's also more vivid and flexible.

Re: How to use nGlide environment variables

Posted: Sat May 02, 2015 4:09 pm
by Zeus
I don't plan any changes in this regard.

nGlide settings are indexed, so it's natural (and simpler) to have them represented as numbers.
Changing integers to strings would cause more damage than good because it would be easier to make a mistake.

Ex1:
NGLIDE_RESOLUTION=640x488
NGLIDE_GAMMA=0.55 (or 0,55)
NGLIDE_VSYNC=Enabled (instead of "On")

Ex2:
NGLIDE_RESOLUTION=by app (default)
NGLIDE_RESOLUTION=by app
NGLIDE_RESOLUTION=byapp
NGLIDE_RESOLUTION=app

VEG wrote:Motivation: currently you can't set many usable resolutions. For example, 5120 x 2880 (http://accessories.us.dell.com/sna/prod ... ku=UP275K3).

All popular resolutions are indexed as separate settings. For those that are not popular you can use Resolution=By desktop, so it's not a problem.

VEG wrote:And it's more vivid: user don't have to use table of resolutions to choose one needed.

Not at all. Users would still need to use the tables. How else would they know if they use defined (supported) values?

Re: How to use nGlide environment variables

Posted: Mon May 04, 2015 12:20 pm
by VEG
Zeus wrote:NGLIDE_RESOLUTION=640x488
But it is easier to set any supported by system resolution without table in this format. Simply open system screen settings and choose any resolution, and after it write it into environment variable. Hardcoded list isn't flexible (you can't set resolution not from list) and in this case user have to open this website to view this list. You could use any symbol (which is not a digit) or group of symbols (e.g. “, ” or “ x ”, with spaces) as a separator. In this case user will be able to set this value not only in format 640x480, but also “640,480”, “640 480” etc. For meanings “by app” and “by desktop” you can still use 0 (or empty value) and 1 if you think that it is more understandable :)

Zeus wrote:NGLIDE_GAMMA=0.55 (or 0,55)
In this case you could always treat “,” as “.” and round value to supported precision. It isn't hard to implement but it is really user-friendly. Also it is more understandable and self-describing enough. For example, if I see bath file with set NGLIDE_GAMMA=0.55, I will understand what does it mean without any tables. And I have to see external tables if magic numbers is used for this setting.

Zeus wrote:NGLIDE_VSYNC=Enabled (instead of "On")
Usually 0 or 1 are used for booleans. There is no problems at all. Of course you can treat also “on”, “true” and “enabled” as “1” for users convenience, but 0 and 1 are easy enough for using and they are understandable.

Zeus wrote:Ex2:
NGLIDE_RESOLUTION=by app (default)
NGLIDE_RESOLUTION=by app
NGLIDE_RESOLUTION=byapp
NGLIDE_RESOLUTION=app

User still can use “table of possible strings of setting X”. String constants much easier to remember (in comparison to magic numbers) and they are self-descriptive.

Even without supporting variety of formats natural values with strict format like 640x480 and 0.55 will be more convenient than magic numbers “5” and “1” which do not carry any sense without tables. If user have written value in format that nGlide doesn't support you may simply ignore this value like you are ignoring invalid integers like “666” (not from tables) now.

Re: How to use nGlide environment variables

Posted: Sun Oct 11, 2015 1:29 pm
by glidenewbie
This important thread should be stickied! Also a link to this from the FAQ on the download page would be nice, don't you think? :)

Re: How to use nGlide environment variables

Posted: Sun Jan 31, 2016 7:06 am
by VEG
Are there some changes in the nGlide 1.05?

Re: How to use nGlide environment variables

Posted: Mon Feb 01, 2016 5:20 am
by Zeus
Nope.

Re: How to use nGlide environment variables

Posted: Mon Jul 04, 2016 9:30 am
by Toshiba-3
Very handy!

Too bad they don't work from within Dosbox (I know, they can be set before Dosbox is run via the batch file, but that's not what I wanted to do :mrgreen: )