Hi,
I have been studying OpenGl for a while. I tried to draw a mesh on the screen for days. The mesh wasn't ceated right no matter how much I tried.
Anyone out there can tell me why OpenGl is so hard to learn.
Hi,
I have been studying OpenGl for a while. I tried to draw a mesh on the screen for days. The mesh wasn't ceated right no matter how much I tried.
Anyone out there can tell me why OpenGl is so hard to learn.
Well, the difficulty of OpenGL is bound to vary from person to person, so this question may be unanswerable. I myself have no difficulty at all with OpenGL itself. It is just a simple state machine. For me the hardest part is understanding 3D graphics in general.
I was a math student in college. I have no problem to understand how the 3D works. However, when I started the project two weeks ago, I just had very hard time to even draw a mesh on the screen. I feel so frustrated right now. I even don't know how to continue my work next. I jst feel clueless.
Originally posted by DFrey:
Well, the difficulty of OpenGL is bound to vary from person to person, so this question may be unanswerable. I myself have no difficulty at all with OpenGL itself. It is just a simple state machine. For me the hardest part is understanding 3D graphics in general.
http://nehe.gamedev.net
This might help.
Thank you.
I already looked the site and learned a lot of useful info from the site.
However, when I turned to my project, it wasn't working at all.
I was wondering if you can take a look my code and tell me what I did wrong.
What you should probably do first is describe the sytmptoms... so far all we know is that "it doesn't work" and you're frustrated. Not really enough info to help at all. Before you go posting loads of code just give a quick description of what you're trying to accomplish and where it seems to be failing. This will often be enough to allow someone to make a helpful suggestion or two which might help lead you to the answer.
Thank you for your help again.
What I need to do is that I need use a set of data to draw a mesh on the screen. This is the first step of drawing. I have not able to do that. The set of data include over 300 vertex data. All the data look like this:
{ -76.3074 36.9634 -3.0000
-76.3297 36.9633 -4.8000
-76.3134 36.9632 -2.1000
-76.3014 36.9632 -2.7000
-76.3503 36.9632 -13.1000
-76.3169 36.9629 -2.7000
-76.3263 36.9629 -1.2000
-76.3186 36.9629 -0.9000
-76.3314 36.9627 -6.4000
-76.3134 36.9627 -2.1000
......
}
I used the following code to do the drawing mesh:
glBegin (GL_QUADS);
for (int i = 0; i < 300; i++)
{
int j = i + 1;
int k = i + 2;
int n = i + 3;
//m_TotalPointArray is vertex_data type
//the array holds all data
float xi = m_TotalPointsArray[i].x;
float yi = m_TotalPointsArray[i].y;
float zi = m_TotalPointsArray[i].z;
float xj = m_TotalPointsArray[j].x;
float yj = m_TotalPointsArray[j].y;
float zj = m_TotalPointsArray[j].z;
float xk = m_TotalPointsArray[k].x;
float yk = m_TotalPointsArray[k].y;
float zk = m_TotalPointsArray[k].z;
float xn = m_TotalPointsArray[n].x;
float yn = m_TotalPointsArray[n].y;
float zn = m_TotalPointsArray[n].z;
glColor3f (0.0f, 1.0f, 0.f);
glVertex3f(xi, yi, zi);
glVertex3f(-xj, yj, zj);
glVertex3f(-xk, -yk, zk);
glVertex3f(xn, yn, zn);
}
glEnd();
Thank you for your help here
Originally posted by kabir:
What you should probably do first is describe the sytmptoms... so far all we know is that "it doesn't work" and you're frustrated. Not really enough info to help at all. Before you go posting loads of code just give a quick description of what you're trying to accomplish and where it seems to be failing. This will often be enough to allow someone to make a helpful suggestion or two which might help lead you to the answer.
What do you mean you have not been able to do that? Does the code compile? Do you see anything at all?Originally posted by beachboy1976:
Thank you for your help again.
What I need to do is that I need use a set of data to draw a mesh on the screen. This is the first step of drawing. I have not able to do that.
I notice that your data seems to primarily consist of very small x & y variations and a larger z variation. Before drawing each frame do you translate the coordinate system such that what you're drawing will be in view? You may also need to rotate it so that you're not looking at it edge on (as you would be doing with the data as I see it now)
The code is compiled fine. The only thing I can see on the screen is a plain with all messy points.
The really picture should like Terrain. Based on the different depth, you can see the land, the ocean, etc.
Thank you for your quick response.
Originally posted by kabir:
What do you mean you have not been able to do that? Does the code compile? Do you see anything at all?