Hello, i have been working on my texture class. i got it to display a single texture on a mesh. Now i want to enable multitexturing for my class. The problem is that i cant use the ARB functions that i am working with. I am quite new to this so if you could help me out that would be great. Here is some of my code:
====Header==================================
#include <stdio.h>
#include <stdlib.h>
#include “il/il.h”
#include “il/ilu.h”
#include “il/ilut.h”
#include <gl\gl.h>
#include <gl\glu.h>
#include “glext.h”
class CTexture{
ILuint uiImageName;
char *imageName;
int iMaxUnits;
int iImage;
bool bLoaded;
bool bMulti;
//start: only in init of class (sets up IL and sends IL to GL)
void InitAllIL(void);
void Load(void);
void BindIL(void);
void TexObject(void);
void BindGL(void);
void BuildMipmap(void);
//end: only in init of class (sets up IL and sends IL to GL)
void CheckMulti(void);
void ActivateMulti(void);
public:
PFNGLMULTITEXCOORD2FARBPROC glMultiTexCoord2fARB;
PFNGLACTIVETEXTUREARBPROC glActiveTextureARB;
PFNGLCLIENTACTIVETEXTUREARBPROC glClientActiveTextureARB;
void InitMulti(void);
void Filter(int iType);
void BindTexture(void); //use to bind right before texturemapping
void EnableFilter(int iType); //use defined to supply options
bool IsLoaded(void); //checks to see if the texture has been loaded?
CTexture(char *filename);
CTexture(char *filename, bool bMultiT); //questionable
~CTexture(){ ilDeleteImages(1,&uiImageName); }
};
====Source==================================
CTexture::CTexture(char *filename,bool bMultiT){
imageName = filename;
InitAllIL();
TexObject();
BindIL();
Load();
BindGL();
if(bMultiT == true){
CheckMulti();
if(bMulti == true){
InitMulti();
ActivateMulti();
}
}
}
///MultiTexturing (Note: i refer to multitexturing as multi)
//CheckMulti - sees if you have the option of using multitexturing
void CTexture::CheckMulti(void){
char ext = (char)glGetString(GL_EXTENSIONS);
char *arb = “GL_ARB_multitexture”;
char *endString;
int space;
endString = ext + strlen(ext);
while(ext < endString){
space = strcspn(ext," ");
if((strlen(arb) == space) && (strncmp(arb,ext,space) == 0)){
bMulti = true;
//return true;
}
ext += (space + 1);
}
bMulti = false;
//return false;
}
//InitMult - sets up sys for multitexture
void CTexture::InitMulti(void){
glGetIntegerv(GL_MAX_TEXTURE_UNITS_ARB, &iMaxUnits);
glMultiTexCoord2fARB = (PFNGLMULTITEXCOORD2FARBPROC) wglGetProcAddress (“glMultiTexCoord2fARB”);
glClientActiveTextureARB = (PFNGLCLIENTACTIVETEXTUREARBPROC)wglGetProcAddress (“glClientActiveTextureARB”);
glActiveTextureARB = (PFNGLACTIVETEXTUREARBPROC) wglGetProcAddress (“glActiveTextureARB”);
}
//ActiveMulti - activates and binds to texture_0 or texture_1
void CTexture::ActivateMulti(void){
if((iArbNum % 2) == 0)
glActiveTextureARB(GL_TEXTURE0_ARB);
else
glActiveTextureARB(GL_TEXTURE1_ARB);
glEnable(GL_TEXTURE_2D);
BindGL();
iArbNum++;
}
====End=====================================
I know its alot of code for a post but if you could give it a look over and see whats wrong. when i try to texturemap the mesh w/ glMultiTexCoord2*() it says its a undeclared identifier. heres the error message:
error C2065: ‘glMultiTexCoord2fARB’ : undeclared identifier
P.S.
has anyone looked at the opengl 2.0 shader language compiler, and if so how is it?
- Lurking