why my little program of mipmapping don't work (a strange error)

i have this at the compilation :
--------------------Configuration: premiere_texture - Win32 Debug--------------------
Compiling…
premiere_texture.cpp
D:\programmation[Mes programmes Open GL]\premiere_texture.cpp(19) : error C2065: ‘GL_TEXTURE_BASE_LEVEL’ : undeclared identifier
D:\programmation[Mes programmes Open GL]\premiere_texture.cpp(20) : error C2065: ‘GL_TEXTURE_MAX_LEVEL’ : undeclared identifier
Error executing cl.exe.

premiere_texture.exe - 2 error(s), 0 warning(s)
what do i have forgotten ?
my headers are :
#include <gl\GLAUX.h>
#include <gl\glut.h>
#include <gl\gl.h>
can you tell me too if my program is correct ? because it don’t displays the textures of mipmap.:-/

void init ()
{
AUX_RGBImageRec *texture1;
texture1 = auxDIBImageLoad(“herbe256.bmp”);
AUX_RGBImageRec *texture2;
texture2 = auxDIBImageLoad(“bois.bmp”);
glGenTextures (1, texname) ;
glBindTexture (GL_TEXTURE_2D, texname[0]) ;
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, 0);
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 1);
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER,GL_LINEAR);
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,GL_LINEAR_MIPMAP_LINEAR);

glTexImage2D(GL_TEXTURE_2D, 0, 3, (texture1)->sizeX, (texture1)->sizeY,
0, GL_RGB, GL_UNSIGNED_BYTE, (texture1)->data);
glTexImage2D(GL_TEXTURE_2D, 1, 3, (texture2)->sizeX, (texture2)->sizeY,
0, GL_RGB, GL_UNSIGNED_BYTE, (texture2)->data);
glEnable(GL_TEXTURE_2D) ;
}

[This message has been edited by airseb (edited 05-08-2003).]

[This message has been edited by airseb (edited 05-08-2003).]

I looked into MSDN for glTexParameteri and it doesn’t use GL_TEXTURE_BASE_LEVEL and GL_TEXTURE_MAX_LEVEL.Are you sure that those are what you want to use in glTexParameteri?

You need the glext.h header to use GL_TEXTURE_MIN/MAX_LEVEL since it is a part of the OpenGL 1.2 spec. Not 1.1 which you’re using. You can get it here: http://oss.sgi.com/projects/ogl-sample/ABI/glext.h

yes i have seen it in a version of the redbook in french…
it’s strange !
otherwise can you tell me what’s wrong with the function above ? (it doen’t display the textures)

[This message has been edited by airseb (edited 05-08-2003).]

Originally posted by Brian Jones:
You need the glext.h header to use GL_TEXTURE_MIN/MAX_LEVEL since it is a part of the OpenGL 1.2 spec. Not 1.1 which you’re using. You can get it here: http://oss.sgi.com/projects/ogl-sample/ABI/glext.h

thanks, but how can i be sure of working with open gl 1.2 ?

[This message has been edited by airseb (edited 05-08-2003).]

[This message has been edited by airseb (edited 05-08-2003).]

Also, you might want wglext.h for the Microsoft Windows windowing extension system.

Microsoft hasn’t updated their library after 1.1. The only way you can use new features on windows is if you have glext.h, or/and wglext.h

Originally posted by Brian Jones:
[b]Also, you might want wglext.h for the Microsoft Windows windowing extension system.

Microsoft hasn’t updated their library after 1.1. The only way you can use new features on windows is if you have glext.h, or/and wglext.h[/b]

ok, thank you
now somebody can tell me why the function below doen’t displays the textures ? (it’s to make mipmapping)

Call glGetString(GL_VERSION). If it reports a version higher than 1.1, like 1.4(if you have downloaded the lastest drivers for your video card) then know you can use 1.2 OpenGL features

and my program above, pleeeeeeeasee !

Everything looks ok. Is the dimensions of the second image half the dimensions of the first? Like if the first is 64 x 32, the second would be 32 x 16

Originally posted by Brian Jones:
Everything looks ok. Is the dimensions of the second image half the dimensions of the first? Like if the first is 64 x 32, the second would be 32 x 16

yes the first is 256x256 and the other is 128x128.
i don’t understand why it doen’t work (a problem of opengl version ?)
but it work with gluBuild2DMipmaps and not without :-/

It’s a very odd error indeed. glGetError() doesn’t return anything? Try changing the base level and all subsequent levels to something else. Maybe you need to add more mipmap? Sorry I’m not of much help.

Originally posted by Brian Jones:
It’s a very odd error indeed. glGetError() doesn’t return anything? Try changing the base level and all subsequent levels to something else. Maybe you need to add more mipmap? Sorry I’m not of much help.

it doen’t work :frowning:

I just read the whole section of BASE/MAX_LEVEL mipmapping in OpenGL Programming Guide. I honestly don’t know what it can be. Your code looks right. Did you call glGetString(GL_VERSION) and make sure your card supports the 1.2 spec (at least)?

Originally posted by Brian Jones:
I just read the whole section of BASE/MAX_LEVEL mipmapping in OpenGL Programming Guide. I honestly don’t know what it can be. Your code looks right. Did you call glGetString(GL_VERSION) and make sure your card supports the 1.2 spec (at least)?

my video card is a geforce 1.
can you tell me how use glGetString(GL_VERSION), i have tried but i don’t manage.

Uh, geForce 1. WOW!!! heh, anyways…
The code:

const char *glver = glGetString(GL_VERSION);
cout << glver << endl;
or
MessageBox(NULL, glver, “Version”, MB_OK);

i have that :

Compiling…
premiere_texture.cpp
D:\programmation[Mes programmes Open GL]\premiere_texture.cpp(97) : error C2440: ‘initializing’ : cannot convert from ‘const unsigned char *’ to ‘const char *’
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
Error executing cl.exe.

premiere_texture.exe - 1 error(s), 0 warning(s)

:frowning:
i don’t understand

Sorry, try this
const unsigned char *glver = glGetStrign(GL_VERSION);

Or you could have just typecasted the returning string to (const char*)

i have done :
const unsigned char *glver = glGetString(GL_VERSION);
cout << glver << endl;

and :
const unsigned char *glver = glGetString(GL_VERSION);
cout << *glver << endl;

and windows gives me an error message, sorry but i’m not very advanced in c++

[This message has been edited by airseb (edited 05-08-2003).]

it works !
i have put the glext.h and changed the values of the glFrustum and it works !
but i haven’t managed to use what we tried (GL_VERSION)