[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problem with RGBA Texture in GLX





Nathi-huesken@gmx.de wrote:

> I am using GLX to open an OpenGL window.
> Everything works finde, as long, as I Create Textures
> using:
> 
 > glTexImage2D(GL_TEXTURE_2D,0,GL_RGB,Width,Height,0,GL_RGBA,GL_UNSIGNED_BYTE,Data);
> 
> But that way I do not have an Alpha-Channel in my Textures (which I need!).
> When I try using GL_RGBA or GL_RGB5_A1 instead of the GL_RGB I get the
> following error:
> 
> Program received signal SIGSEGV, Segmentation fault.
> [Switching to Thread 1024 (LWP 485)]
> 0x404891d3 in __nvsym04304 () from /usr/lib/libGLcore.so.1
> 
> (That is the output ddd/gdb gave me, if I am just running the Prgramm I get
> an simple Segmentation Fault).

It's impossible to tell what you are doing wrong without some more information.

Your glTexImage2D command seems perfect to me.

Most likely, your 'Data' array isn't sized correctly.  In this case, it should
be Width*Height*4 bytes long.

Try this:

    {
      unsigned char FakeData [ Width * Height * 4 ] ;
      glTexImage2D(GL_TEXTURE_2D,0,GL_RGBA,Width,Height,0,GL_RGBA,GL_UNSIGNED_BYTE,FakeData);
    }

...in place of the glTexImage2D command you have now.  Does it still crash?

Can you show us more of your program?

----------------------------- Steve Baker -------------------------------
Mail : <sjbaker1@airmail.net>   WorkMail: <sjbaker@link.com>
URLs : http://www.sjbaker.org
        http://plib.sf.net http://tuxaqfh.sf.net http://tuxkart.sf.net
        http://prettypoly.sf.net http://freeglut.sf.net
        http://toobular.sf.net   http://lodestone.sf.net