Starfield
Hi,
I have this starfield(which moves like its coming towards the user) and when I try to rotate it by using the following code:
float Degrees=sxrot;
glRotatef(-Degrees,1.0f,0.0f,0.0f);
glRotatef(-Degrees,0.0f,0.0f,1.0f);
Degrees+=0.03f;
but when i run it the starfield(dunno why) just collapes downwards or just dissapears. Tell me what i can do to fix this and how can i use gltranslatef for this also?
Saqib
Hey,
Well for starters I''d need a lot more code to try and help you.. Right off hand with what you''ve said, I can''t think of any reason why it wouldn''t work either.. Post some more code and I''ll be happy to try and help...
bosco()
Well for starters I''d need a lot more code to try and help you.. Right off hand with what you''ve said, I can''t think of any reason why it wouldn''t work either.. Post some more code and I''ll be happy to try and help...
bosco()
--leader of the free world .. or something ..
even though i don''t know what u want i can''t really see this working mate
float Degrees=sxrot;
glRotatef(-Degrees,1.0f,0.0f,0.0f);
glRotatef(-Degrees,0.0f,0.0f,1.0f);
Degrees+=0.03f;
explain what u want to see precisely and i''ll give it a go
float Degrees=sxrot;
glRotatef(-Degrees,1.0f,0.0f,0.0f);
glRotatef(-Degrees,0.0f,0.0f,1.0f);
Degrees+=0.03f;
explain what u want to see precisely and i''ll give it a go
even though i don''t know what u want i can''t really see this working mate
float Degrees=sxrot;
glRotatef(-Degrees,1.0f,0.0f,0.0f);
glRotatef(-Degrees,0.0f,0.0f,1.0f);
Degrees+=0.03f;
explain what u want to see precisely and i''ll give it a go
float Degrees=sxrot;
glRotatef(-Degrees,1.0f,0.0f,0.0f);
glRotatef(-Degrees,0.0f,0.0f,1.0f);
Degrees+=0.03f;
explain what u want to see precisely and i''ll give it a go
Well to ease off things. I am making a starfield and now that I have made the starfield I want it to move like in Space Wars(by TipTup) but the main problem is that when I try to rotate the starfield when a right or left key is pressed it just collapses downwards as a 2d picture. I think the problem is with my rotating code which i posted earlier. Any more information plz send me an e-mail at biqas_98@hotmail.com or just post a message here.
Saqib
Saqib
I do not really understand your problem, but I think your Starfield IS 2D...
if youi rotate it ''round the z-Axis you don''t realize it, but if you try to rotate it around the y- or x-Axis you can see that it IS 2D. So you have to delete that line, or make it 3D!
Tell me if I''m wrong!
if youi rotate it ''round the z-Axis you don''t realize it, but if you try to rotate it around the y- or x-Axis you can see that it IS 2D. So you have to delete that line, or make it 3D!
Tell me if I''m wrong!
hi,
Snake you are perfectly correct. But the problem is that when I remove gluOrtho2d the starfield doesnt show up(dunno how to make it work ). What i really need is a good 3d starfield demo or sample( as I have never worked on a 3d starfield only 2d . So plz if anyone can provide me with a 3d starfield demo or samp at biqas_98@hotmail.com.
Saqib
Snake you are perfectly correct. But the problem is that when I remove gluOrtho2d the starfield doesnt show up(dunno how to make it work ). What i really need is a good 3d starfield demo or sample( as I have never worked on a 3d starfield only 2d . So plz if anyone can provide me with a 3d starfield demo or samp at biqas_98@hotmail.com.
Saqib
you can do it in a few ways...
one way is to make it 2D using angles and when you create a star, give it a random(360) degree... then it''s gonna look like it''s going to look like it''s going in space... in order to figure out the color of the star, use the distance formula, and the farther the star is from the center, the brighter (white) it is, and the closer to the center it is the darker (black/grey) it is...
the other way is to use real 3D coordinates, and simply start with a Z value that is positive (pretty big one) (maybre 1500... 1000.. 500... it''s up to you.. depending on the screen resolution and a few other things...(that''s if you''re using the right coordinate system, for which the positive Z values go into the screen and the negative values come out of the screen)... then you simply decrease the Z value, until it is <= 0.01 or <= 0.1, you figure it out... dont let it become 0 or you''re gonna get a div by 0 error... not good at all... anyways... once the Z value is <= 0.01 (or whatever) you simply reset the star''s x, y, and z values (as well as the color)... now the higher Z value, the darker the color... you get the idea.. that''s if you''re using the coordinate system i mentioned above... now the only thing left is to project the 3D points onto a 2D screen and you have your 3D star demo.. if you need examples of any of those two methods, e-mail me at welcomehowcome@hotmail.com
L8r!
..-=gLaDiAtOr=-..
one way is to make it 2D using angles and when you create a star, give it a random(360) degree... then it''s gonna look like it''s going to look like it''s going in space... in order to figure out the color of the star, use the distance formula, and the farther the star is from the center, the brighter (white) it is, and the closer to the center it is the darker (black/grey) it is...
the other way is to use real 3D coordinates, and simply start with a Z value that is positive (pretty big one) (maybre 1500... 1000.. 500... it''s up to you.. depending on the screen resolution and a few other things...(that''s if you''re using the right coordinate system, for which the positive Z values go into the screen and the negative values come out of the screen)... then you simply decrease the Z value, until it is <= 0.01 or <= 0.1, you figure it out... dont let it become 0 or you''re gonna get a div by 0 error... not good at all... anyways... once the Z value is <= 0.01 (or whatever) you simply reset the star''s x, y, and z values (as well as the color)... now the higher Z value, the darker the color... you get the idea.. that''s if you''re using the coordinate system i mentioned above... now the only thing left is to project the 3D points onto a 2D screen and you have your 3D star demo.. if you need examples of any of those two methods, e-mail me at welcomehowcome@hotmail.com
L8r!
..-=gLaDiAtOr=-..
Hey Saqib where''ve you been? Have you gone to the states already? If so email me. The game devellopment is coming along very good.
The object of war is not to die for your country, but to make the other bastard die for his . . -General MacArthur
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement