variable:
public long width,i,j;
public long bitsize;
public int[] viewport= new int[4];
public uint [] pixel= new uint[115200];
Code
GL.glGetIntegerv(GL.GL_VIEWPORT, viewport);
width=this.viewport[2]*3;
width=(this.width + 3) & ~3;
bitsize=width*viewport[3];
GL.glPixelStorei(GL.GL_PACK_ALIGNMENT, 4); /* Force 4-byte alignment */
GL.glPixelStorei(GL.GL_PACK_ROW_LENGTH, 0);
GL.glPixelStorei(GL.GL_PACK_SKIP_ROWS, 0);
GL.glPixelStorei(GL.GL_PACK_SKIP_PIXELS, 0);
GL.glReadBuffer(CsGL.OpenGL.GL.GL_BACK);
GL.glReadPixels(0,0,viewport[2],viewport[3],GL.GL_RGB,GL.GL_UNSIGNED_BYTE,pixel);
how save screen shots
hi
i am trying to save screen shots of the opengl window.i am using C# and CsGL
NOW THE PROBLEM IS NOTHING IS GETTING IS SAVED IN PIXEL VARIABLE EXCEPT OF ZERO
PLEASE IDENTIFY THE ERROR
[Edited by - phantom on September 1, 2005 5:23:29 PM]
I dont like this line
glPixelStorei(GL_PACK_ROW_LENGTH, 0);
You should pass the actual length of your row (width)
I dont like this line too
glPixelStorei(GL_PACK_ALIGNMENT, 4);
if you are using RGB/BYTE every pixel is 8*3 = 24 bit so I would use 1 or 3.
PS: have you wrapped the entire API?
glPixelStorei(GL_PACK_ROW_LENGTH, 0);
You should pass the actual length of your row (width)
I dont like this line too
glPixelStorei(GL_PACK_ALIGNMENT, 4);
if you are using RGB/BYTE every pixel is 8*3 = 24 bit so I would use 1 or 3.
PS: have you wrapped the entire API?
Quote:Original post by sirGustav
@blizzard999: Huzaifa Gain is using CsGL. It looks like they have made the GL class ;)
thanks...[smile] Now, I know !!!
Using the Tao Framework might be a better idea then using CSGL. Tao.OpenGl uses P/Invoke to call the OpenGL functions directly as opposed to reinventing the wheel. I made up some compilations of some of the libraries they provide and uploaded them to my server here. Just link to Tao.OpenGl.dll and you'll be good to go. The Tao Framework is also updated more often [wink].
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement