Page 1 of 2 12 LastLast
Results 1 to 10 of 13

Thread: Help needed(Texture Mapping)

  1. #1
    Junior Member
    Join Date
    Oct 2004
    Location
    Rawalpindi, Pakistan
    Posts
    26

    Help needed(Texture Mapping)

    I want to map a bmp file i-e "myimage.bmp" on a rectangular object.kindly gimme any tutorial or code sample. I ll be greatful to you for the favour.

  2. #2

    Re: Help needed(Texture Mapping)

    Gautam converted a bunch of NeHe OpenGL tutorials to OpenGL|ES a few months ago.

    Take a look at this thread.

    - ben

  3. #3

    Re: Help needed(Texture Mapping)

    I should add that those ports use UG and therefore likely only work with the Khronos Linux and Vincent implementations.

    You might want to look at regular OpenGL [texture mapping] tutorials. The syntax might be slightly different, but the concepts are the same. Try here or here.

    - ben

  4. #4
    Junior Member
    Join Date
    Oct 2004
    Location
    Rawalpindi, Pakistan
    Posts
    26

    Re: Help needed(Texture Mapping)

    i tried to manipulate one of the tutorials from the redbook "texbind", i did some thing like this ... but still not working. plz solve this segment

    Code :
     

  5. #5
    Member
    Join Date
    Oct 2004
    Location
    Bangalore, India
    Posts
    44

    Re: Help needed(Texture Mapping)

    It would help if you also say what happens with that piece of code. Except for this it seems ok to me :-

    Code :
     

    The width and height need to be image width and height, not 2x2 which IMHO is very small.

    Also call the following in Display not reshape.

    Code :
     

    Also sometimes biSizeImage returns 0, that time you have to use width * height * 3 for memory allocation.

    But it would help if we have an idea of what exactly is not working and what exactly is happening with this code.

  6. #6
    Member
    Join Date
    Oct 2004
    Location
    Bangalore, India
    Posts
    44

    Re: Help needed(Texture Mapping)

    <BLOCKQUOTE><font size="1" face="Arial, Verdana, Helvetica, sans-serif">quote:</font><HR>Originally posted by bentlegen:
    I should add that those ports use UG and therefore likely only work with the Khronos Linux and Vincent implementations.

    You might want to look at regular OpenGL [texture mapping] tutorials. The syntax might be slightly different, but the concepts are the same. Try here or here.


    - ben
    <HR></BLOCKQUOTE>

    Although they have only been tested on linux using UG implementation the rendering part can be easily copied from that to any other implementation

    [ January 06, 2005: Message edited by: gautam ]

  7. #7
    Junior Member
    Join Date
    Oct 2004
    Location
    Rawalpindi, Pakistan
    Posts
    26

    Re: Help needed(Texture Mapping)

    this code is trying to map "mybmp" on a triangle. Now its working a little bit. but the problem is that when i give it a plain bmp i-e of one color only, like red, or grey or yellow, it works, but when i give it any multicolored bmp, only its first color is displayed on whole triangle, for e.g if a bmp is divided into yellow and green color of equal size, only 1st color is displayed. how to solve this???

  8. #8

    Re: Help needed(Texture Mapping)

    Just a guess, but it's likely that you're not specifying the proper height/width of the texture to glTexImage2D, and that the few colors that are getting through are being clamped throughout the rest of your textured poly.

    - ben

  9. #9
    Junior Member
    Join Date
    Oct 2004
    Location
    Rawalpindi, Pakistan
    Posts
    26

    Re: Help needed(Texture Mapping)

    I agree with this, but how can i specify the width and height of the image in glTexImage2D() ???i tried by following way but by doing so nothing appears on screen


    glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB,bitmapInfoHeader.biWidth,
    bitmapInfoHeader.biHeight, 0, GL_RGB, GL_UNSIGNED_BYTE,bitmapData);

    [ January 06, 2005: Message edited by: qasim1981 ]

  10. #10

    Re: Help needed(Texture Mapping)

    Hi. Are the dimensions of the bitmap power-of-two ? OpenGL ES only supports power-of-two textures (256x256, 128x64, ...).

    --jani;

    [ January 07, 2005: Message edited by: Jani Vaarala ]

Page 1 of 2 12 LastLast

Similar Threads

  1. Texture mapping
    By Giacomo in forum OpenGL ES general technical discussions
    Replies: 3
    Last Post: 06-28-2005, 08:04 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •