Draw offscreen with JOGL

邮差的信 提交于 2019-12-01 19:33:00

Not sure if I should be answering my own question, but here goes with what I found seems to work now.

The key is GLPbuffer, which is an offscreen GLAutoDrawable and can be created without a visible component heirarchy.

This article was helpful in getting it to work. I'll leave off accepting this answer until I've confirmed it's fully functional.

I should also say that the answer came from this forum, not my own meagre brain.

You should look into method: glReadPixels() more info here. Basically it works more or less like this:

Init(); //doing some initializations in your JOGL app

glDrawBuffer(GL_BACK);

DrawGLScene(); //doing drawing here

glReadBuffer(GL_BACK);

//Copy the image to the array imageData
glReadPixels(0, 0, WIDTH, HEIGHT, GL_RGBA, GL_UNSIGNED_BYTE, imageData); 
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!