Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - da beast

Pages: [1]
1


I think you are translating the world coordinates twice. This means that you have changed the position of the world's origin. You might consider pushing a transformation on, executing the drawing code, the popping it off the stack. Then draw your lines in the world coordinates.

I've not used glut but often those shape drawing commands like to draw a shape at position (0,0,0). This means you have to shift the world cordinates to where you want, draw the shape then return to the original coordinates.


Thanks pixel! It's starting to make sense :P

Code: [Select]

void drawNode() {

glColor3f(1.0f, 1.0f, 1.0f);

// Draw node
glTranslatef(0.0f ,0.75f, 0.0f);
glutSolidCube(1);

glBegin(GL_LINES); //Begin drawing lines
       
    // 2 end points on line
glVertex3f(0.0f, 0.75f, 0.0f);
glVertex3f(0.0f, 2.0f, 0.0f);


glEnd();

// Draw node2
glTranslatef(0.0f, 2.0f, 0.0f);
glutSolidCube(1);

}


// Draw 36 Nodes
for(int i = -3; i < 3; i++)
for(int j=-3; j < 3; j++)
{
glPushMatrix();
glTranslatef(i*10.0f, 0.0f, j * 10.0f);
drawNode();
glPopMatrix();
}
}


2
Thanks for the reply Pixel.  I didn't take your route exactly but I followed your logic.  I have two cubes and a line.  The problem is the line is not touching both cubes! 

Code: [Select]
void drawNodes() {

glColor3f(1.0f, 1.0f, 1.0f);

// Draw node
glTranslatef(0.0f ,0.75f, 0.0f);
glutSolidCube(1);

// Draw node2
glTranslatef(0.0f, 2.0f, 0.0f);
glutSolidCube(1);

glBegin(GL_LINES); //Begin drawing lines
       
    // 2 end points on line
glVertex3f(0.0f, 0.75f, 0.0f);
glVertex3f(0.0f, 2.0f, 0.0f);


glEnd();


}

This is my draw function

3
C / C++ /C# / [C++] Opengl Glut 3D Mesh Topolgy
« on: June 09, 2011 »
It's supposed to rain until next TUESDAY!  SOoOOo I am going to work on my "stalled" project... Because it hasn't moved anywhere in awhile!

I have a project I started in C++ that I am doing for fun to expand my knowledge!  The first phase is a structure that can have unlimited nodes and pointers to other nodes, kind of like a mesh topologyhttp://sing.stanford.edu/gnawali/ctp/vinelab/topolog/topo.gif.  I have a rough draft of it done!  This is the most extensively I have used classes, I even am using a namespace which is a new concept to me! So my knowledge is already expanding. 

I want to build a visual for this structure using openGL.  I have checked out a couple tutorials http://www.lighthouse3d.com/tutorials/glut-tutorial/ because I have never actually done anything with openGL before!

My first question is:  How do objects such as two nodes and a conection(pointer) work together in coding to get a great openGL visual?  Are they all drawn separately?



4
General chat / Re: The Welcoming Comittee
« on: June 01, 2011 »
I heard from a friend I should join!  I'm an intermediate coder hoping to learn more C++ and OpenGL!

Pages: [1]