glDrawPixels()

This is a discussion on glDrawPixels() within the Game Programming forums, part of the General Programming Boards category; Hi - I don't know if anyone can help, but I want to use glDrawPixels(). I want to use my ...

  1. #1
    Registered User
    Join Date
    Mar 2005
    Posts
    24

    glDrawPixels()

    Hi -

    I don't know if anyone can help, but I want to use glDrawPixels(). I want to use my own created colour buffer which so far is an array of self made variable Colour. But I'm not sure how to go about this, anyone have any solutions/suggestions?

    My current solution which doesn't work is:

    glDrawPixels(400, 400, GL_RGB, GL_FLOAT, colourBuffer);

    Cheers

    HELS

  2. #2
    Registered User
    Join Date
    Apr 2002
    Posts
    1,571
    You should look up the documentation for that API as it's pretty complicated with all the different modes that need to be set.

    Here is the link to the MSDN page: (Note, certainly not the only documentation out there)

    http://msdn.microsoft.com/library/de...unc01_6lbn.asp
    "...the results are undefined, and we all know what "undefined" means: it means it works during development, it works during testing, and it blows up in your most important customers' faces." --Scott Meyers

  3. #3
    Registered User
    Join Date
    Mar 2005
    Posts
    24
    But my problem is the very last bit I need to include, which is const GLvoid *pixels. What form is this ment to be in. The only explanation is that it is a pointer to the pixel data. But my colourBuffer is a pointer to the pixel data and it just isn't working and I don't know what else to do

    HELS

  4. #4
    Registered User
    Join Date
    Apr 2002
    Posts
    1,571
    You specify the format and the type when you call the function. That's how it knows what to expect. You have format as GL_RGB and type as GL_FLOAT. So if I had to guess it would expect a pointer to a bunch of triplets of floats.

    r0, g0, b0, r1, g1, b1, r2, g2, b2, ... , r399, g399, b399

    Something like that.
    "...the results are undefined, and we all know what "undefined" means: it means it works during development, it works during testing, and it blows up in your most important customers' faces." --Scott Meyers

  5. #5
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,598
    ...but it is very slow. As of right now I don't think there is a way to simply retrieve a pointer to the buffer. Unfortunate.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Can I have some Sample Code? (OpenGL, glDrawPixels();)
    By Shamino in forum Game Programming
    Replies: 98
    Last Post: 11-03-2005, 10:46 AM
  2. glDrawPixels
    By linuxdude in forum Game Programming
    Replies: 2
    Last Post: 07-15-2004, 05:32 PM

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