FFGL - custom shader need to gl_enable(GL_TEXTURE_2D)

FFGL, OSC, GLSL. If you like abbreviations, this is the forum for you
Post Reply
Rene
Is seriously in love with Resolume. Met the parents and everything
Posts: 388
Joined: Wed Jun 20, 2007 11:53
Location: Vienna, Austria

FFGL - custom shader need to gl_enable(GL_TEXTURE_2D)

Post by Rene »

Hi,

I have a plugin with custom shaders. I thought I don't have to gl_enable the texture when I use custom shaders. As I had problems with a plugin (black output) I tried to add gl_enable(GL_TEXTURE_2D) and now it works :? Is there an OpenGL expert who can explain that, please?

Joris
Doesn't Know Jack about VJ'ing or Software Development and Mostly Just Gets Coffee for Everyone
Posts: 5185
Joined: Fri May 22, 2009 11:38

Re: FFGL - custom shader need to gl_enable(GL_TEXTURE_2D)

Post by Joris »

Hmmm. That's the normal way to enable texturing, so it makes sense there'd be black output without it. Is there any particular reason you thought it wasn't necessary?

Rene
Is seriously in love with Resolume. Met the parents and everything
Posts: 388
Joined: Wed Jun 20, 2007 11:53
Location: Vienna, Austria

Re: FFGL - custom shader need to gl_enable(GL_TEXTURE_2D)

Post by Rene »

Hi Joris,
thanks for your answer!!

Yepp, there is. In the example code of the FFGL SDK (FFGLTile.cpp - line 121) says

Code: Select all

//activate rendering with the input texture
 //note that when using shaders, no glEnable(Texture.Target) is required
 glBindTexture(GL_TEXTURE_2D, Texture.Handle);
and also this example does not use the glEnable command :?:

Joris
Doesn't Know Jack about VJ'ing or Software Development and Mostly Just Gets Coffee for Everyone
Posts: 5185
Joined: Fri May 22, 2009 11:38

Re: FFGL - custom shader need to gl_enable(GL_TEXTURE_2D)

Post by Joris »

....


Ehm...


Yeah...


That's just.... weird....

drand48
Team Resolume
Posts: 14
Joined: Wed Jul 29, 2009 00:33

Re: FFGL - custom shader need to gl_enable(GL_TEXTURE_2D)

Post by drand48 »

I usually call glEnable( GL_TEXTURE_2D ) also when using shaders...
but it seems like it is really not necessary, found this link maybe it can be useful
http://www.opengl.org/wiki/GLSL_:_common_mistakes
perhaps you are not calling glEnable before creating the texture?

Rene
Is seriously in love with Resolume. Met the parents and everything
Posts: 388
Joined: Wed Jun 20, 2007 11:53
Location: Vienna, Austria

Re: FFGL - custom shader need to gl_enable(GL_TEXTURE_2D)

Post by Rene »

drand48 wrote:I usually call glEnable( GL_TEXTURE_2D ) also when using shaders...
From now on, me too ;)
drand48 wrote:perhaps you are not calling glEnable before creating the texture?
What do you mean here? - Before binding the input texture coming from the host application, or before calling glCopyTexSubImage2D?

drand48
Team Resolume
Posts: 14
Joined: Wed Jul 29, 2009 00:33

Re: FFGL - custom shader need to gl_enable(GL_TEXTURE_2D)

Post by drand48 »

just once before you do any calls related to a 2d texture.
so in the case of glCopyTexSubImage2D you would do something like

Code: Select all

glEnable(GL_TEXTURE2D);
glBindTexture(GL_TEXTURE_2D, Texture.Handle);
glCopyTexSubImage( ... )

Post Reply