JOGL2 + OpenGL 3.3

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

JOGL2 + OpenGL 3.3

dbzk
Hi all,

I have tried to translate the tutorial from http://www.arcsynthesis.org/gltut/Basics/Tutorial%2001.html in Java with JOGL2, NEWT, but the triangle is not displayed.

I've added the source code.
JOGL2NewtOpenGL33.java

If someone has an idea?

Thanks.
Reply | Threaded
Open this post in threaded view
|

Re: JOGL2 + OpenGL 3.3

gouessej
Administrator
Hi

Maybe someone already ported this source code. I can look at it a bit but it would be better if someone with better skills in shaders could help you. @DemoscenePassivist we need your help :)

Edit.: Are you sure your hardware supports this version of GLSL?
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: JOGL2 + OpenGL 3.3

swilson007
In reply to this post by dbzk
Don't know if this helps you, but if you want a quick working example of GL3/GLSL15, I just ported the example over at:
http://www.lighthouse3d.com/cg-topics/code-samples/opengl-3-3-glsl-1-5-sample/

It's in the comment section after the c++ example code.  

It works using pure GL3 (no backwards compatibility required)...  Note there's a small bug in that if your shader or program has a compile error it won't print anything out.

OK I just uploaded it including the vert and frag shaders.
GL3Sample.zip
Reply | Threaded
Open this post in threaded view
|

Re: JOGL2 + OpenGL 3.3

gouessej
Administrator
Thank you swilson007. You should post that code in the wiki or contribute to jogl-demos. We would be glad to have such examples.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: JOGL2 + OpenGL 3.3

Sven Gothel
Administrator
In reply to this post by swilson007
On 05/07/2013 02:39 AM, swilson007 [via jogamp] wrote:

> Don't know if this helps you, but if you want a quick working example of
> GL3/GLSL15, I just ported the example over at:
> http://www.lighthouse3d.com/cg-topics/code-samples/opengl-3-3-glsl-1-5-sample/
>
> It's in the comment section after the c++ example code.  
>
> It works using pure GL3 (no backwards compatibility required)...  Note there's
> a small bug in that if your shader or program has a compile error it won't
> print anything out.
>
> OK I just uploaded it including the vert and frag shaders.
> GL3Sample.zip <http://forum.jogamp.org/file/n4029105/GL3Sample.zip>
Nice, if it's a simple demo, maybe we can add this as a unit test in JOGL
in our GL3 test package:
  com.jogamp.opengl.test.junit.jogl.demos.gl3

Pull requests welcome!

~Sven




signature.asc (911 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: JOGL2 + OpenGL 3.3

swilson007
I think the best part of that demo code is that it's self contained.  One java class, one vertex shader, one frag shader.  Just enough to get some triangles drawing on the screen.  With GL3 there's just so many places to "do it wrong" that a minimal working example can be really helpful.  

I'll have to dig around the JOGL demos and tests a little more as I'm sure there's more helpful code there as well.

Thanks to the JOGL team and keep up the good work!  
Reply | Threaded
Open this post in threaded view
|

Re: JOGL2 + OpenGL 3.3

jmaasing
I'm at work so I can't look into swilsons example, I'm sure it is better than my first attempt at getting a triangle in GL3 :-)

http://forum.jogamp.org/need-help-understanding-glVertexAttribPointer-and-GL-INVALID-OPERATION-tp4027730p4027760.html

Reply | Threaded
Open this post in threaded view
|

Re: JOGL2 + OpenGL 3.3

swilson007
Oh, no credit or ownership of that code from me please :)  It's a very direct port of the C++ example at http://www.lighthouse3d.com/cg-topics/code-samples/opengl-3-3-glsl-1-5-sample/
(Note that their site is now throwing a me a server error.  Sigh...)

Regardless, I resisted all urges to change or improve.  
Reply | Threaded
Open this post in threaded view
|

Re: JOGL2 + OpenGL 3.3

dbzk
In reply to this post by swilson007
I have found why my program doesn't works

There are 2 errors in my code:
* the reshape method is not implemented
* the expected size of the array which contains the vertex of the triangle is in bytes, not the number of elements of the array

I have added the fixed version of the program.
JOGL2NewtOpenGL33Fixed.java

Thank you swilson007, your example helped me a lot

Thanks to the JOGL team for your really good job!