On Thu, Jul 15, 2010 at 11:43 AM, Ulrich Hertlein <[email protected]>wrote:

> On 15/07/10 1:36 , Jason Daly wrote:
> >>
> >> I'm trying to create a 1-bit texture, like this:
> >>
> >>     int internalFormat = GL_RED;
> >>     int pixelFormat = GL_RED;
> >>     int dataType = GL_BITMAP;
> >>
> >> I get the following error when running this code:
> >>     Warning: detected OpenGL error 'invalid enumerant' after
> RenderBin::draw(,)
> >>...
> >
> > GL_BITMAP is not valid for a texture data type.  The smallest data type
> allowed, as you've
> > already discovered, is GL_UNSIGNED_BYTE.
>

> So that is a limitation of osg::Image?  Because glTexImage2D() supports it.
> (Or at least it did once, I have never used it and was quite surprised to
> find it in the
> man page.)

GL_BITMAP is a valid texture type and supported by osg::Image, but only if
the pixel format is GL_COLOR_INDEX. That is not likely to be optimal on
today's hardware.

If the texture memory usage is really a problem, you could do a trick in the
fragment shader where you use an isampler to do the texture lookup and use
the s coordinate to bit shift and mask the value in the 8 bit texel. You
would need to scale your texture coordinates accordingly.

Tim
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to