gluBuild2DMipmaps & access violation

This is a discussion on gluBuild2DMipmaps & access violation within the Game Programming forums, part of the General Programming Boards category; when does glTexImage2D, gluBuild2DMipmaps (and other OpenGL texture functions) cause access violation? If the code is something like this: Code: ...

  1. #1
    Registered User glUser3f's Avatar
    Join Date
    Aug 2003
    Posts
    345

    gluBuild2DMipmaps & access violation

    when does glTexImage2D, gluBuild2DMipmaps (and other OpenGL texture functions) cause access violation? If the code is something like this:

    Code:
    glGenTextures(1, &texture);
    glBindTexture(GL_TEXTURE_2D, texture);
    gluBuild2DMipmaps(GL_TEXTURE_2D, format, image.getWidth(), image.getHeight(), format, 
        GL_UNSIGNED_BYTE, image.getData());
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_NEAREST);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
    gluBuild2DMipmaps params are correct (including address to pixels), and OpenGL is setup correctly.
    The image is a normal 24bit image.
    Any ideas?

    PS: I searched Google and MSDN, nothing applies to my case :/
    Last edited by glUser3f; 10-03-2003 at 10:07 AM.

  2. #2
    Crazy Fool Perspective's Avatar
    Join Date
    Jan 2003
    Location
    Canada
    Posts
    2,640
    Is the image/texture data being loaded and allocated correctly?

  3. #3
    Registered User glUser3f's Avatar
    Join Date
    Aug 2003
    Posts
    345
    hmm, I'm glad and amazed at the same time right now, I've been trying to figure out this for 2 days, and now I've found what was wrong, I needed a call to glPixelStorei ...
    I've checked several books and tutorials and none mentioned it as a must, so I still don't know why it's required or otherwise the program causes access violation, may have something to do with image dimensions or something.

    BTw some textures weren't showing up correctly and now they do :/
    Last edited by glUser3f; 10-03-2003 at 02:37 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Istream::Release access violation? [C++]
    By A10 in forum Windows Programming
    Replies: 10
    Last Post: 01-13-2009, 09:56 PM
  2. Access violation... can't figure it out...
    By Raigne in forum C++ Programming
    Replies: 7
    Last Post: 10-11-2007, 10:52 AM
  3. access violation in int array
    By George2 in forum C Programming
    Replies: 2
    Last Post: 08-02-2007, 11:28 PM
  4. FtpFileFind access violation with MS VC++ 6.0
    By earth_angel in forum C++ Programming
    Replies: 3
    Last Post: 09-22-2005, 07:02 PM
  5. 0xC0000005: Access Violation
    By Strider in forum Windows Programming
    Replies: 3
    Last Post: 11-07-2001, 01:46 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21