Page 1 of 1

OpenGL within C++

Posted: Sun Apr 29, 2007 5:05 pm
by Assembler
Hi Guys,
I've a question for C++ & OpenGL gurus.

I've a class called Bitmap having a member (array of bytes) called "buffer"
I need to call glDrawPixels() from a member function called "display()"

but "buffer" is not just a pointer, so how to pass "buffer" to glDrawPixels()

Code: Select all

class Bitmap
{
   private:
      int x, y;
      BYTE *buffer;
   public:
      void display();
}

void Bitmap::display()
{
  glDrawPixels(x, y , GL_BGR_EXT, GL_UNSIGNED_BYTE, buffer);
}
Any solutions rather than plotting pixel by pixel ???

Thanks alot

Posted: Thu May 03, 2007 6:48 am
by Solar
I could probably tell you the answer, but I am not familiar with the OpenGL API, so I am a bit confused as to what your problem actually is.

What does glDrawPixels() expect as its fourth parameter?

And while we're at the subject of type-safety, buffer is not an array, it's a pointer to BYTE...

Posted: Wed May 09, 2007 6:10 am
by supagu
http://www2.lifl.fr/~aubert/opengl_ref/ ... ls.3G.html

it does take a pointer to your image data.