glTexParameteri - correct way to use it ??

Hi all,

I’m a bit puzzled. Where should I put the glTexParameters ?

Like this
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, textureID);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
glTexSubImage2D

OR

glEnable(GL_TEXTURE_2D);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
glBindTexture(GL_TEXTURE_2D, textureID);
glTexSubImage2D(

Are glTexParameter global settings or do they appy to the current (binded) texture ?

U’dragon

And what about the glTexEnv, where should I ideally put that one ?

glTexParameter sets parameters for the currently bound texture on the active texture unit. So the first one is correct.

The weird thing is that I see -a lot- code on the web using the 2nd one… but indeed the first one seems to be the most logic one

Oh, another question. glTexEnvi sets parameter for the texture unit and does not care what texture is bound. glTexEnvi should go after you have activated the correct texture unit.

// Correct
glActiveTexture(GL_TEXTUREn);
glTexEnv(…)

// Wrong
glTexEnv(…)
glActiveTexture(GL_TEXTUREn);

Another issue :

Can I use textures binds in a display list ?

I want to be able to set a different texture on eacht face (if needed), but I want to encapsulate everything in a display list for speed reasons.

I did a first test, but sometimes the texture seems to disappear… :-/

Hey Bob,

Thanx for all the info.

But I can’t seem to find any info 'bout glActiveTexture in my refrence, nor on the online OpenGL reference ?

Is this an OpenGL 1.3 Thing ?

I’ve been using ttp://ask.ii.uib.no/ebt-bin/nph-dweb/dynaweb/SGI_Developer/OpenGL_RM/
so far.

Or ist ther a newer version online ?

U

glActiveTexture is a function from OpenGL 1.2. You can download the API specification , which describes everything in OpenGL, if you want to know how something works.

Seems I’ve been using 1.0 refs :-/

I’ll read through the specifications.

Thanks a lot !