Advertisement

glrotatef

Started by September 16, 2001 09:51 AM
3 comments, last by Unini 23 years, 5 months ago
I want to use a variable inside glrotatef, is that possible?? the numbers inside glrotatef all have a ''F'' behind them (5.0f). Sgould I use glrotate without the F or maybe use a special variable??
0.5f f says its a float! use a float variable!
float i_dont_know_what = 0.5f;
glrotatef(i_dont_know_what,i_dont_know_what,i_dont_know_what);
is the same as
glrotate(0.5f, 0.5f, 0.5f);
Advertisement
I have the same problem, but then with glTranslatef.
But what you said didnt work.
Im using my float variables in a struct, is that a prob??
here''s the code.

struct ship
{
float x_pos;
float y_pos;
};

ship player;
player.x_pos = 10.0f;
player.y_pos = 10.0f;

...

gltranslate(player.x_pos, player.y_pos, 0.0f);
*************************************************************
"Im using my float variables in a struct, is that a prob??
here''s the code.

struct ship
{
float x_pos;
float y_pos;
};"
**************************************************************
Not that it should matter but i think the ''Red Book'' recommends using GL variables for GL functions so maybe try:

struct ship
{
GLfloat x_pos;
GLfloat y_pos;
};


I use struct vars in both translate and rotate, and they both work with just a "float"!!!
I don''t have to declare them as GLfloats, but i also got that recomended, so i use them now!

Anonymous Poster :

I presume this is not what you are doing in the game/demo :

gltranslate(player.x_pos, player.y_pos, 0.0f);

If so, you should try setting the Z-position a little back from the camera!

0.0f is where the camera stands........

And you might also, unless player.x_pos equals 0 from the start, give the vars a value in
your init function! Not much, but it might help with some head scrathing in the future....

Take Care!

- -- ---[XaOs]--- -- -

[ project fy ]
- -- ---[XaOs]--- -- -[ Project fy ||| CyberTux ]

This topic is closed to new replies.

Advertisement