Terrain, OpenGL and others

Started by
2 comments, last by MARS_999 17 years, 11 months ago
Hello, i have several questions to ask and i decided to ask them all in one go instead of opening several new threads...so we go: 1) I have created a terrain using ROAM but i think that my variance could be calculated better or more efficiently. Currently, i am taking the distance from the eye to each triangle and dividng by the triangle's length of the hypotenuse. This approach gives me good rersults but in a radius. Is there better way? Maybe if instead of a circle i split/merge by a square (i hope i was understood :))? 2) A problem i am dealing with(whether i am using lightmapping or smooth shading) is that when i move forwards, the vertices behind me get dark....the opposite for backwards...any ideas? 3) Nvidia cards have support for controlling vsync, while ATI i think they don't and its turned off. Any way of controlling it? Any other issues i should be aware of to avoid problems running apps in Nvidia or ATI cards? 4) Any good to-the-point books/ebooks/tutorials for a) opengl shaders, b) directx shaders and c)learning directx for opengl programmers? thank you
Keyboard not found. Press F1 to Continue.
Advertisement
for question 3), I guess you are on Windows and programming in C++, use the following function:

#include <gl/GL.h>#define WGL_WGLEXT_PROTOTYPES#include <GL/WGLext.h>#include <iostream>#include <Mmsystem.h>bool SetVerticalSyncOn(bool aOn){	// wglMakeCurrent must be called before !	PFNWGLSWAPINTERVALEXTPROC wglSwapIntervalEXT = (PFNWGLSWAPINTERVALEXTPROC)wglGetProcAddress("wglSwapIntervalEXT");		if (!wglSwapIntervalEXT) 	{		cerr << "ERROR: wglSwapIntervalEXT not defined call wglMakeCurrent prior to SetVerticalSyncOn()"<<endl ;		return false;	}	if ( !wglSwapIntervalEXT(aOn ? 1 : 0) )	{		cerr << "ERROR: wglSwapIntervalEXT fails"<<endl ;		return false;	}	return true ;}
jma
nice that worked! any chance that someone can answer any of the other questions?
Keyboard not found. Press F1 to Continue.
Quote:Original post by immuner
2) A problem i am dealing with(whether i am using lightmapping or smooth shading) is that when i move forwards, the vertices behind me get dark....the opposite for backwards...any ideas?

4) Any good to-the-point books/ebooks/tutorials for a) opengl shaders, b) directx shaders and c)learning directx for opengl programmers?

thank you


2. Sounds like your normals are backwards or not calculated correclty...

3. a. I recommend the "Orange Book" OpenGL Shading Language by Randi Rost 2nd edition
b. There is a new book coming out called "Introduction to 3D Game Programming with Direct X 9.0c : A Shader Approach" by Frank Luna
c. Can't think of any but pickup "Beginning D3D Game Programming" 2nd Edition by Wolf Engel

HTH

This topic is closed to new replies.

Advertisement