FAQ Database Discussion Community

Is it always good to use Vec3f / Vec4f class defined by yourself?

A question about coding style: When you're going to reconstruct a virtural scene containing plenty of objects (Using JOGL), is it always good to define a Vec3f class and face class representing the vertices, normals, and faces rather than to directly use float[] type? Any ideas?

Why does OpenGL 3+ throws viewing matrices manipulation away?

GL version 1 and 2 contain functions manipulating the model, view and projection matrices, such as "glLoadIdentity()" and etc. And glu is usually used together to set the camera and viewing perspective. However, GL version 3+ does not support those any more, which means you have to implement those instead....

Error using glMultiDrawArraysIndirect and indirect buffer

I have two objects (A and B) to be rendered using glMultiDrawArraysIndirect(). Each object has a setupBuffers() method for creating, binding a vao, then creating and binding the indirect buffer, instanced ID buffer, vertices buffer and texture coords buffer. (using JOGL) Here is the problem: if I call setupBuffers() of...

What is the best way of drawing massive of different objects with the same texture using JOGL

The following questions are about the coding style. (currently using JOGL + gl3) If I want to draw a mass of different objects containing the same texture with JOGL, and to reduce the resources usage, is it better to seperate the objects and their texture (meaning that creating another class...

How can I get a project in netbeans using the gradle plugin to find native libraries?

I am trying to figure out gradle and the netbeans plugin. I have easily been able to put together simple projects, but when trying to convert a project that uses JOGL to gradle I have run into problems. I can get it to compile, but when I try to get...

JOGL GLU usage throwing GLException

I'm trying to get to grips with JOGL (and OGL in general), and have produced the following code from memory (apart from the reshape() callback), so I don't expect the OGL to be perfect. However, my usage of the GLU object and the gluLookAt() and gluPerspective() methods is causing a...

superbible sample code ported to JOGL, yet not working

I wrote some sample code from superbible (6th, P27-P30) to JOGL, but it did not work(there should be a triangle, yet there is nothing but only green background). Please take a look at the code below. Great thanks for any help!! original code: /* * Copyright ?2012-2013 Graham Sellers *...

JOGL glReadPixel with long paramater

I'm doing some stuff with OpenGL in Java using JOGL and I came across something that surprised me. There is two glReadPixel functions that points to the same C implementation. The first one is : glReadPixels(int x, int y, int width, int height, int format, int type, Buffer pixels) I...

Comparing the multiDrawArrays, using primitive restart and multiDrawElements in terms of performance?

I want to draw a mass of branches with different shapes, each of which consisting of 4 triangle strips. (Using OpenGL) So now I'm considering using one of those method calls (multiDrawArrays, using primitive restart and multiDrawElements). I was wondering which one is more efficient. Is the method multiDrawArrays() equivalent...

JOGL: Drawing spheres at specified position causes issues

I am trying to draw spheres in a 3D OpenGL canvas with JOGL using the following GLUT-Method: GLUT glut = new GLUT(); glut.glutSolidSphere(radius, stacks, slices); The size is defined by the radius-attribute and the position with gl.glTranslatef(posX, posY, posZ); In my scenario, I am drawing 3 identical spheres with different...

Undecorated full-screen JFrame showing JPanel doesn't repaint until Alt-tab

I have a JPanel v. Function below creates a full-screen Jframe, called window, which will feature this JPanel. I have: protected final void fullScreenMulti(final JPanel v) { final JFrame window= new JFrame(); window.setUndecorated(true); window.add(v); //window.setVisible(true); . . . window.validate(); window.repaint(); GraphicsDevice gdev = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice(); gdev.setFullScreenWindow(window); DisplayMode mode = gdev.getDisplayMode(); window.setSize(mode.getWidth(),...

How the gl_TessCoord is computed during the tessellation?

Currently I am learning the tessellation shader of OpenGL. But when it comes to the built in variable "gl_TessCoord" in the tessellation evaluation shader, I can't understand how it is calculated. I know that the "gl_TessCoord" is different when different tessellation mode is used (quads or triangles). And I checked...

How do you close a JOGL/NEWT GLWindow completely?

I have an incredibly dumb little sample, probably ripped straight from a tutorial, every time it runs it generates warnings on exit. I'm curious what I'm missing. Any ideas, links, things I'm forgetting? Here's the main window setup... package com.emarcotte; import javax.media.opengl.GLCapabilities; import javax.media.opengl.GLProfile; import com.jogamp.newt.event.KeyAdapter; import com.jogamp.newt.event.KeyEvent; import com.jogamp.newt.event.WindowAdapter;...

Anyone offer me an example using glMultiDrawArraysIndirect with JOGL?

I learned the method glMultiDrawArraysIndirect() from OpenGL, and I want to use this method call with JOGL. In the sample code, a C++ struct is used and the data in that struct is stored in a buffer by using glMapBufferRange(). I was wondering how it is down with JOGL? It...

How do you calculate a position?

I was wondering how to calculate the position of a point when you know the x,y,z coordinates of the viewingpoint(camera) and the rotations(rx,ry,rz) of the viewingpoint. And you know the distance (for instance 4).

rotating around objects

I've been trying to make one object orbiting another: //childX,childY,childZ are my starting coordinates //here I count distance to the middle of my coordinate plane float r = (float) Math.sqrt(Math.pow(childX, 2)+Math.pow(childY, 2)+Math.pow(childZ,2)); //here i convert my angles to radians float alphaToRad = (float) Math.toRadians(findParent(figure.parentId).rotate[1]);//up_down float betaToRad = (float) Math.toRadians(findParent(figure.parentId).rotate[0]);//left_right float...

Problems installing JOGL (Eclipse)

after numerous tutorials, I am still unable to install JOGL. I add all of the files into a folder in the class-path then add them to the build-path, but I always get compiler errors. I have tried both Eclipse and NetBeans, both Windows 7 (64 bit) and Windows 10. I...

Why normal mapping doesn't appear correctly?

I'm applying bump mapping to a tree. When no normal mapping applied, it appears like this. But when a normal texture is used, it turned out to be too aggressive as follow which is ugly. I checked tangent data which should be fine. So I was wondering if it's because...