Advertisement

Why does this happen?

Started by January 06, 2002 10:51 AM
26 comments, last by SonShadowCat 23 years, 1 month ago
i also dont get how come a mine field was not created

i mean weren''t the for loops supposed to create a mine field 2 triangles high, wide, and deep?
why didnt it?

i have been thinking about the code for about 10 hours now and i really stumped even with the info you all gave me

"Those who serve no purpose, have no purpose. SSC the Super Saiyan Cat"
--------------------------------- "Those who serve no purpose, have no purpose."- SSC Oh the possibilities!!Edited By - SonShadowCat on Your Girlfriends Birthday
Ok then, let me make a simple version myself.
    void DrawMine(int x, int y, int z, int xrot, int yrot, int zrot){   glTranslatef(x, y, z);   glRotatef(xrot, 1.0f, 0.0f, 0.0f);   glRotatef(yrot, 0.0f, 1.0f, 0.0f);   glRotatef(zrot, 0.0f, 0.0f, 1.0f);   triangle.DrawTriangle();  // I assume this custom   glRotatef(-zrot, 0.0f, 0.0f, 1.0f);   glRotatef(-yrot, 0.0f, 1.0f, 0.0f);   glRotatef(-xrot, 1.0f, 0.0f, 0.0f);   glTranslatef(-x, -y, -z);}void DrawMineField(int width, int height, int depth, GLfloat spacing){   glTranslatef((0.5f*(width*spacing)), (0.5f*(height*spacing)), (0.5f*(depth*spacing)));   for(int x=0; x<width; x++)   {      for(int y=0; y<height; y++)      {         for(int z=0; z<depth; x++)         {            DrawMine((x*spacing), (y*spacing), (z*spacing), xrot, yrot, 0);         }      }   }}  


In this example DrawMineField will draw your mine field with a specified width, height, and depth. The center of the mine field will be on the origin. I hope this helps. Mind you, I did not test this, I just wrote it.

Alex Broadwin
A-Tronic Software & Design
-----
"if you fail in life, you were destined to fail. If you suceed in life, call me."
"The answer is out there."
"Please help, I'm using Windows!"

Edited by - ATronic on January 6, 2002 2:23:09 PM
Alex BroadwinA-Tronic Software & Design-----"if you fail in life, you were destined to fail. If you suceed in life, call me.""The answer is out there.""Please help, I'm using Windows!"
Advertisement
im gonna try that but im gonna put it all in DrawGLScene()
i hope this works

"Those who serve no purpose, have no purpose. SSC the Super Saiyan Cat"
--------------------------------- "Those who serve no purpose, have no purpose."- SSC Oh the possibilities!!Edited By - SonShadowCat on Your Girlfriends Birthday
Heh, had to make a correction there. If you got the code and tried it, re-get it.

Alex Broadwin
A-Tronic Software & Design
-----
"if you fail in life, you were destined to fail. If you suceed in life, call me."
"The answer is out there."
"Please help, I''m using Windows!"
Alex BroadwinA-Tronic Software & Design-----"if you fail in life, you were destined to fail. If you suceed in life, call me.""The answer is out there.""Please help, I'm using Windows!"
Just copy the functions over and use the FUNCTION in the draw scene. Don''t mess with the code, that''s probably a bad idea.

Alex Broadwin
A-Tronic Software & Design
-----
"if you fail in life, you were destined to fail. If you suceed in life, call me."
"The answer is out there."
"Please help, I''m using Windows!"
Alex BroadwinA-Tronic Software & Design-----"if you fail in life, you were destined to fail. If you suceed in life, call me.""The answer is out there.""Please help, I'm using Windows!"
quick fix, just rotate before you translate
"I never let schooling interfere with my education" - Mark Twain
Advertisement
first im gonna do one without the rotations becuase then I could go on understand what rotating it did

what i would like to know is why you multiplied 0.5f by the spacing and width/depth/etc? why not just multiply them by 1.0f?

"Those who serve no purpose, have no purpose. SSC the Super Saiyan Cat"
--------------------------------- "Those who serve no purpose, have no purpose."- SSC Oh the possibilities!!Edited By - SonShadowCat on Your Girlfriends Birthday
I did that to center the mine field. But I just realized it should be -0.5f. Make that change.

Alex Broadwin
A-Tronic Software & Design
-----
"if you fail in life, you were destined to fail. If you suceed in life, call me."
"The answer is out there."
"Please help, I''m using Windows!"
Alex BroadwinA-Tronic Software & Design-----"if you fail in life, you were destined to fail. If you suceed in life, call me.""The answer is out there.""Please help, I'm using Windows!"
glTranslatef((0.5f*(width*spacing)), (0.5f*(height*spacing)), (0.5f*(depth*spacing)));

so the 0.5f should be -0.5f?

or do i add another translate after the loop that has -0.5f?

"Those who serve no purpose, have no purpose. SSC the Super Saiyan Cat"
--------------------------------- "Those who serve no purpose, have no purpose."- SSC Oh the possibilities!!Edited By - SonShadowCat on Your Girlfriends Birthday
See above.

Alex Broadwin
A-Tronic Software & Design
-----
"if you fail in life, you were destined to fail. If you suceed in life, call me."
"The answer is out there."
"Please help, I''m using Windows!"
Alex BroadwinA-Tronic Software & Design-----"if you fail in life, you were destined to fail. If you suceed in life, call me.""The answer is out there.""Please help, I'm using Windows!"

This topic is closed to new replies.

Advertisement