From: Angus Dorbie (dorbie++at++sgi.com)
Date: 01/31/2000 14:13:44
You want 0 to be clear, so this means you want an alpha texture, if I
interpret you correctly.
So your internal format should be set to GL_ALPHA, with an environment
of gl_modulate or gl_replace.
You can then enable blending or an alpha test depending on the exact
result you want.
man glTexEnv
This will describe the effects various formats have on the components
with the available environments. It has tables laying it all out. It'll
help you understand what's going on in future.
Cheers,Angus.
ramey wrote:
>
> Does anyone know how to get Intensity textures to work in performer?
>
> I am going out of my mind as performer (as best I can tell) is useing a
> GL_LUMINANCE texture here and this is NOT what I want. The image is
> showing up right(it is simmply 255 or 0 based on whether something
> should be drawn or not, but I want the 0s to be clear).
>
> tex->setImage((uint*)m_image,1,128,128,0);
> tex->setFormat(PFTEX_INTERNAL_FORMAT,PFTEX_I_8);
> tex->setFormat(PFTEX_EXTERNAL_FORMAT,PFTEX_PACK_8);
>
> tev->setMode(PFTE_MODULATE);
>
> gState->setMode(PFSTATE_TRANSPARENCY,PF_ON);
> gState->setMode(PFSTATE_ENTEXTURE,PF_ON);
> gState->setMode(PFSTATE_ALPHAFUNC,PF_ON);
> gState->setMode(PFSTATE_ALPHAFUNC,PFAF_GREATER);
> gState->setVal(PFSTATE_ALPHAREF,0.5f);
> gState->setAttr(PFSTATE_TEXTURE,tex);
> gState->setAttr(PFSTATE_TEXENV,tev);
>
> where image came from:
>
> register int Idx;
> register unsigned char bitmask;
> for(int row=0;row<8;++row){
> for(int letterRow=0;letterRow<13;++letterRow){
> for(int col =0;col<12;++col){
> bitmask = 128;
> for(int bit=1;bit<9;++bit){ // bit will cause each letter to
> be padded by one blank on each side
> Idx = bit+col*10+letterRow*128+row*13*128;
> if(rasters[row*12+col][letterRow] & bitmask) m_image[Idx]
> = 255;
> bitmask /=2;
> }
> }
> }
> }
>
> GLubyte rasters[][13] = {
> {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> 0x00}, // space
> {0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
> 0x18}, // !
> {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0x36, 0x36,
> 0x36}, // "
> ect
> ect
> ect
>
> --
> "Haven't you heard? We come in six packs now." -Zaphod Beeblebrox
> Larry E. Ramey
> ramey++at++de-solutions.com
> -----------------------------------------------------------------------
> List Archives, FAQ, FTP: http://www.sgi.com/software/performer/
> Submissions: info-performer++at++sgi.com
> Admin. requests: info-performer-request++at++sgi.com
-- For Performer+OpenGL tutorials http://www.dorbie.com/ My comment on the abuse of Jon Johanson rights; After giving up raiding their neighboring countries the Norsemen have taken to raiding 16 year old kids in their bedrooms. Very sad.
This archive was generated by hypermail 2b29 : Mon Jan 31 2000 - 14:14:12 PST