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 » Tue Jan 11, 2011 17:15

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: 5182
Joined: Fri May 22, 2009 11:38

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

Post by Joris » Wed Jan 12, 2011 12:25

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 » Wed Jan 12, 2011 12:35

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: 5182
Joined: Fri May 22, 2009 11:38

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

Post by Joris » Wed Jan 12, 2011 12:47

....


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 » Wed Jan 12, 2011 12:49

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 » Wed Jan 12, 2011 13:47

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 » Wed Jan 12, 2011 15:21

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