All pastes #261514 Raw Edit

Stuff

public text v1 · immutable
#261514 ·published 2006-11-29 16:02 UTC
rendered paste body
//I do this when I built the map 

glGenTextures( 1, &worleyMap_tex_id );
    glBindTexture( GL_TEXTURE_2D, worleyMap_tex_id );
    glPixelStorei( GL_UNPACK_ALIGNMENT, 1 );
    glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR );
    glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
    gluBuild2DMipmaps( GL_TEXTURE_2D, GL_LUMINANCE, textureSize, textureSize, GL_LUMINANCE, GL_FLOAT, worleymap );      

and this when I draw it

glActiveTextureARB(GL_TEXTURE2_ARB);
    	glEnable(GL_TEXTURE_2D);
    	glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_ARB);
    	glTexEnvi(GL_TEXTURE_ENV, GL_RGB_SCALE_ARB, 2);
    	glBindTexture(GL_TEXTURE_2D, terrain.worleyMap_tex_id);
    	glMatrixMode(GL_TEXTURE);
    	
    	// Reset the current matrix and apply our chosen scale value
    	glLoadIdentity();
    	glScalef(DetailScale, DetailScale, 1);
    	glMatrixMode(GL_MODELVIEW);