Fills like I am double posting but anyway.
I tryed to use glReadPixel so to be able to copy an openGL scene into a PixMap (Just from curiosity) cause i never used any other programming language expect Blitz Max(and very little Java) I wasn't able to follow some examples i found in the internet.
Well...
Let's Say The scene is ready
but after the line of glReadPixels the program crash
after a thousand crashes i found a way but its really slow
can anyone tell me what i have done wrong in the first code? or so me an example of use glReadPixel to grab more than one pixels and colors in a call
I tryed to use glReadPixel so to be able to copy an openGL scene into a PixMap (Just from curiosity) cause i never used any other programming language expect Blitz Max(and very little Java) I wasn't able to follow some examples i found in the internet.
Well...
Let's Say The scene is ready
Global i:Int Global i_ptr:Byte Ptr glReadPixels 0 , 0 , 639 , 479 , GL_RGB , GL_UNSIGNED_INT , i_ptr
but after the line of glReadPixels the program crash
after a thousand crashes i found a way but its really slow
Global i:Int Global i_ptr:Byte Ptr i_ptr = Varptr i Global Red_% Global Green_% Global Blue_% Global ALPHA_% Global pixMap:TPixMap = CreatePixmap(640 , 480 , PF_RGBA8888) bglDrawText "This Will Take Some Time..." , 10 , 10 bglDrawText "When It will Finish press Space To go to Max2d" , 10 , 50 bglSwapBuffers glReadBuffer(GL_FRONT) For Local Col = 0 To 480 - 1 For Local Raw = 0 To 640 - 1 glreadpixels Raw , Col , 1 , 1 , GL_Red , GL_UNSIGNED_Int , i_ptr Red_ = i_ptr[0] glreadpixels Raw , Col , 1 , 1 , GL_GREEN , GL_UNSIGNED_Int , i_ptr Green_ = i_ptr[0] glreadpixels Raw , Col , 1 , 1 , GL_BLUE , GL_UNSIGNED_Int , i_ptr BLUE_ = i_ptr[0] glreadpixels Raw , Col , 1 , 1 , GL_ALPHA , GL_UNSIGNED_Int , i_ptr ALPHA_ = i_ptr[0] argb = (ALPHA_ Shl 24) + (Red_ Shl 16) + (Green_ Shl 8) + (Blue_) WritePixel(pixMap , Raw , Col , argb) FlushMem Next Next pixmap = YFlipPixmap(pixMap)
can anyone tell me what i have done wrong in the first code? or so me an example of use glReadPixel to grab more than one pixels and colors in a call