Learning JOGL and related topics.

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

Learning JOGL and related topics.

millerni456
Hello, my name is Nick, and I'm a senior in high school and really hope to pursue game development as a career.
I've taken a Java class and have a decent understanding of that, and was looking into Java bindings to OpenGL.

What I want to ask, in regards to Java OpenGL, is what kind of resources are there on the internet, books, etc... that I can learn from? I've been researching on Google plenty of times and usually will find something that helps with my understanding to
OpenGL and the way Java is used to access the OpenGL interface; but when I find things by the internet, I always end up with a tutorial or example that is outdated (usually year of 2004). More specifically, I wanted to know what kinds of resources are out there that are more recent (2008-2011). I'm looking for tutorials/guides and examples for JOGL that match the current builds on this website.

As for the feedback that I'm looking for... please share any books or internet resources that can help me learn OpenGL functions, and how to access them using the current JOGL builds. Any other advice is greatly appreciated too!
____________________________________________________________________________________
Just so you know how far I am in learning, I have read the tutorials on the Jogamp wiki, and have successfully set up a
JOGL environment to program with. I've also gathered enough information on the internet to make a program that allows
for the user to click on the GLCanvas to create points (which are rendered in the location of where the user clicks). It is also
possible for the user to rotate their points in any direction (around the origin point).

As far as the information that I am in looking for in short-term. I wanted to learn how I can to Pick-selection on my
points, lines, polygons, etc... Also, I wanted to learn how to control the viewpoint or camera used in rendering a scene.
I'd also like to have a better understanding in the matrices used in the OpenGL math. Offer the top of my head, gluPerspective uses some matrix to show the scene correctly. It would also be nice to know what glPopMatrix(), glPushMatrix, and all those other push/pop methods do.

If you can provide any advice/information, I'll gladly appreciate it. Thanks.
Reply | Threaded
Open this post in threaded view
|

Re: Learning JOGL and related topics.

Demoscene Passivist
Administrator
> I wanted to know what kinds of resources are out there that are more recent (2008-2011)

For quite up2date examples using JOGL2 u may have a look at my tumblr blog and the corresponding sourcecode repository on github.

Other than that I really recommend the OpenGL Superbible. All examples are in C but the conversion to JOGL2 is really easy. I myself started using JOGL/OpenGL with that book.
Reply | Threaded
Open this post in threaded view
|

Re: Learning JOGL and related topics.

millerni456
Hi, and thanks for the advice! I was looking at OpenGL tutorials rather than JOGL tutorials, and have found that I am being more successful! Also, it is fairly simple to convert the OpenGL commands to JOGL.

After going through some tutorials I noticed that some things cannot be done the same.
For example: Texturing. (because images are loaded differently in C/C++ than in Java).

With texturing, I was able to load an image file, use it as a texture, and coordinate it properly; but still I am unsure
as to how I can use multiple textures in an OpenGL scene. (I was able to use three different textures, but it seems that the last one bound was the only one I could see).

Also, I wanted to know if you could point me to finding a good viewing example/tutorial.
I know that I can use the gluLookat() function, and I can translate/rotate the camera with glTranslated() or glRotated(), but I still cannot achieve a good viewing component.
I have something set up so the users can use WASD and Arrow keys to modify the parameters in the gluLookat() function. For example: pressing A will change the X_location parameter to decrement, or the W key will make the Y_location parameter increment.

I still have yet to use the translate/rotate functions, so I will try those.

Lastly, any  advice to the specifics of Selection mode and using that for picking would be appreciated as well.
Thanks for helping me out. -Nick.
Reply | Threaded
Open this post in threaded view
|

Re: Learning JOGL and related topics.

Demoscene Passivist
Administrator
>With texturing, I was able to load an image file, use it as a texture, and coordinate
>it properly; but still I am unsure as to how I can use multiple textures in an OpenGL
>scene. (I was able to use three different textures, but it seems that the last one
>bound was the only one I could see).

U may have a look at this quite similar discussion ...

>Also, I wanted to know if you could point me to finding a good viewing example/tutorial.

I guess the Nehe camera class tutorials are a good starting point for building more convenient camera functions. Also this discussion might help ...
Reply | Threaded
Open this post in threaded view
|

Re: Learning JOGL and related topics.

millerni456
Thanks for helping me with the camera, but I am still stuck on textures. I visited the discussion you posted a link of, and to be honest, It blows my mind. O_o

I also did purchase that OpenGL super bible, and It has a lot of great information in it, and has helped me a lot. Although, I did get the most recent one, and it goes about using shaders.

If you could post some information on how to use Shaders in OpenGL and/or what Shaders are and what they do that'd be great.

Also, if you could post information on how to use textures the JOGL way, that'd be appreciated as well.

I've tried using the Texture class provided by JOGL, gave it an image, then enable/bind it.
This worked except I couldn't add a second texture. If I need to use the GL_TEXTURE0 - GL_TEXTURE8 could you please explain how I can do this? If I do need to, I think I will need to use glGenTextures(), which I'm not sure how to use.

Thanks for the help, It's great to have someone who can  understand this stuff and be able to share their knowledge.
Regards, Nick.
Reply | Threaded
Open this post in threaded view
|

Re: Learning JOGL and related topics.

Demoscene Passivist
Administrator
>If you could post some information on how to use Shaders in
>OpenGL and/or what Shaders are and what they do that'd be great.

A great start is this tutorial ... other than that the OpenGL SuperBible is also a great ressource for starters. I myself used that book to learn OpenGL.

Last but not least have a look at the tutorial section in the Jogamp Wiki. There are a lot of tutorials on nearly everything to get u started with JOGL.

>Also, if you could post information on how to use textures the JOGL way, that'd be appreciated as well.

For a texturing tutorial u may check out Ste3e's JOGL tutorials from our tutorial section in the wiki. He also has one on multi-texturing ...
Reply | Threaded
Open this post in threaded view
|

Re: Learning JOGL and related topics.

millerni456
Again thanks for all the help. I really appreciate all the effort you are putting towards this.

I wanted to share that I have multiple textures running! It was merely chance that got this going, but anyways... I was using the 'Texture' class found in the package "com.jogamp.opengl.util.texture". Turns out there is a method for updating the image Anyways I was able to update the image in between my drawings, and now have a multi-textured cube!

Although I'm excited to have gotten this working, I still have to consider if this is the proper way to have multiple textures.
The whole reason I came to learn OpenGL is because I wanted to make some huge games. So I do have one question:

"How should I go about managing hundreds of textures?"

Currently, I have an array of "TextureData" objects (also in the same package). Each data is then used when I need to update the texture:

texture.updateImage(gl2, textureData1);

Texture is the current texture used by OpenGL, and textureData1 contains our image.

Thanks once more for all the help! I hope I can get some shaders running soon!
Reply | Threaded
Open this post in threaded view
|

Re: Learning JOGL and related topics.

Demoscene Passivist
Administrator
>Although I'm excited to have gotten this working, I still have to consider if this is the proper
>way to have multiple textures. The whole reason I came to learn OpenGL is because
>I wanted to make some huge games.

Changing the texture data instead of "binding" a new texture is definitly not the proper way to do multitexturing, though I must admit ur approach is quite "suprising"

The correct way to do multitexturing is shown here (though in conjunction with shaders).

U simply have to bind the different textures to different texture units. It's a simple as that :)
Reply | Threaded
Open this post in threaded view
|

Re: Learning JOGL and related topics.

millerni456
I must say that I am starting to understand a lot better way shaders are.
Although I was wondering if there was a library on the internet that contains vertex and fragment shaders; so I could just attach them to my program to see how to use shaders in a program. (That way I wouldn't have to hard-code some shaders yet).

Also, I was wondering if I needed any special compiler for shaders. Are they just text documents that contain information that only OpenGL cares about? Or is it an actual C program that needs to be compiled. I actually didn't read through the whole tutorial on lighthouse3d.com yet, but I wanted to know if there was a GLSL specification so I can learn what commands do what, and how to format the shader file.


In short I wanted to know if I could just open up notepad and start coding a vertex shader. Then I could save and name it vertexShader.vert or something similar. Then attach that file to my JOGL application to use that as my vertex shader.

Thanks for all support in my JOGL learning experience :)
Reply | Threaded
Open this post in threaded view
|

Re: Learning JOGL and related topics.

Demoscene Passivist
Administrator
>In short I wanted to know if I could just open up notepad and start coding a vertex shader.
>Then I could save and name it vertexShader.vert or something similar. Then attach that file
> to my JOGL application to use that as my vertex shader.

Exacly. No special toolset needed for shader development. The shaders are written as plaintext files and then handed over to the driver via OpenGL. OpenGL then compiles the shaders for u, so Notepad is just fine, though I would recommend stg with at least syntax highlighting to avoid typos.

>Although I was wondering if there was a library on the internet that contains vertex and fragment shaders;

Sure there are tons of shaders out in wild. As always u are welcome to have a look at my repository on github with tons of shaders and the corresponding setup code for JOGL2. Other than that I can really recommend the website for the orange book wich I used as a reference site when I started using shaders back in the days.

As a second step I would recommend a professional environment for shader development. It really speeds up the whole process and is a good sandbox for new shader "adventures"  I myself use Rendermonkey for that purpose.
Reply | Threaded
Open this post in threaded view
|

Re: Learning JOGL and related topics.

millerni456
Hello again. Long time since I said thanks. So far things are going good with OpenGL. I've had progress on textures/VBOs/Shaders.

So even though this isn't really OpenGL (more of a math topic), would you have any reccomendations of any Programming physics tutorials? I'm not looking to buy another book, but something online would be great!

I'm making a game so I was trying to make it so my character can jump and collide(land) on the object below his feet.
Also I was looking to make it so speed builds up as you walk (not immediate, full speed), or the ability to walk up a staircase without jumping (colliding with a sloped shape I guess).

So I was basically looking for things that cover vector math/collision detecting (between spheres/boxes/cyclinders etc...). And some information on how this ties into a timed thread in the application. Also, perhaps it'd bee good to look at how gravity affects things per frame. (Thread iteration).


Thanks in advance!
-Nick
Reply | Threaded
Open this post in threaded view
|

Re: Learning JOGL and related topics.

Wade Walker
Administrator
I remember there were some nice physics tutorials on vector math and collision detection in Game Developer magazine a while back: http://chrishecker.com/Rigid_Body_Dynamics. There's also plenty of stuff out there if you Google for it (e.g. http://www.gamespp.com/algorithms/collisiondetection/).

It's a deep subject, so don't worry if it takes you a while to figure out -- it's hard for everyone else too :)
Reply | Threaded
Open this post in threaded view
|

Re: Learning JOGL and related topics.

millerni456
Those are great articles you posted. However I'm starting to worry I'll have to learn some more calculus before I really understand computer physics. If you don't mind, could you please list/describe what key concepts of calculus I should know?

As a start I'll need to know derivs + integrals... But what else should I know?
Reply | Threaded
Open this post in threaded view
|

Re: Learning JOGL and related topics.

Wade Walker
Administrator
I'd regard calculus as only a tool (one of many) that we use to model physical reality. Reality is the fundamental thing, not the tools we model it with :)

For game physics, I'd say the concepts of conservation of mass, momentum, and energy are the most important ideas to master. If you understand conservation laws and what they imply, you can model pretty much any Newtonian physics system, at least at the conceptual level.

But for a character jumping under the influence of gravity in a game (which you mentioned before), you can probably just use the projectile motion equations (http://en.wikipedia.org/wiki/Projectile_motion) to model your character's motion. I think that for almost any situation you'd find in a basic game, somebody somewhere has already set up and solved the equations for it, so no advanced knowledge should be required beyond algebra.

If you were doing something more complex, say writing a physics engine like Havok (http://www.havok.com/index.php?page=havok-physics), you'd be writing your own equations instead of using pre-solved ones. You'd need to know enough calculus to write your model equations down, but you wouldn't necessarily have to be able to solve those equations yourself. A program like Mathematica (http://www.wolfram.com/mathematica/) which you can get cheap educational licenses for, can solve most anything you'd come up with in this area. Or if the equations have no closed-form solution, you'd use the algorithms from something like Numerical Recipes (http://www.nr.com/) to solve them in code.

But you shouldn't have to go to that level for your first game :) To program at that level, you'd probably need three semesters of college calculus (through differential equations), plus maybe a statics and dynamics class, and maybe a class in applied mathematics (to learn how to write numerical algorithms).