I'm busy reading OpenGL ES 2.0 Programming Guide and decided to try and work in Java (since I'm more comfortable with it). Trying to get JOGL up and running with GL2ES2 has been a case of trial and error (almost all the tutorials I find are not GLSL based and when they are they are using those glBegin() and glEnd() methods, which I can't use). I can display a single coloured triangle, but I'm not able to translate/rotate it because I don't know how to do it with JOGL.
Can anyone provide me with a link/sample code of how to correctly implement JOGL for OpenGL ES 2.0? I'm pretty sure (well, 70% sure) that I'll be able to continue with the book if I can get a simple rotating coloured triangle up and running. |
Administrator
|
Hi François
Maybe you can find some examples here: https://github.com/sgothel/jogl/tree/master/src/test/com/jogamp/opengl/test/junit/jogl https://github.com/sgothel/jogl/blob/master/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/RedSquare0.java Demoscene Passivist has some nice examples too.
Julien Gouesse | Personal blog | Website
|
Thanks for the feedback, I'll see what I can get right with RedSquare -- I'm allready getting and error with createGLSL() :(
|
Administrator
|
What's wrong exactly?
Julien Gouesse | Personal blog | Website
|
Well, it was complaining about a missing parameter and I deleted the project. Now I see the repository has been updated (and that there is an extra parameter). My JOGL might also just be out-dated...
It might be better for me to study OpenGL first before I try using tools that assume I already know what's going on. Therefore, I've decided to take a more direct approach and try and copy the OpenGL ES 2.0 book's examples line-for-line (that is, I'm not trying to use the JOGL utilities package for setting up shaders etc). So far I've got the hello triangle up and running :) The only thing I did not 'port' was eglSwapBuffers(); I'm just assuming Jogl takes care of that. |
Administrator
|
In reply to this post by Francois
On Saturday, August 20, 2011 01:17:12 PM Francois [via jogamp] wrote:
> > I'm busy reading OpenGL ES 2.0 Programming Guide and decided to try and work > in Java (since I'm more comfortable with it). Trying to get JOGL up and > running with GL2ES2 has been a case of trial and error (almost all the > tutorials I find are not GLSL based and when they are they are using those > glBegin() and glEnd() methods, which I can't use). I can display a single > coloured triangle, but I'm not able to translate/rotate it because I don't > know how to do it with JOGL. I can now recommend reading the Gears ES1 and ES2 demo's within JOGL's unit tests. Both variants will run on desktop either with GL2ES1 (fixed function pipeline) or with GL2ES2 (programmable shader pipeline). They also shall run on devices offering ES1 and/or ES2. Both variation use the same data set, interleaved VBOs. They utilize the util classes GLArrayData* providing easy VBO construction. The ES2 variation provides the per pixel lighting (ambient, diffuse and specular), where the ES1 version uses the only ambient and diffuse fixed function ligthing. The ES2 variation also demonstrates the use of our PMVMatrix util class, supporting fixed function like matrix operations. It also uses the ShaderUtils and ShaderState util classes for easy shader and data management. +++ GearsObject: Common Gears VBO Object Construction (ES1 + ES2) <http://jogamp.org/git/?p=jogl.git;a=blob;f=src/test/com/jogamp/opengl/test/junit/jogl/demos/GearsObject.java;h=19c207f803353b19b158581aa817dfa4e14e8b93;hb=HEAD> +++ GearsObjectES1: ES1 Specialization <http://jogamp.org/git/?p=jogl.git;a=blob;f=src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/GearsObjectES1.java;h=3d93edbaf4b9fe2858c1ed97cbb6b8d2db98ef03;hb=HEAD> GearsES1: GLEventListener using GearsObjectES1 with GL2ES1 <http://jogamp.org/git/?p=jogl.git;a=blob;f=src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/GearsES1.java;h=dfac4648288c2674462d9148c570d0f04c7e4e49;hb=HEAD> TestGearsES1NEWT: Test/Launch Main Class <http://jogamp.org/git/?p=jogl.git;a=blob;f=src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/newt/TestGearsES1NEWT.java;h=86f63cb2d42f9b20d021fca286fd71a79906f9c5;hb=HEAD> +++ GearsObjectES2: ES2 Specialization <http://jogamp.org/git/?p=jogl.git;a=blob;f=src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/GearsES2.java;h=6d551144ecda3062ba30dbaab5023c92095c53be;hb=HEAD> Gears ES2 Vertex Program <http://jogamp.org/git/?p=jogl.git;a=blob;f=src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/gears.vp;h=0e417290c9d9ddaab088a7729e5081d0d57fe5a8;hb=HEAD> Gears ES2 Fragment Program <http://jogamp.org/git/?p=jogl.git;a=blob;f=src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/gears.fp;h=be2ec6843118435bce6227fad224ca8806c9bdce;hb=HEAD> GearsES2: GLEventListener using GearsObjectES2 with GL2ES2 <http://jogamp.org/git/?p=jogl.git;a=blob;f=src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/GearsES2.java;h=6d551144ecda3062ba30dbaab5023c92095c53be;hb=HEAD> TestGearsES2NEWT: Test/Launch Main Class <http://jogamp.org/git/?p=jogl.git;a=blob;f=src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NEWT.java;h=3bf7490d29602a10e23467c190c841eed23741cb;hb=HEAD> |
Thanks Sven, your feedback has inspired me to "do this right".
On my journey I went to http://jogamp.org/wiki/index.php/Building_JOGL_on_the_command_line and followed the steps. So this is my first time using Git and Ant (I usually work on small projects in Eclipse) and I managed to get it all working. The 'Building JOGL on the command line' instructions are awesome, especially for a Windows monkey like myself. Well done guys. There is just one step left out (it might be obvious to some) and that is to install 7z and add it to your CLASSPATH otherwise it will say your Build has failed. Why is the 'Building JOGL' link not on http://jogamp.org/wiki/index.php/Main_Page or even http://jogamp.org/ ?? Anyhow, onto those Gears demo's... |
Administrator
|
On Tuesday, August 23, 2011 12:09:47 PM Francois [via jogamp] wrote:
> > Thanks Sven, your feedback has inspired me to "do this right". > great, glad to help > On my journey I went to > http://jogamp.org/wiki/index.php/Building_JOGL_on_the_command_line and > followed the steps. So this is my first time using Git and Ant (I usually > work on small projects in Eclipse) and I managed to get it all working. > > The 'Building JOGL on the command line' instructions are awesome, especially > for a Windows monkey like myself. Well done guys. There is just one step > left out (it might be obvious to some) and that is to install 7z and add it > to your CLASSPATH otherwise it will say your Build has failed. > > Why is the 'Building JOGL' link not on > http://jogamp.org/wiki/index.php/Main_Page or even http://jogamp.org/ ?? well, we have the source version on the main page: http://jogamp.org/jogl/doc/HowToBuild.html Wade decided to put it on the Wiki .. so we have 2 versions :) My reason to have the 'source version' is to at least to have one little guide in the source repository, so it's sefl contained. However .. sure, we should sync them. > > Anyhow, onto those Gears demo's... Yup, I guess especially b/c they are simple and show ES1 and ES2 utilization side by side they may be a good jump start .. But pls check out the other GLSL unit tests as well, as they all show ES2 usage. ~Sven |
Yay, after playing around trying to figure out what .libs and .dlls are required I got the gears test running. ElektronenMultiplizierer is just amazing (wd Demoscene Passivist).
|
Administrator
|
In reply to this post by Sven Gothel
I wasn't comfortable doing a complete rewrite of Sven's HTML page at http://jogamp.org/jogl/doc/HowToBuild.html without being asked to But I felt like more detailed guides were needed for beginners (like me), so I wrote wiki pages instead. I didn't realize that 7zip is needed by the command-line build now -- I'll add that to the wiki page. |
Well then from one beginner to another; the guide works. My calculated guess is that 7z is required for jar'ing the junit test results and not the build itself.
|
Administrator
|
On Tuesday, August 23, 2011 04:03:43 PM Francois [via jogamp] wrote:
> > Well then from one beginner to another; the guide works. My calculated guess > is that 7z is required for jar'ing the junit test results and not the build > itself. yup, will work even w/o it the 7z result is transfered to the jenkins master, hence I wanted the archive to be as small in footprint as possible. ~Sven |
Administrator
|
In reply to this post by Francois
On Tuesday, August 23, 2011 02:31:39 PM Francois [via jogamp] wrote:
> > Yay, after playing around trying to figure out what .libs and .dlls are > required I got the gears test running. ElektronenMultiplizierer is just > amazing (wd Demoscene Passivist). > awesome Yes, Demo.. (aka Dominik) combined quite a few magic things there. It should run on mobile too .. somehow very slow I guess, since it utilizes fixed loops (loops w/ a fixed length). We have to see how that unrolling performs on some mobile GPUs :) The Gears ES2 will become the new default GLEventListener in all demos, when I hook up the ARM linux/android machines to jenkins. ~Sven |
In reply to this post by Francois
Fast forward to 2014 and this opening post could have been written by me.
I am trying to get up to speed on JOGL to develop models that can be used on mobile devices, and so far I have learned that this means OpenGL ES 2. The iPhone doesn't support OpenGL ES 3 until the 5s or later. However there seems to be very little work done on tutorials to help with this. Can anyone provide a refresh on where to go? |
Administrator
|
Have you looked at the project jogl-demos on Github?
You can look at this example: http://jogamp.org/git/?p=jogl-demos.git;a=blob;f=src/demos/es2/RawGL2ES2demo.java;hb=HEAD What do you expect? What are you looking for? JOGL is mostly a Java binding for the OpenGL and OpenGL ES APIs. It contains some helpers in order to ease the support of cross-platform code paths, for example there are some classes to emulate a part of the fixed pipeline, ImmModeSink (emulates the immediate mode) and com.jogamp.opengl.util.glsl.fixedfunc.FixedFuncUtil.
Julien Gouesse | Personal blog | Website
|
That's a good start -- thanks for the link I'll start there.
I suppose most of the confusion has to do with the plethora of OpenGL implementations and versions out there. There always seems to be some fragment of knowledge missing out of each example. It seems pretty apparent that the way to go is to follow the C-based tutorials and references and carefully trans-code them into Java, but before you can do that you have to have a JOGL scaffolding to build on. Until you posted that link I hadn't found any example that uses this code: GL2ES2 gl = drawable.getGL().getGL2ES2(); There are a lot of things you have to understand to be able to understand that, and I have found now comprehensive reference that explains it. I think I understand that now but it has been a twisty path. Thanks for the help. |
Administrator
|
On 09/17/2014 10:42 PM, AlanObject [via jogamp] wrote:
> I hadn't found any example that uses this code: > > GL2ES2 gl = drawable.getGL().getGL2ES2(); > > There are a lot of things you have to understand to be able to understand > that, and I have found now comprehensive reference that explains it. I think > I understand that now but it has been a twisty path. > <https://jogamp.org/jogl/doc/Overview-OpenGL-Evolution-And-JOGL.html> <https://jogamp.org/doc/fosdem2013/> <https://jogamp.org/doc/siggraph2014/> Simple ES2 GLEventListener: <http://jogamp.org/git/?p=jogl.git;a=blob;f=src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/RedSquareES2.java;h=8058d1b7ddbbe4cd2e6e3d36a3e588941cb76b05;hb=HEAD> Using it .. within NEWT: <http://jogamp.org/git/?p=jogl.git;a=blob;f=src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestRedSquareES2NEWT.java;h=52f4473c3d36a5dfdbc21be134306096812ff98f;hb=HEAD> ~Sven signature.asc (828 bytes) Download Attachment |
In reply to this post by gouessej
I just tried this and it failed to compile the shader. I will start a separate thread on this and maybe we can improve it. |
Free forum by Nabble | Edit this page |