JOGL FirstDemo
2016-07-01 17:08
288 查看
package com.xiuye.jogl; import javax.swing.JFrame; import com.jogamp.opengl.GL4; import com.jogamp.opengl.GLAutoDrawable; import com.jogamp.opengl.GLCapabilities; import com.jogamp.opengl.GLEventListener; import com.jogamp.opengl.GLProfile; import com.jogamp.opengl.awt.GLCanvas; public class Game extends JFrame implements GLEventListener { /** * */ private static final long serialVersionUID = 8623653810668055175L; final private int width = 800; final private int height = 600; public Game(){ super("Minimal OpenGL"); GLProfile profile = GLProfile.get(GLProfile.GL4); GLCapabilities capabilities = new GLCapabilities(profile); GLCanvas canvas = new GLCanvas(); canvas.addGLEventListener(this); this.setName("Minimal OpenGL"); this.getContentPane().add(canvas); this.setSize(width,height); this.setLocationRelativeTo(null); this.setDefaultCloseOperation(EXIT_ON_CLOSE); this.setVisible(true); this.setResizable(false); canvas.requestFocusInWindow(); } public void play(){ } @Override public void display(GLAutoDrawable drawable) { GL4 gl = drawable.getGL().getGL4(); gl.glClear(GL4.GL_COLOR_BUFFER_BIT); gl.glFlush(); } @Override public void dispose(GLAutoDrawable arg0) { } @Override public void init(GLAutoDrawable drawable) { GL4 gl = drawable.getGL().getGL4(); gl.glClearColor(0.392f, 0.584f, 0.929f, 1.0f); } @Override public void reshape(GLAutoDrawable arg0, int arg1, int arg2, int arg3, int arg4) { } }
package com.xiuye.jogl; public class FirstJOGL { public static void main(String[] args) { Game g = new Game(); g.play(); } }
相关文章推荐
- 操作服务器常用命令
- RecyclerView显示不同的类型的item
- 数据库错误5123修复
- mysql数据库大数据量的查询优化和分页测试
- c#向SQL Server中存储图片并且再从数据库中读取图片
- mysql 5.7.13 winx32 安装步骤
- 问题集
- django HelloWorld
- ZSS 支持excel的JDK分析
- 阻止继承的思路,屏蔽友元类
- Cesium应用篇:1快速搭建
- linux svn 使用
- kvm 快照
- sourceinsight安装记录
- 你的福利是咋被百度云盘给和谐的
- Oracle分析函数
- android bundle封装传递map对象
- 从 UIWebView 到 WKWebView
- nginx 只能域名访问
- MyBatis启动时控制台无限输出日志的原因及解决办法