Displaying 10-bit image data using OpenGL

  • Follow


I am trying to take the data in a framegrabber buffer and display it in
a dialog using OpenGL. The reason for this is becasue OpenGL will allow
me to scale the image up or down so i can view the entire 1020x1240
image. The camera taking the images, streams the data at 10-bits per
pixel to the buffer. In order to test the following section of code i
saved the buffer to no image format so that it is only pixel data and i
tried to display it but it does not work. I have only started using
OpenGL and i am only at the stage of initialising OpenGL and displaying
triangles in a dialog box. I have inlcuded a portion of the code to
help my explaination.


Crispen

ps: All the sizes for the image mallocing and reading i have made big
because i was not sure how big they needed to be.

void COpenGL::OnPaint()
{
	CPaintDC dc(this); // device context for painting

	// TODO: Add your message handler code here
	HDC hdc = ::GetDC(m_hWnd);
	HGLRC hglrc;

	// TODO: Add your message handler code here
	glClearColor(0,0,0,0);
	glColor3f(1, 1, 1);

	if (hglrc = wglCreateContext(hdc))
	{
        if(wglMakeCurrent(hdc, hglrc))
		{
			BYTE *pData = (BYTE*)malloc(10000 * 10000 * 3 * sizeof(BYTE));
			FILE* fp = fopen("test.shit","r");
			fread(pData,2,1068000,fp);
			glClear(GL_COLOR_BUFFER_BIT);
			glDrawPixels(1000,1016,GL_COLOR_INDEX,GL_UNSIGNED_SHORT,pData);
			free(pData);
			fclose(fp);
			SwapBuffers(hdc);
        }
    }

	wglMakeCurrent(NULL, NULL) ;
	::ReleaseDC (m_hWnd, hdc) ;
	wglDeleteContext(hglrc);

	// Do not call CWnd::OnPaint() for painting messages
}

0
Reply cjb111 (6) 5/12/2005 1:33:43 AM

cjb111@student.canterbury.ac.nz wrote:

> glDrawPixels(1000,1016,GL_COLOR_INDEX,GL_UNSIGNED_SHORT,pData);

I don't think you want "GL_COLOR_INDEX" here...



-- 
<\___/>
/ O O \
\_____/  FTB.    For email, remove my socks.
0
Reply fungus 5/12/2005 1:48:24 AM


1 Replies
350 Views

(page loaded in 0.089 seconds)

Similiar Articles:













7/22/2012 12:06:39 AM


Reply: