• Create Account

### #ActualVortez

Posted 22 April 2013 - 09:08 AM

NeHe have some nice fonts tutorial.

http://nehe.gamedev.net/tutorial/bitmap_fonts/17002/

http://nehe.gamedev.net/tutorial/freetype_fonts_in_opengl/24001/

Freetype fonts look better since they're antialiased but is more difficult to implement than simple bitmap fonts, but i find bitmap font more suitable for small font anyway, so, feel free to experiment with them.

You could try my bitmap font class build from the first tutorial, it work great and is easy to use, although i admit the build function could be a bit better... feel free to modify it if you wish. Bitmaster have a nice approach too, that would probably look even better that way.

Not that it matter much, but why did you defined pluto before neptune? Pluto is the fartest planet(or rather, was), not neptune, well, most of the time, due to is elliptical orbit.

Also, looking at your code, they're a lot of it that could be put inside functions intead, especially the planet drawing part, it's basically the same code but with different parameters. You could also store those numbers in arrays from 0 being the sun and 9, pluto. Same thing for the GenerateTexture function, all those ifs could be replaced with a loop using arrays.

GLuint PlanetTextures[10];

...

for(int i = 0; i <= 9; i++){
glGenTextures(1, &PlanetTextures[i]);
glBindTexture(GL_TEXTURE_2D, PlanetTextures[i]);
}


void DrawPlanets(GLuint Indx)
{
glPushMatrix();

glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, PlanetTextures[Indx]);

glRotatef(fNeptuneRot, InitialRotation[Indx].x, InitialRotation[Indx].y, InitialRotation[Indx].z);

glTranslatef(Position[Indx].x,Position[Indx].y,Position[Indx].z);
glRotatef(Rotation[Indx], 1.0f, 0.0f, 0.0f);
glRotatef(fTilt[Indx] * 3, 0.0f, 0.0f, 1.0f);
gluSphere(pObj, PlanetsSize[Indx].x, PlanetsSize[Indx].y, PlanetsSize[Indx].z);
glDisable(GL_TEXTURE_2D);

Rotation[Indx] += RotationIncrement[Indx];
if(Rotation[Indx] >= 360.0f)
Rotation[Indx] = 0.0f;

glPopMatrix();
}


Much better now don't you think

As for the "mouse action", well just process the WM_LBUTTONDOWN message in the messages loop.

One last thing, im pretty sure you could generate those speres once at initialization time, then delete them when the program close, that would save you a bit of computation time and make the simulation faster.

I don't know how your simulation look, but i've tried to make one to real scale once and, well, everything was so tiny and far away it wasen't very good, but i guess yours look good by the way you described it. Good luck.

### #25Vortez

Posted 22 April 2013 - 08:53 AM

NeHe have some nice fonts tutorial.

http://nehe.gamedev.net/tutorial/bitmap_fonts/17002/

http://nehe.gamedev.net/tutorial/freetype_fonts_in_opengl/24001/

Freetype fonts look better since they're antialiased but is more difficult to implement than simple bitmap fonts, but i find bitmap font more suitable for small font anyway, so, feel free to experiment with them.

You could try my bitmap font class build from the first tutorial, it work great and is easy to use, although i admit the build function could be a bit better... feel free to modify it if you wish.

Not that it matter much, but why did you defined pluto before neptune? Pluto is the fartest planet(or rather, was), not neptune, well, most of the time, due to is elliptical orbit.

Also, looking at your code, they're a lot of it that could be put inside functions intead, especially the planet drawing part, it's basically the same code but with different parameters. You could also store those numbers in arrays from 0 being the sun and 9, pluto. Same thing for the GenerateTexture function, all those ifs could be replaced with a loop using arrays.

GLuint PlanetTextures[10];

...

for(int i = 0; i <= 9; i++){
glGenTextures(1, &PlanetTextures[i]);
glBindTexture(GL_TEXTURE_2D, PlanetTextures[i]);
}


void DrawPlanets(GLuint Indx)
{
glPushMatrix();

glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, PlanetTextures[Indx]);

glRotatef(fNeptuneRot, InitialRotation[Indx].x, InitialRotation[Indx].y, InitialRotation[Indx].z);

glTranslatef(Position[Indx].x,Position[Indx].y,Position[Indx].z);
glRotatef(Rotation[Indx], 1.0f, 0.0f, 0.0f);
glRotatef(fTilt[Indx] * 3, 0.0f, 0.0f, 1.0f);
gluSphere(pObj, PlanetsSize[Indx].x, PlanetsSize[Indx].y, PlanetsSize[Indx].z);
glDisable(GL_TEXTURE_2D);

Rotation[Indx] += RotationIncrement[Indx];
if(Rotation[Indx] >= 360.0f)
Rotation[Indx] = 0.0f;

glPopMatrix();
}


Much better now don't you think

As for the "mouse action", well just process the WM_LBUTTONDOWN message in the messages loop.

One last thing, im pretty sure you could generate those speres once at initialization time, then delete them when the program close, that would save you a bit of computation time and make the simulation faster.

I don't know how your simulation look, but i've tried to make one to real scale once and, well, everything was so tiny and far away it wasen't very good, but i guess yours look good by the way you described it. Good luck.

### #24Vortez

Posted 22 April 2013 - 08:49 AM

NeHe have some nice fonts tutorial.

http://nehe.gamedev.net/tutorial/bitmap_fonts/17002/

http://nehe.gamedev.net/tutorial/freetype_fonts_in_opengl/24001/

Freetype fonts look better since they're antialiased but is more difficult to implement than simple bitmap fonts, but i find bitmap font more suitable for small font anyway, so, feel free to experiment with them.

You could try my bitmap font class build from the first tutorial, it work great and is easy to use, although i admit the build function could be a bit better... feel free to modify it if you wish.

Not that it matter much, but why did you defined pluto before neptune? Pluto is the fartest planet(or rather, was), not neptune, well, most of the time, due to is elliptical orbit.

Also, looking at your code, they're a lot of it that could be put inside functions intead, especially the planet drawing part, it's basically the same code but with different parameters. You could also store those numbers in arrays from 0 being the sun and 9, pluto. Same thing for the GenerateTexture function, all those ifs could be replaced with a loop using arrays.

GLuint PlanetTextures[10];

...

for(int i = 0; i <= 9; i++){
glGenTextures(1, &PlanetTextures[i]);
glBindTexture(GL_TEXTURE_2D, PlanetTextures[i]);
}


void DrawPlanets(GLuint Indx)
{
glPushMatrix();

glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, PlanetTextures[Indx]);

glRotatef(fNeptuneRot, InitialRotation[Indx].x, InitialRotation[Indx].y, InitialRotation[Indx].z);

glTranslatef(Position[Indx].x,Position[Indx].y,Position[Indx].z);
glRotatef(Rotation[Indx], 1.0f, 0.0f, 0.0f);
glRotatef(fTilt[Indx] * 3, 0.0f, 0.0f, 1.0f);
gluSphere(pObj, PlanetsSize[Indx].x, PlanetsSize[Indx].y, PlanetsSize[Indx].z);
glDisable(GL_TEXTURE_2D);

Rotation[Indx] += RotationIncrement[Indx];
if(Rotation[Indx] >= 360.0f)
Rotation[Indx] = 0.0f;

glPopMatrix();
}


Much better now don't you think

As for the "mouse action", well just process the WM_LBUTTONDOWN message in the messages loop.

I don't know how your simulation look, but i've tried to make one to real scale once and, well, everything was so tiny and far away it wasen't very good, but i guess yours look good by the way you described it. Good luck.

### #23Vortez

Posted 22 April 2013 - 08:47 AM

NeHe have some nice fonts tutorial.

http://nehe.gamedev.net/tutorial/bitmap_fonts/17002/

http://nehe.gamedev.net/tutorial/freetype_fonts_in_opengl/24001/

Freetype fonts look better since they're antialiased but is more difficult to implement than simple bitmap fonts, but i find bitmap font more suitable for small font anyway, so, feel free to experiment with them.

You could try my bitmap font class build from the first tutorial, it work great and is easy to use, although i admit the build function could be a bit better... feel free to modify it if you wish.

Not that it matter much, but why did you defined pluto before neptune? Pluto is the fartest planet(or rather, was), not neptune, well, most of the time, due to is elliptical orbit.

Also, looking at your code, they're a lot of it that could be put inside functions intead, especially the planet drawing part, it's basically the same code but with different parameters. You could also store those numbers in arrays from 0 being the sun and 9, pluto. Same thing for the GenerateTexture function, all those ifs could be replaced with a loop using arrays.

GLuint PlanetTextures[10];

...

for(int i = 0; i <= 9; i++){
glGenTextures(1, &PlanetTextures[i]);
glBindTexture(GL_TEXTURE_2D, PlanetTextures[i]);
}


void DrawPlanets(GLuint Indx)
{
glPushMatrix();

glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, PlanetTextures[Indx]);

glRotatef(fNeptuneRot, InitialRotation[Indx].x, InitialRotation[Indx].y, InitialRotation[Indx].z);

glTranslatef(Position[Indx].x,Position[Indx].y,Position[Indx].z);
glRotatef(Rotation[Indx], 1.0f, 0.0f, 0.0f);
glRotatef(fTilt[Indx] * 3, 0.0f, 0.0f, 1.0f);
gluSphere(pObj, PlanetsSize[Indx].x, PlanetsSize[Indx].y, PlanetsSize[Indx].z);
glDisable(GL_TEXTURE_2D);

Rotation[Indx] += RotationIncrement[Indx];
if(Rotation[Indx] >= 360.0f)
Rotation[Indx] = 0.0f;

glPopMatrix();
}


Much better now don't you think

As for the "mouse action", well just process the WM_LBUTTONDOWN message in the messages loop.

I don't know how your simulation look, but i've tried to make one to real scale once and, well, everything was so tiny and far away it wasen't very good, but i guess yours look good by the way you described it. Good luck.

### #22Vortez

Posted 22 April 2013 - 08:46 AM

NeHe have some nice fonts tutorial.

http://nehe.gamedev.net/tutorial/bitmap_fonts/17002/

http://nehe.gamedev.net/tutorial/freetype_fonts_in_opengl/24001/

Freetype fonts look better since they're antialiased but is more difficult to implement than simple bitmap fonts, but i find bitmap font more suitable for small font anyway, so, feel free to experiment with them.

You could try my bitmap font class build from the first tutorial, it work great and is easy to use, although i admit the build function could be a bit better... feel free to modify it if you wish.

Not that it matter much, but why did you defined pluto before neptune? Pluto is(or rather, was) the fartest planet, not neptune, well, most of the time, due to is elliptical orbit.

Also, looking at your code, they're a lot of it that could be put inside functions intead, especially the planet drawing part, it's basically the same code but with different parameters. You could also store those numbers in arrays from 0 being the sun and 9, pluto. Same thing for the GenerateTexture function, all those ifs could be replaced with a loop using arrays.

GLuint PlanetTextures[10];

...

for(int i = 0; i <= 9; i++){
glGenTextures(1, &PlanetTextures[i]);
glBindTexture(GL_TEXTURE_2D, PlanetTextures[i]);
}


void DrawPlanets(GLuint Indx)
{
glPushMatrix();

glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, PlanetTextures[Indx]);

glRotatef(fNeptuneRot, InitialRotation[Indx].x, InitialRotation[Indx].y, InitialRotation[Indx].z);

glTranslatef(Position[Indx].x,Position[Indx].y,Position[Indx].z);
glRotatef(Rotation[Indx], 1.0f, 0.0f, 0.0f);
glRotatef(fTilt[Indx] * 3, 0.0f, 0.0f, 1.0f);
gluSphere(pObj, PlanetsSize[Indx].x, PlanetsSize[Indx].y, PlanetsSize[Indx].z);
glDisable(GL_TEXTURE_2D);

Rotation[Indx] += RotationIncrement[Indx];
if(Rotation[Indx] >= 360.0f)
Rotation[Indx] = 0.0f;

glPopMatrix();
}


Much better now don't you think

As for the "mouse action", well just process the WM_LBUTTONDOWN message in the messages loop.

I don't know how your simulation look, but i've tried to make one to real scale once and, well, everything was so tiny and far away it wasen't very good, but i guess yours look good by the way you described it. Good luck.

### #21Vortez

Posted 22 April 2013 - 08:45 AM

NeHe have some nice fonts tutorial.

http://nehe.gamedev.net/tutorial/bitmap_fonts/17002/

http://nehe.gamedev.net/tutorial/freetype_fonts_in_opengl/24001/

Freetype fonts look better since they're antialiased but is more difficult to implement than simple bitmap fonts, but i find bitmap font more suitable for small font anyway, so, feel free to experiment with them.

You could try my bitmap font class build from the first tutorial, they work great, although i admit the build function could be a bit better... feel free to modify it if you wish.

Not that it matter much, but why did you defined pluto before neptune? Pluto is(or rather, was) the fartest planet, not neptune, well, most of the time, due to is elliptical orbit.

Also, looking at your code, they're a lot of it that could be put inside functions intead, especially the planet drawing part, it's basically the same code but with different parameters. You could also store those numbers in arrays from 0 being the sun and 9, pluto. Same thing for the GenerateTexture function, all those ifs could be replaced with a loop using arrays.

GLuint PlanetTextures[10];

...

for(int i = 0; i <= 9; i++){
glGenTextures(1, &PlanetTextures[i]);
glBindTexture(GL_TEXTURE_2D, PlanetTextures[i]);
}


void DrawPlanets(GLuint Indx)
{
glPushMatrix();

glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, PlanetTextures[Indx]);

glRotatef(fNeptuneRot, InitialRotation[Indx].x, InitialRotation[Indx].y, InitialRotation[Indx].z);

glTranslatef(Position[Indx].x,Position[Indx].y,Position[Indx].z);
glRotatef(Rotation[Indx], 1.0f, 0.0f, 0.0f);
glRotatef(fTilt[Indx] * 3, 0.0f, 0.0f, 1.0f);
gluSphere(pObj, PlanetsSize[Indx].x, PlanetsSize[Indx].y, PlanetsSize[Indx].z);
glDisable(GL_TEXTURE_2D);

Rotation[Indx] += RotationIncrement[Indx];
if(Rotation[Indx] >= 360.0f)
Rotation[Indx] = 0.0f;

glPopMatrix();
}


Much better now don't you think

As for the "mouse action", well just process the WM_LBUTTONDOWN message in the messages loop.

I don't know how your simulation look, but i've tried to make one to real scale once and, well, everything was so tiny and far away it wasen't very good, but i guess yours look good by the way you described it. Good luck.

PARTNERS