jogl

OpenGL: How to undo scaling?

I'm new to OpenGL. I'm using JOGL. I have a WorldEntity class that represents a thing that can be rendered. It has attributes like position and size. To render, I've been using this method: /** * Renders the object in the world. */ public void render() { gl.glTranslatef(getPosition().x, getPosition().y, getPos...

3D Graphics: How to think about a model's position

I'm new to graphics. I'm experimenting with OpenGL / JOGL. I have a .obj file that I'm rendering. I'm having difficulty placing it exactly where I want it in the world. I have a plane that I want it to rest on, taking into account the model's runtime-set size. Just doing a transformation isn't quite enough, because I need to take into ...

Graphics: .obj files and materials/textures

I am new to OpenGL / JOGL. I am able to hardcore a texture onto a polygon, and I am correctly drawing polygons specified in .obj files. I now want to draw the materials/textures specified in those .obj files, but I'm not quite sure what to do. For example, I downloaded this gazebo. The download contains a single .obj file. From that fil...

OpenGL: Create a sky box?

I'm new to OpenGL. I'm using JOGL. I would like to create a sky for my world that I can texture with clouds or stars. I'm not sure what the best way to do this is. My first instinct is to make a really big sphere with quadric orientation GLU_INSIDE, and texture that. Is there a better way? ...

OpenGL: Am I texturing this wrong?

I am new to OpenGL. I am using JOGL. I downloaded this model. It has a bunch of textures. I'm trying to apply "truck_color-blue.jpg" here, but I'm not sure I'm doing it right. This is what I'm seeing: Essentially, what I am doing is recording all the vt, v, and vn entries, then using the f lines to index into them. This is the code t...

OpenGL: Materials with Display Lists?

I am using JOGL with OpenGL. I'm drawing everything through display lists. I'm trying to figure out how to specify materials. I've been looking at this documentation. The following looks pretty straightforward: glPushMatrix(); glTranslatef (-1.25, 3.0, 0.0); glMaterialfv(GL_FRONT, GL_AMBIENT, no_mat); glMaterialfv(GL_FRONT,...

How to optimize my JOGL app?

I'm using OpenGL with JOGL. My project is getting sort of slow. I'm new to OpenGL. What are some of the best ways to optimize it? What are some good tools to profile? (I'm using Eclipse.) I recently switched from using one static Texture object for a whole bunch of models, to each one having its own Texture object. This appeared to slow...

Confused about Frustrum Culling

I'm new to OpenGL. I'm using it with JOGL. I'm reading about frustrum culling: http://www.lighthouse3d.com/opengl/viewfrustum/ http://www.crownandcutlass.com/features/technicaldetails/frustum.html I'm not sure exactly what it's supposed to do. Doesn't OpenGL cull off-screen objects automatically? (Is this culling significantly slower...

Difficulty with Text in JOGL

I'm trying to display text in my OpenGL / JOGL app. Here is some of the code: private void display(GLAutoDrawable drawable) { GL2 gl = drawable.getGL().getGL2(); GLUgl2 glu = new GLUgl2(); float[] rgba = new float[4]; backgroundColor.getRGBComponents(rgba); gl.glClearColor(rgba[0], rgba[1], rgba[2], 1); gl.glCle...

Sound with JOGL?

I have a JOGL app, and I'd like to programmatically play audio files. Is this possible? ...

OpenGL: How to make text appear at the same pixels regardless of camera orientation?

I have text that I am successfully rendering in OpenGL: GLUT glut = new GLUT(); gl.glRasterPos2d(10, 10); glut.glutBitmapString(GLUT.BITMAP_HELVETICA_18, "We're going to the moon!"); I would like this text to appear in the same location on the user's screen (occupying the same pixels) regardless of camera orientation. How ...

OpenGL: Set text color?

I'm successfully displaying text in OpenGL: GLUT glut = new GLUT(); gl.glWindowPos2d(10, 20); glut.glutBitmapString(GLUT.BITMAP_HELVETICA_12, DISPLAYED_TEXT); However, I'm not sure how to set the color. (I can see the color changing as I move the camera around, looking at different models, but I'm not sure what causes it t...

Game engine or graphics library?

Should I use a game engine or a graphics library? I was just thinking of making a simple game to start out with, but what about when you get to higher-end stuff and high poly models? Which would be faster? Also, should I choose Xith3D or JMonkeyEngine? Or if I were to go with a graphics library should I go with JOGL, LWJGL, or the new J...

Create a right-angled triangular prism in OpenGL

I'm learning OpenGL (specifically, using JOGL) and I'm trying to create a right-angled triangular prism. I learned you can create an equilateral prism with glutWire/SolidCylinder and a a low number of slices (3 for a triangle, obviously). So I'm wondering if there's some other way to make a prism, or if there's some way to scale an equ...

How can xming work with OpenGL?

I have an OpenGL (Java + applications) application deployed on a Linux machine. I need to start this application from a Windows machine, display and operate it on Windows. My application shows a whole screen of 2D graphics which is constantly updated. Both machines are OpenGL capable (video cards and drivers). When not remote, the applic...

It is posible to use JOGL (JSR 231) in a web application

I want to do an augmented reality app that runs on mobile devices, but I thing that the best way to do it is with a web application (And I have the advantage that the app will run also on PCs ) so I don't have to care about specific device implementations, I'm a java developer so I'll be so much easier for me if I can use JOGL. ...

Translating a Quaternion

(perhaps this is better for a math Stack Exchange?) I have a chain composed of bones. Each bone has a with a tip and tail. The following code computes where its tip will be, given a rotation, and sets the next link in the chain's position appropriately: // Quaternion is a hand-rolled class that works correctly (as far as I can tell...

My JOGL crashes if I'm not using an external monitor

This seems insane, but I've been able to reproduce an issue where my JOGL app crashes if I'm not using an external monitor. All I do is start the app, and it immediately becomes unresponsive. If I plug in an external monitor, the problem disappears. If I let the app run, then randomly pause it in a debugger, I get the following stack tr...

Java: Difficulty with Swing

I'm trying to modify a GUI. It is hosting a GLCanvas displaying JOGL content. Here is the code to set it up: private void setupWindow() { this.frame = new JFrame(WINDOW_TITLE); frame.setSize(width, height); frame.setVisible(true); frame.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEve...

Where can I get an updated version of JOGL? Possibly working with NetBeans?

Hello there, I need possibly detailed instructions on how to get an updated version of JOGL, and help in configuring NetBeans (6.9.1) to run with it (and give code hints and such). Please bear in mind that I am no expert in the field of Java, and it's just been a few weeks since I started, so the most detailed instructions possible would...