• Create Account

Interested in a FREE copy of HTML5 game maker Construct 2?

We'll be giving away three Personal Edition licences in next Tuesday's GDNet Direct email newsletter!

We're also offering banner ads on our site from just \$5! 1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.

### #Actualyoupi1

Posted 20 January 2013 - 06:24 PM

I try to find the good initial value at the start of simulation. I took on the following image a value equal to 100 kpc (kpc is the unity used in my code for the positions of each particles)

### #4youpi1

Posted 20 January 2013 - 06:24 PM

I try to find the good initial value at the start of simulation. I took on the following image a value equal to 100 kpc (kpc is the unity used in my code for the positions of each particles)

### #3youpi1

Posted 20 January 2013 - 06:24 PM

I try to find the good initial value at the start of simulation. I took on the following image a value equal to 100 kpc (kpc is the unity used in my code for the positions of each particles)

### #2youpi1

Posted 20 January 2013 - 06:23 PM

I try to find the good initial value at the start of simulation. I took on the following image a value equal to 100 kpc (kpc is the unity used in my code for the positions of each particles)

### #1youpi1

Posted 16 January 2013 - 03:16 AM

I have made a simple gui with OpenGL which models the dynamics of a galaxy. I used head up display to show a scale line value that changes with zooming in and out.

I try to find the good initial value at the start of simulation. I took on the following image a value equal to 100 kpc (kpc is the unity used in my code for the positions of each particles) :

[attachment=13272:test2.png]

This widget has a 600x600 size, that's why I have intuitively drawn a line with 100 value but I can see that this value is not good in comparison with the positions of particles. Actually this seems to be more complicated Indeed, at the OpenGL initialization, i.e the start of simulation,  with

isDisplayFirst = true;
w_width = 600;
w_height = 600;
g_nearPlane = 0.1f;
g_farPlane = 1000.0f;


I do :

     if (isDisplayFirst)
{
isDisplayFirst = false;

// Reset line scale value
lineScaleValue = 100.0f;

// Initialize View
glViewport(0, 0, w_width, w_height);

glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
glLoadIdentity(); // Reset The Projection Matrix

glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
glLoadIdentity(); // Reset The Modelview Matrixi

gluPerspective(45.0f, (float)w_width / w_height, g_nearPlane, g_farPlane);
gluLookAt (0.0, 0.0, 3.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0);
glScalef(0.03f, 0.03f, 0.03f);
}


So, with gluLookAt, I am firstly at z=3 with theta = 45; then, y/z = x/z = tan(45) = 1  ====> y = x = 3

After, with glScalef(0.03f, 0.03f, 0.03f),

can I make : y = x = 3 * 100 /3 = 100 ?

Do have I got to take account of g_nearPlane and gfarPlane values in my computation ?

Any help would be appreciated

PARTNERS