hi everyone ive got quite an error here it seems like c++ is not finding glActiveTextureARB(GL_TEXTURE0_ARB);
im using codeblocks and i’ve got glext.h so whenever i right click glActiveTextureARB and find declaration it actually finds it… ive got a 64bits system and ive tried putting glext.h in the GL folder and also in my project and im getting the same error any ideas would help tyvm
heres my code in case u need it.. it is in spanish btw but it doesnt matter cuz the error i think its not in the code
#include "objetos.h"
#include "glext.h"
#include <cassert>
Objetos::Objetos()
{
m_OBJS = NULL;
}
Objetos::Objetos(OBJETO d,int txt)
{
m_OBJS = NULL;
box = 0;
triangle = 0;
circle = 0;
CTargaImage image;
image.Load("TGAs/caja1.tga");
glGenTextures(1, &m_texturaCaja[0]);
glBindTexture(GL_TEXTURE_2D, m_texturaCaja[0]);
gluBuild2DMipmaps(GL_TEXTURE_2D, GL_RGB,
image.GetWidth(), image.GetHeight(),
GL_RGB, GL_UNSIGNED_BYTE, image.GetImage());
image.Release();
image.Load("TGAs/caja2.tga");
glGenTextures(1, &m_texturaCaja[1]);
glBindTexture(GL_TEXTURE_2D, m_texturaCaja[1]);
gluBuild2DMipmaps(GL_TEXTURE_2D, GL_RGB,
image.GetWidth(), image.GetHeight(),
GL_RGB, GL_UNSIGNED_BYTE, image.GetImage());
image.Release();
switch(d)
{
case TRIANGULO:
//borrarlo antes de dibujarlo siempre;
glActiveTextureARB(GL_TEXTURE0_ARB);
glBindTexture(GL_TEXTURE_2D, m_texturaTriangulo[txt]);
glEnable(GL_TEXTURE_2D);
glTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_EXT);
glTexEnvf (GL_TEXTURE_ENV, GL_COMBINE_RGB_EXT, GL_REPLACE);
m_OBJS = glmReadOBJ("materiales/triangulo.obj");
m_Posicion.x = 0.0f;
glDisable(GL_TEXTURE_2D);
break;
case CIRCULO:
glActiveTextureARB(GL_TEXTURE1_ARB);
glBindTexture(GL_TEXTURE_2D, m_texturaEsfera[2]);
glEnable(GL_TEXTURE_2D);
glTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_EXT);
glTexEnvf (GL_TEXTURE_ENV, GL_COMBINE_RGB_EXT, GL_REPLACE);
m_OBJS = glmReadOBJ("materiales/circulo.obj");
m_Posicion.x = -0.43f;
glDisable(GL_TEXTURE_2D);
break;
case CAJA:
glActiveTextureARB(GL_TEXTURE2_ARB);
glBindTexture(GL_TEXTURE_2D, m_texturaCaja[1]);
glEnable(GL_TEXTURE_2D);
glTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_EXT);
glTexEnvf (GL_TEXTURE_ENV, GL_COMBINE_RGB_EXT, GL_REPLACE);
m_OBJS = glmReadOBJ("materiales/caja.obj");
m_Posicion.x = 0.43f;
glDisable(GL_TEXTURE_2D);
break;
}
}
glActiveTextureARBis an extension function. As such under the Windows plattform it does not suffice to include glext.h to make it usable. You also have to define a function pointer and load it withThat macro juggling is neccesary to keep the library namespace clean.
Since it would be so tedious doing all this extension loading from scratch there are extension wrapper libraries like GLEW ( http://glew.sourceforge.net ) or GLEE ( http://www.opengl.org/sdk/libs/GLee/ ) reducing the whole process into including their headers instead of the standard OpenGL includes, adding it to the linked libraries list and doing a
glewInit()for GLEW and for GLEE optionally aGLeeInit()after context creation and be done with.