Jump to content
  • Advertisement
Sign in to follow this  
programering

Terrain Editor

This topic is 4017 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am making a terrain editor and I have two questions regarding triangle strips and point of view. 1. The triangle strips: I wonder why it's not;
glBegin(GL_TRIANGLE_STRIP);

    // The first(0) triangle strip
    // texture coord and vertex.
    glTexCoord2f(texuCoords[0], texvCoords[0]);
    glVertex3f(gridxPoints[0], gridyPoints[0], heightPoints[0]);

    // The second(1) triangle strip
    // texture coord and vertex.
    glTexCoord2f(texuCoords[1], texvCoords[1]);
    glVertex3f(gridxPoints[1], gridyPoints[1], heightPoints[1]);

    // The third(2) triangle strip
    // texture coord and vertex.
    glTexCoord2f(texuCoords[2], texvCoords[2]);
    glVertex3f(gridxPoints[2], gridyPoints[2], heightPoints[2]);

    // The following tex coord and vertices
    glTexCoord2f(texuCoords[3], texvCoords[3]);
    glTexCoord2f(texuCoords[4], texvCoords[4]);
    glTexCoord2f(texuCoords[5], texvCoords[5]);
    glVertex3f(gridxPoints[3], gridyPoints[3], heightPoints[3]);

glEnd();


since that it was said that it saves vertex calls. 2. Point of view: How can I set the position and directions of the terrain view? With;
GLfloat ViewPos[3];
GLfloat viewDir[3];


I've googled with "setting direction" and search the forum with the same and "how to set direction". Thanks in advance.

Share this post


Link to post
Share on other sites
Advertisement
But I think that it is the same texture coords for the 2 and 1 vertices now, and I believe that it is so, I assume, if you can confirm that it's just the second question left to answer.

Share this post


Link to post
Share on other sites

I got a linking error after I added OpenGL32.lib GLu32.lib and GLaux.lib

Linking...
LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
Debug/TerrainEditor.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.

TerrainEditor.exe - 2 error(s), 0 warning(s)



What do I do?

Share this post


Link to post
Share on other sites
Triangle strips:
What exactly is your problem here?

View position:
I'm not sure if it's what you're looking for but have a look at
gluLookAt(...)

Share this post


Link to post
Share on other sites
I need your help here.
How do I solve the linking error? I don't have any main function in my code just WinMain. And how do I set position and direction?

[Edited by - programering on May 7, 2007 8:08:14 AM]

Share this post


Link to post
Share on other sites
Quote:
How do I solve the linking error? I don't have any main function in my code just WinMain.


Then you know the solution ;), use main instead of WinMain. Or create a Windows application instead of a Console application.

Share this post


Link to post
Share on other sites
I'm sorry, I do not understand your problem very well.

* Can you explain what gridXpoints[0/1/2/3/4] is, I don't understand what 0,1,2, etc is supposed to be. Also you told us what it is not but you did not tell us what it is so I am not clear on what you were asking originally. To set the position and direction what you actually want to do is move the camera which is done with gluLookAt. Get your terrain drawing first (around 0,0,0) though before you go there.

* Although I didn't really understand the code you posted the first thing I noticed is that your Y and Z are backwards. In opengl Y is the "height" and Z is what "Y" would be if it were a 2D game. Not the other way around unless you are rotating everything 90 degrees so you can pretend Z is height.

* If you got an error when you added OpenGL32.lib how were you compiling the code you had before up in your top post? No OpenGL program is going to do zilch without that library linked in so I'm not sure what it is you had before you "added" it. Or have you just now started and never have gotten any of your code to compile? If that's the case you should worry about getting simple lines and cubes etc up on the screen before you even start thinking about terrain drawing algorithms.

I do not recognize your compiler output, you must be using something like Microsoft C++ or something. I only have experience with gcc so I can not help you with your linker. But if it is complaining about not having a main maybe you should try putting a main in there. Or better yet go to NeHe and download the first or second lesson for whatever compiler it is you're using. That code should have main setup properly for your ide so you know it is not something you're doing. When you get it to compile, then just paste over everything else with your own code.

With Mingw & SDL, the linker will often complain about not finding main when you use something like "int main(void)" and leave off the "argc,argv".

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!