Cant get Multitexturing to work

Started by
2 comments, last by Kris2456 19 years, 10 months ago
Ive been trying to get multi texturing to work,but with no avail. Basicly im trying to make the textures blend only below the 50 mark on my height map. But when i run it, it jus says that it crashed, and to send msg to M$. Im using Glext.h for further info. Here is my Main.cpp:

//MULTITEXTURING

PFNGLMULTITEXCOORD2FARBPROC	glMultiTexCoord2fARB= NULL;
PFNGLACTIVETEXTUREARBPROC	glActiveTextureARB= NULL;
//glActiveTextureARB		= (PFNGLACTIVETEXTUREARBPROC)		wglGetProcAddress("glActiveTextureARB");

//glMultiTexCoord2fARB	= (PFNGLMULTITEXCOORD2FARBPROC)		wglGetProcAddress("glMultiTexCoord2fARB");

//I had to comment out this ^^ bit cos it kept giving me errors.

My Terrain.cpp bit:

//HEIGHTMAP RENDERING FUNCTION

void RenderHeightMap(BYTE pHeightMap[])	
{
    int X=0;
    int Y=0;
    int x, y, z;
    //If there is no data return

    if(!pHeightMap) return;
    
    
    
    //For loops

    for ( X = 0; X < (MAP_SIZE-STEP_SIZE); X += STEP_SIZE )
		for ( Y = 0; Y < (MAP_SIZE-STEP_SIZE); Y += STEP_SIZE )
		{
			// Get The (X, Y, Z) Value For The Bottom Left Vertex

			x = X;							
			y = Height(pHeightMap, X, Y );	
			z = Y;	

			if(y<50)
			{
			glActiveTextureARB(GL_TEXTURE1_ARB);
            glBindTexture(GL_TEXTURE_2D, TexID[2]);
            glEnable(GL_TEXTURE_2D);
            
            }else{
            glBindTexture(GL_TEXTURE_2D, TexID[6]);
            }
            
			glBegin(GL_QUADS);
			glNormal3f(0,1,0);
			glMultiTexCoord2fARB(GL_TEXTURE1_ARB, 0, 0);glTexCoord2d(0,0);glVertex3i(x, y, z);			// Send This Vertex To OpenGL To Be Rendered


			x = X;										
			y = Height(pHeightMap, X, Y + STEP_SIZE );  
			z = Y + STEP_SIZE ;							
			

			glMultiTexCoord2fARB(GL_TEXTURE1_ARB, 0, 1);glTexCoord2d(0,1);glVertex3i(x, y, z);			// Send This Vertex To OpenGL To Be Rendered


			// Get The (X, Y, Z) Value For The Top Right Vertex

			x = X + STEP_SIZE; 
			y = Height(pHeightMap, X + STEP_SIZE, Y + STEP_SIZE ); 
			z = Y + STEP_SIZE ;

			
			glMultiTexCoord2fARB(GL_TEXTURE1_ARB, 1, 1);glTexCoord2d(1,1);glVertex3i(x, y, z);			// Send This Vertex To OpenGL To Be Rendered


			// Get The (X, Y, Z) Value For The Bottom Right Vertex

			x = X + STEP_SIZE; 
			y = Height(pHeightMap, X + STEP_SIZE, Y ); 
			z = Y;


			glMultiTexCoord2fARB(GL_TEXTURE1_ARB, 1, 0);glTexCoord2d(1,0);glVertex3i(x, y, z);
			glEnd();
		}
		//End

		glActiveTextureARB(GL_TEXTURE1_ARB);
        glDisable(GL_TEXTURE_2D);
		//Set color to white, so other stuff dosnt go bright blue, etc.

		glColor4f(1,1,1,1);
}
An my header:

//MULTITEXTURING

#define GL_TEXTURE0_ARB                     0x84C0
#define GL_TEXTURE1_ARB                     0x84C1

#define GL_COMBINE_ARB						0x8570
#define GL_RGB_SCALE_ARB					0x8573

// Here are the multitexture function prototypes

typedef void (APIENTRY * PFNGLMULTITEXCOORD2FARBPROC) (GLenum target, GLfloat s, GLfloat t);
typedef void (APIENTRY * PFNGLACTIVETEXTUREARBPROC) (GLenum target);

// Here we extern our function pointers for multitexturing capabilities

extern PFNGLMULTITEXCOORD2FARBPROC			glMultiTexCoord2fARB;
extern PFNGLACTIVETEXTUREARBPROC			glActiveTextureARB;
If u cant help me with this,could you at least point me to a non budget tutorial, ive tryed Gametutorials.com''s one.
------------ "Here lies a toppled God,His fall was not a small one,We but built his pedastle,A narrow, and a tall one" Frank Herbert (Dune:Messiah)
Advertisement
quote://I had to comment out this ^^ bit cos it kept giving me errors.

What errors did you get? I''d say those lines are pretty important...
ahem, i thought it was important, here are the errors:

68 ISO C++ forbids declaration of `glActiveTextureARB'' with no type

68 conflicting types for `int glActiveTextureARB''

67 previous declaration as `void (*glActiveTextureARB)(unsigned int)''

68 invalid conversion from `void (*)(unsigned int)'' to `int''

69 ISO C++ forbids declaration of `glMultiTexCoord2fARB'' with no type

69 conflicting types for `int glMultiTexCoord2fARB''

66 previous declaration as `void (*glMultiTexCoord2fARB)(unsigned

69 invalid conversion from `void (*)(unsigned int, float, float)'' to
------------ "Here lies a toppled God,His fall was not a small one,We but built his pedastle,A narrow, and a tall one" Frank Herbert (Dune:Messiah)
Oh.. You have the commented out lines outside any function, right? Move them inside main (or some initialization function.)

This topic is closed to new replies.

Advertisement