Results 1 to 2 of 2

Thread: drawing images with opengl

  1. #1

    drawing images with opengl

    Hi All
    I have:
    unsigned char* imagedata.
    I also have a function(pnm.c) that reads in a greyscale pgm image and return a pointer to the beginning of data. this is stored in " imagedata".
    then to display the image i use the following:

    glDrawPixels(w,h,GL_LUMINANCE,GL_UNSIGNED_BYTE,(co nst uchar*)imagedata);

    w,h are the width and height of the image.

    but when i run the program i get a memory read error. it says memory cannot be read.

    Can someone suggest me a fix to this problem???
    thanx in advance.

  2. #2
    Senior Member Regular Contributor
    Join Date
    Feb 2000

    Re: drawing images with opengl

    Try using glPixelStorei(GL_UNPACK_ALIGNMENT,1).
    This way OpenGL wont try to align rows to the standard 4byte boundaries.

Similar Threads

  1. Drawing repeated images
    By beakie in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 09-23-2012, 06:21 AM
  2. problem with drawing gif images
    By digitalshooter in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 04-16-2009, 10:45 PM
  3. drawing images
    By nininini in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 04-22-2003, 05:12 PM
  4. Drawing images
    By in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 04-30-2001, 11:58 AM
  5. Drawing order and RGBA images
    By Csquared in forum OpenGL: Advanced Coding
    Replies: 1
    Last Post: 06-28-2000, 11:47 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