Page 1 of 4 1234 LastLast
Results 1 to 10 of 38

Thread: Help? Yeah Righ!

  1. #1

    Help? Yeah Righ!

    Is this a help forum or a fudge forum!
    If it is a help forumn->

    could some one please show me how to draw a subimage with transparent areas on top of another image!

    Every time I try using this ****ing code.
    The transparent areas turn black instead of showing the image beneath.


    glClearColor(0.0f, 0.0f, 0.0f, 1.0f) ;
    glShadeModel(GL_FLAT);
    file://glEnable(GL_DEPTH_TEST);

    int x,y;
    for(x =0; x < 128; x++)
    {
    for(y = 0; y < 128; y++)
    {
    Tile[x][y][0] = 255;
    Tile[x][y][1] = 0;
    Tile[x][y][2] = 0;
    Tile[x][y][3] = 255;

    }
    }




    pngLoadRaw("E:\\Grass.png",&info[0]);
    pngLoadRaw("E:\\Marsh.png",&info[1]);

    glPixelStorei(GL_UNPACK_ALIGNMENT, 1);

    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
    glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 128, 128,
    0, GL_RGBA, GL_UNSIGNED_BYTE,Tile) ;

    glTexSubImage2D(GL_TEXTURE_2D,0,0,0,64,64,GL_RGB,G L_UNSIGNED_BYTE,info[0].Data);
    glTexSubImage2D(GL_TEXTURE_2D,0,0,64,64,64,GL_RGB, GL_UNSIGNED_BYTE,info[0].Data);
    glTexSubImage2D(GL_TEXTURE_2D,0,64,0,64,64,GL_RGB, GL_UNSIGNED_BYTE,info[0].Data);
    glTexSubImage2D(GL_TEXTURE_2D,0,64,64,64,64,GL_RGB ,GL_UNSIGNED_BYTE,info[0].Data);


    void COpenGLView: rawGL()
    {
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);





    glEnable(GL_TEXTURE_2D);
    glEnable(GL_ALPHA_TEST);
    glAlphaFunc(GL_GREATER, 0.5);
    glTexSubImage2D(GL_TEXTURE_2D,0,0,0,64,64,GL_RGBA, GL_UNSIGNED_BYTE,info[1].Data);
    glBegin(GL_QUADS);
    glTexCoord2f(0,0); glVertex2i(10,13;
    glTexCoord2f(0,1); glVertex2i(10,10);
    glTexCoord2f(1,1); glVertex2i(138,10);
    glTexCoord2f(1,0); glVertex2i(138,13;
    glEnd();






    glDisable(GL_BLEND);
    glDisable(GL_ALPHA_TESTglFlush();
    glDisable(GL_TEXTURE_2D);
    }


    Opengl easier then D3D!
    My arsehole!

  2. #2
    Senior Member Frequent Contributor
    Join Date
    Feb 2000
    Posts
    569

    Re: Help? Yeah Righ!

    As far as I know, glTexSubImage2d REPLACE the values of the texture. It is not like multitexturing.

    My guess is what your are trying to is some sort of decal. If you want to do that you should look into multitexuring.

    Or you could apply a polygon over an another using the stencil buffer to make sure you get no z fighting

  3. #3
    Guest

    Re: Help? Yeah Righ!

    Why the f#ck are you so offending?

    First of all this is an open forum, so peapole like you could answer questions.
    If you are lucky you may get an answer, but there is no rule that you have to get one.

    If you had read the spec for the function you are using you would know that it REPLACES the pixel as Gorg just posted to you. If you want to alpha blend your new subimage on the orignal texture, you have to do the alpha blend on your f#cking own.

    If you had any idea of graphics in general you would know that.

    And this dosen't have anything to do with opengl, you have to do the same in d3d.

    You may read the f#cking manual before you ask silly questions and post them into both (beginner/advanced) sections.

    I think this was the last time YOU got ANY answers in this forum.

    FYI: the alpha value 0 means completly
    transparent.

    Get a glue.

  4. #4
    Junior Member Newbie
    Join Date
    May 2000
    Location
    Richardson, TX, USA
    Posts
    15

    Re: Help? Yeah Righ!

    I love the arugments of D3D being "easier" than OpenGL

    to that I say "Great!"

    I bet tracing a picture of Donald Duck is alot "easier" than drawing one yourself...

    "easier" does not mean "better"

    as soon as people realize this, i think alot of conflict will be dimenished

  5. #5

    Re: Help? Yeah Righ!

    Originally posted by ironduke:
    I have tried it with modulate/decal etc..
    with different alpha blending constants but it is always black!


    Hey You****edMeOff!
    Blow Me!
    Jagoff!

  6. #6
    Senior Member Frequent Contributor
    Join Date
    Apr 2000
    Location
    Adelaide, South Australia, Australia
    Posts
    763

    Re: Help? Yeah Righ!

    cool. we can resort to insults and bullying to get our way. _very_ mature, ironduke. I shudder to think that one day you might right safety critical software involving trains and people's lives. (I've been there, done that, albeit in a simulation with a toy train in our undergrad course, and it's scary to think what "graduates" are churned out).

    read my reply in the same post to the advanced discussion forum.

    oh, and try to grow up. it'll make it so much easier for everybody else

  7. #7

    Re: Help? Yeah Righ!

    Thanx for the tip john, but you didnt answer my question!

    Do it NOW!

  8. #8
    Senior Member Frequent Contributor
    Join Date
    Feb 2000
    Posts
    569

    Re: Help? Yeah Righ!

    ironduke, it won't work like that. glTexSubImage2D REPLACE the value of the texture. there is no blending. The replacing is done in memory, not in the framebuffer.

    Use multitexturing, or have a second polygon over the first one you make and texture map it with your texture and blend it.

  9. #9
    Senior Member Regular Contributor
    Join Date
    May 2000
    Location
    Batavia, NY, 14020
    Posts
    234

    Re: Help? Yeah Righ!

    Can't help it. Must reply.

    Ya know what... do it in D3D, or figure it out yerself.

    An attitude like that, you MUST work for Microsoft.
    - I am not opensource! -

  10. #10

    Re: Help? Yeah Righ!

    To Gorg(not the other unhelpful jagoffs)

    So what you are saying is gltexsubImage currently doesnt support blending with the texture it is going to be placed on, only blending with the current selected color!

    If so Extension please NVidia,SGI!

Page 1 of 4 1234 LastLast

Similar Threads

  1. Hello and baby and help and yeah thats it!
    By in forum OpenGL: User Software
    Replies: 1
    Last Post: 02-06-2004, 02:57 PM
  2. Hello and baby and help and yeah thats it
    By in forum OpenGL: User Software
    Replies: 0
    Last Post: 02-06-2004, 10:00 AM
  3. uh yeah...a line..i know.....
    By tracfone in forum OpenGL: Basic Coding
    Replies: 5
    Last Post: 05-10-2001, 04:06 AM
  4. Viper 770, OpenGl and W2k? Yeah!!
    By in forum OpenGL: User Software
    Replies: 2
    Last Post: 11-17-2000, 03:03 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean