PDA

View Full Version : glTexParameteri - correct way to use it ??



01-21-2003, 02:47 AM
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

01-21-2003, 02:50 AM
And what about the glTexEnv, where should I ideally put that one ?

Bob
01-21-2003, 02:51 AM
glTexParameter sets parameters for the currently bound texture on the active texture unit. So the first one is correct.

01-21-2003, 02:52 AM
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

Bob
01-21-2003, 02:52 AM
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);

01-21-2003, 02:56 AM
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... :-/

01-21-2003, 03:05 AM
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

Bob
01-21-2003, 03:12 AM
glActiveTexture is a function from OpenGL 1.2. You can download the API specification (http://www.opengl.org/developers/documentation/specs.html) , which describes everything in OpenGL, if you want to know how something works.

01-21-2003, 03:14 AM
Seems I've been using 1.0 refs :-/

I'll read through the specifications.

Thanks a lot !