Not sure how much change you are up for, but I use a CAOpenGLLayer for my view
and place a GL texture in it, that contains my pixel data.
If you need animation, you can set up multiple texture buffers to act as a
One of the benefits of this, is that you can read and write the texture with
OpenCL (etc) to speed up computations, without moving the data between the CPU
Another technique that others use, is Frame Buffer Objects, as well. I am not
using them myself, but they work well, too.
I can send a code sample to you, if you wish.
> On Jan 13, 2017, at 8:58 AM, Ian Sloman <islom...@sasktel.net> wrote:
> I am trying to update some legacy OpenGL code that I wrote back in 2003. I
> have pixel data of a CT scan that I am trying to view. In the 2003 code I
> was able to use glDrawPixel to draw the pixel data. It appears that
> glDrawPixel does not exist anymore. What process should I be using to be
> able to draw the pixel data.
> Here is the related code that I previously used:
> @implementation RawDataView
> // This function displays the selected CT data slice into
> // a pane in the upper-left hand corner of the viewing
> // window.
> - (void)drawRect: (NSRect) theRect
> unsigned char *rawData_p;
> int sliceNumber;
> BOOL debug = true;
> if(debug) printf("RawDataView: drawRect: \n");
> // get the desired slice and the address of the CT data array
> sliceNumber = [CTData getDesiredSlice];
> rawData_p = [CTData getRawSliceData];
> // initialize OpenGL window
> //gluOrtho2D(0.0, 2.0, 0.0, 1.0);
> GLKMatrix4 ortho2D = GLKMatrix4MakeOrtho(0.0, 2.0, 0.0, 1.0, 0.0, 100.0);
> glClearColor(1.0, 1.0, 1.0, 1.0);
> // display raw CT data slice
> // for testing only - copy input vectors to log file
> if(debug) printf("RawDataView: sliceNumber: %d \n", sliceNumber);
> glDrawPixels(ROWS, COLS, GL_RGB, GL_UNSIGNED_BYTE,
> I realize that I am going to have to change: gluOrtho2D(0.0, 2.0, 0.0, 1.0);
> as well.
> Celebrate each day with family and friends,
> 132 Wintergreene Lane
> Regina, SK S4S 0A7
> E-mail: islom...@sasktel.net <mailto:islom...@sasktel.net>
> Phone: 306-545-8568
> Do not post admin requests to the list. They will be ignored.
> Mac-opengl mailing list (Macemail@example.com)
> Help/Unsubscribe/Update your Subscription:
> This email sent to b...@gluetools.com
Do not post admin requests to the list. They will be ignored.
Mac-opengl mailing list (Macfirstname.lastname@example.org)
Help/Unsubscribe/Update your Subscription:
This email sent to arch...@mail-archive.com