View Full Version : binding texture in NV_fragment_program

03-10-2004, 04:25 PM

I am writing renderer that use NV_fragment_program. but INVALID_OPERATION is occured when binding texture to unit GL_TEXTURE4_ARB. GL_MAX_TEXTURE_COORDS_NV is 8, GL_MAX_TEXTURE_IMAGE_UNITS_NV is 16,
how can't it bind textures anymore?
I have a GeforceFX 5900.
any reply will help me.


03-11-2004, 03:22 PM
You should have no problem binding textures to units 0-15 with the geforcefx. Maybe the error you are receiving is not from the bind call? You do have a valid context, don't you?

03-11-2004, 11:13 PM
all I did are like this:

glGenProgramsNV( 1, &handle );
glBindProgramNV( GL_FRAGMENT_PROGRAM_NV, handle );
glLoadProgramNV( GL_FRAGMENT_PROGRAM_NV, handle, strlen(fptest), fptest );

int error;


glActiveTextureARB( GL_TEXTURE0_ARB );
glEnable( GL_TEXTURE_2D );
error = glGetError();

glActiveTextureARB( GL_TEXTURE1_ARB );
glEnable( GL_TEXTURE_2D );
error = glGetError();

glActiveTextureARB( GL_TEXTURE2_ARB );
glEnable( GL_TEXTURE_2D );
error = glGetError();

glActiveTextureARB( GL_TEXTURE3_ARB );
glEnable( GL_TEXTURE_2D );
error = glGetError();

glActiveTextureARB( GL_TEXTURE4_ARB );
glEnable( GL_TEXTURE_2D );
error = glGetError(); <= 1282: INVALID_OPERATION occured


what's the problem in above?

[This message has been edited by pangde (edited 03-12-2004).]

03-12-2004, 02:12 PM
First off, the good thing about using fragment programs is that ALL texture units are enabled by default when(I think) you have a valid fragment program bound and GL_FRAGMENT_PROGRAM_NV is enabled.

Second, you are trying to enable a texture unit that is not available if you want use the fixed-funtion pipeline(GeforceFX has a 4 unit limit for fixed function functionality).

So basically ignore the error. Does the fragment program run as it should when sampling textures bound to unit 4-15?

03-13-2004, 12:05 AM
as your advice, I ignored the error. I swept all glGetError during rendering frame.(before I checked error after calling swapbuffer in every frame.)

then I could use units until unit0-7.
everything seems ok now.
thank you for your advice very much.

but why result error at unit 4 to confuse developer? *.*

[This message has been edited by pangde (edited 03-13-2004).]

03-13-2004, 12:22 AM
As roffe said, fragment programs don't require you to enable texture targets. That's only required for "legacy" stuff, such as ARB_texture_env_combine. They apparently don't want you to use more than four texture units for this. GL_MAX_TEXTURE_UNITS_ARB is four. Go figure http://www.opengl.org/discussion_boards/ubb/wink.gif

I'm pretty confident that if you just remove the glEnable(GL_TEXTURE_2D) calls, everything will be fine (and there will be no GL errors).