Jump to content
  • Advertisement
Sign in to follow this  
Dragon_Strike

rendering the clipmaps

This topic is 4295 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

im trying to make a function that will render the clipmaps (rings) described in geoemtry clipmaps... i want to create a function which renders these rings based on their level and a first level size... but for some reason i cant get it to fit togheter...
int blocksize = (255+1.0f)/4; // 255 = default clipmap size

void CTERRAIN::RenderLevel(float x, float z, int level)
{
        int scale = pow(2, level);
	
	RenderBlock((x+blocksize+2*scale)	, (z+blocksize+2*scale), scale);
	RenderBlock((x+blocksize+2*scale)	, (z+2*scale),			scale);
	RenderBlock((x+2*scale)				, (z+blocksize+2*scale), scale);

	RenderBlock(-(x+2*blocksize+scale)	, (z+blocksize+scale), scale);
	RenderBlock(-(x+2*blocksize+scale)	, (z+scale),			scale);
	RenderBlock(-(x+blocksize+scale)		, (z+blocksize+2*scale), scale);

	RenderBlock(-(x+2*blocksize+scale)	, -(z+2*blocksize+scale), scale);
	RenderBlock(-(x+2*blocksize+scale)	, -(z+blocksize+scale),			scale);
	RenderBlock(-(x+blocksize+scale)	, -(z+2*blocksize+scale), scale);	

	RenderBlock((x+blocksize+scale)		, -(z+2*blocksize+scale), scale);
	RenderBlock((x+blocksize+2*scale)	, -(z+blocksize+scale),			scale);
	RenderBlock((x+scale)				, -(z+2*blocksize+scale), scale);	
}

void CTERRAIN::RenderBlock(float x, float z, float scale)
{
		ShaderProgram->sendUniform("ScaleFactor", scale, scale, x, z);
		glDrawElements(GL_TRIANGLE_STRIP, NumberOfElements, GL_UNSIGNED_INT, 0);
}


the rednerblock function renders a block where the x,z coordinates is the lowerleft part of each block and scaled after the parameter scale... ive not included the fixup blocks because they are not important here... they are jsut empty space..

Share this post


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

  • Advertisement
×

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!