使用JOGL编译文件时出现问题 [英] Problems compiling files using JOGL

查看:82
本文介绍了使用JOGL编译文件时出现问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用JOGL获得一个简单的程序,以通过命令行进行编译.这不是真的工作.我已经尝试按照官方文档的建议引用jogl.all.jar,glugengen-rt.jar,nativewindow.all.jar和newt.all.jar,但是编译器仍然找不到JOGL类.

I'm trying to get a simple program using JOGL to compile via the command line. This isn't really working. I've tried referencing jogl.all.jar, gluegen-rt.jar, nativewindow.all.jar, and newt.all.jar as the official documentation suggested, but the compiler still cannot find the JOGL classes.

这是代码:

import java.awt.Frame;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;

import javax.media.opengl.GL;
import javax.media.opengl.GLAutoDrawable;
import javax.media.opengl.GLCanvas;
import javax.media.opengl.GLEventListener;

public class Test implements GLEventListener {

    public static void main(String[] args) {
        Frame frame = new Frame("JOGL Test");
        GLCanvas canvas = new GLCanvas();
        canvas.addGLEventListener(new Test());
        frame.add(canvas);
        frame.setSize(300, 300);
        frame.setVisible(true);
        frame.addWindowListener(new WindowAdapter() {
            public void windowClosing(WindowEvent e) {
                System.exit(0);
            }
        });
    }

    public void init(GLAutoDrawable drawable) {
    }

    public void reshape(GLAutoDrawable drawable, int x, int y, int width,
            int height) {
    }

    public void display(GLAutoDrawable drawable) {
        GL gl = drawable.getGL();
        gl.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
        gl.glClear(GL.GL_COLOR_BUFFER_BIT);
        gl.glColor3f(1.0f, 1.0f, 1.0f);
        gl.glOrtho(-1.0, 1.0, -1.0, 1.0, -1.0, 1.0);
        gl.glBegin(GL.GL_POLYGON);
        gl.glVertex2f(-0.5f, -0.5f);
        gl.glVertex2f(-0.5f, 0.5f);
        gl.glVertex2f(0.5f, 0.5f);
        gl.glVertex2f(0.5f, -0.5f);
        gl.glEnd();
        gl.glFlush();
    }

    public void displayChanged(GLAutoDrawable drawable, boolean modeChanged,
            boolean deviceChanged) {
    }

}

这是我用来编译它的:

javac -cp /jogl/lib/jogl.all.jar;/jogl/lib/gluegen-rt.jar;/jogl/lib/nativewindow.all.jar;/jogl/lib/newt.all.jar Test.java

Java编译器似乎完全忽略了我的类路径规范.

The java compiler seems to be ignoring my classpath specifications entirely.

GL,GLAutoDrawable和GLEventListener似乎很好,只是找不到GLCanvas.看看jogl.all.jar内部,似乎不存在GLCanvas.class.

It seems to be fine about GL, GLAutoDrawable, and GLEventListener, just it can't find GLCanvas. Taking a look inside jogl.all.jar, it seems that GLCanvas.class is not there.

推荐答案

尝试每种方法,看看是否可行:

Try each of these and see if one works:

javac -cp \jogl\lib\jogl.all.jar;\jogl\lib\gluegen-rt.jar;\jogl\lib\nativewindow.all.jar;\jogl\lib\newt.all.jar Test.java

javac -cp ./jogl/lib/jogl.all.jar;./jogl/lib/gluegen-rt.jar;./jogl/lib/nativewindow.all.jar;./jogl/lib/newt.all.jar Test.java

javac -cp .\jogl\lib\jogl.all.jar;.\jogl\lib\gluegen-rt.jar;.\jogl\lib\nativewindow.all.jar;.\jogl\lib\newt.all.jar Test.java

这篇关于使用JOGL编译文件时出现问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆