开发者

How to set initial window size in Java OpenGL

开发者 https://www.devze.com 2022-12-23 12:22 出处:网络
I just built a Java OpenGL application in Eclipse... and when i was trying to export the application using EclipseP5Exporter, it requires me to initialize the window size (not viewport size, a window

I just built a Java OpenGL application in Eclipse... and when i was trying to export the application using EclipseP5Exporter, it requires me to initialize the window size (not viewport size, a window may contain several vie开发者_运维知识库wports).

I already googled some solutions in the net but I can't seem to get anything useful..

I've tried the method: glutInitWindowSize(int width, int height);

but it seems to work only in C and python openGL.

even if i append the glut before the method (glut.glutInitWindowSize()) eclipse doesn't recognize that method..

So if you guys have any suggestions please let me know...

Thank you....


I'm guessing by "Java OpenGL" you mean JOGL.

If this is the case, then you have either a GLCanvas or GLJPanel. Either of these should be inside a awt Frame or swing JFrame. Both of these inherit from awt.Window, which has the setSize(int,int) method.

In short, use the setSize method of your Frame or JFrame.

JOGL's implementation of GLUT only includes the drawing functions, not window management functions. Window creation is handled by Java via AWT or Swing. You might want to learn more about Java if you aren't familiar with these concepts.

0

精彩评论

暂无评论...
验证码 换一张
取 消