jogl

JOGL/OpenGL VBO - How to render vertices?

*爱你&永不变心* 提交于 2021-02-07 09:41:55
问题 3I have the following SceneRenderer class, implementing GLEventListener. I think I understand the process of creating buffers, storing pointers to those buffers and filling those buffers with data (see init method). Where I struggle is the display() method. I've tried almost every combination of EVERYTHING i found on the internet and I'm still not able to draw anything. Could someone explain me what to do now, with all the buffers filled with data waiting to be rendered ? package cz.pscheidl

How to fix this OpenGL error? “unexpected tokens following preprocessor directive - expected a newline”

梦想的初衷 提交于 2020-02-25 05:41:51
问题 I am trying to complete my first JOGL OpenGL program using shaders. I am just starting with a simple Vertex shader which does a compilation error. The shader is expected to receive a vec2(0.5, 0.5) which is basically (x,y) coordinates and it generates a proper vec4(x-1.0,y-1.0,0.0,1.0) pixel. The program actually displays the pixel, but it is not using the shader as the shader gives compilation error. How can I get more information on what is failing? Nowhere in the JOGL API code is specified

How to fix this OpenGL error? “unexpected tokens following preprocessor directive - expected a newline”

有些话、适合烂在心里 提交于 2020-02-25 05:41:06
问题 I am trying to complete my first JOGL OpenGL program using shaders. I am just starting with a simple Vertex shader which does a compilation error. The shader is expected to receive a vec2(0.5, 0.5) which is basically (x,y) coordinates and it generates a proper vec4(x-1.0,y-1.0,0.0,1.0) pixel. The program actually displays the pixel, but it is not using the shader as the shader gives compilation error. How can I get more information on what is failing? Nowhere in the JOGL API code is specified

JOGL setPerspective wrong?

匆匆过客 提交于 2020-02-05 13:50:04
问题 I've decided to use JOGL for my project. But here is the problem with setting perspective. Simple code: System.out.println("BEFORE:"); projectionMatrix.identity(); projectionMatrix.setPerspective(fovy, aspect, zNear, zFar); System.out.println(projectionMatrix); System.out.println("AFTER:"); projectionMatrix.identity(); projectionMatrix.m00 = (float)(1.0 / (aspect*Math.tan(viewAngle))); projectionMatrix.m11 = (float)(1.0 / Math.tan(viewAngle)); projectionMatrix.m22 = (float)((-zNear-zFar) /

JOGL setPerspective wrong?

梦想与她 提交于 2020-02-05 13:49:28
问题 I've decided to use JOGL for my project. But here is the problem with setting perspective. Simple code: System.out.println("BEFORE:"); projectionMatrix.identity(); projectionMatrix.setPerspective(fovy, aspect, zNear, zFar); System.out.println(projectionMatrix); System.out.println("AFTER:"); projectionMatrix.identity(); projectionMatrix.m00 = (float)(1.0 / (aspect*Math.tan(viewAngle))); projectionMatrix.m11 = (float)(1.0 / Math.tan(viewAngle)); projectionMatrix.m22 = (float)((-zNear-zFar) /

JOGL setPerspective wrong?

北城余情 提交于 2020-02-05 13:48:05
问题 I've decided to use JOGL for my project. But here is the problem with setting perspective. Simple code: System.out.println("BEFORE:"); projectionMatrix.identity(); projectionMatrix.setPerspective(fovy, aspect, zNear, zFar); System.out.println(projectionMatrix); System.out.println("AFTER:"); projectionMatrix.identity(); projectionMatrix.m00 = (float)(1.0 / (aspect*Math.tan(viewAngle))); projectionMatrix.m11 = (float)(1.0 / Math.tan(viewAngle)); projectionMatrix.m22 = (float)((-zNear-zFar) /

OpenGL light flickering when I update its position each frame

前提是你 提交于 2020-01-24 13:39:46
问题 I am learning OpenGL and just started getting into lighting. I enable lighting and light 0, set its ambient/diffuse/specular to default values in my init method, and then each frame I do something like this: glMatrixMode(GL_MODELVIEW); glLoadIdentity(); // do my 3rd-person camera transforms and rotations glLightfv(GL_LIGHT0, GL_POSITION, {0.1f, 0.0f, 0.0f}); (note if it's slightly wrong, I'm writing my app in Java using JOGL so I trimmed the gl. and GL. from each line for better readability

OpenGL: Set position instead of translating?

走远了吗. 提交于 2020-01-24 05:45:06
问题 Can I set the current render position to be an arbitrary value, instead of just giving it an offset from the current location? This is what I'm doing currently: gl.glTranslatef(3.0f, 0.0f, 2.0f); It allows me to say "I want to move left" but not "I want to move to point (2, 1, 2)". Is there a way to do the latter? I'm using OpenGL with JOGL. Update : @Bahbar suggests the following: gl.glLoadIdentity(); gl.glTranslatef(...); When I do this, everything except six lines disappears. I'm not sure

GLCanvas and GLJPanel produce different images

两盒软妹~` 提交于 2020-01-16 13:13:32
问题 My SSCE is: public static void main(final String[] args) throws IOException { try { SwingUtilities.invokeAndWait(new Runnable() { @Override public void run() { int bitdepth = 10; GLProfile.initSingleton(); GLProfile glProfile = GLProfile.getDefault(); GLCapabilities glCapabilities = new GLCapabilities( glProfile ); glCapabilities.setBlueBits(bitdepth); glCapabilities.setGreenBits(bitdepth); glCapabilities.setRedBits(bitdepth); glCapabilities.setAlphaBits(2); glCapabilities.setDoubleBuffered

JOGL - Swing - JavaFX

假如想象 提交于 2020-01-16 06:42:49
问题 Ok, I have a working JOGL application. I use a lot of OpenGL features in it including Textures, VBO's, Ray-Picking, etc. I like working with OpenGL directly and don't want to use any other 3D graphics libraries. What I want to achieve is two fold: I want to be able to embed this JOGL application in a subset window of a larger UI window. So alongside the JOGL window will be a photo viewer, text box and scrollable list. I am designing this application to run on Windows 10, multi touch hardware.