Hi Ian,

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 
double buffer.

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 
and GPU.
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.

bob..



> 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
>    //glMatrixMode(GL_PROJECTION);
>    //glLoadIdentity();
>    //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);
>    glClear(GL_COLOR_BUFFER_BIT);
>    
>    //  display raw CT data slice
>    glRasterPos2i(0,0);
>     
>    //  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, 
> rawData_p+(49152*sliceNumber));
>    glFlush();
> }
> 
> @end
> 
> 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,
> 
> Ian
> 
> 132 Wintergreene Lane
> Regina, SK S4S 0A7
> Canada
> 
> 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      (Mac-opengl@lists.apple.com)
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/mac-opengl/bob%40gluetools.com
> 
> This email sent to b...@gluetools.com

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Mac-opengl mailing list      (Mac-opengl@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/mac-opengl/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to