scrolling properties

How do I put a scroll bar onto a jogl canvas??

I am reading values from an array to draw a series of triangle. The canvas will only show the first triangles that are drawn from the values from the array.

How can I set a scroll bar or a scrolling property so that the I can show all the triangles drawn from the array??

Thanks!

You can’t. OpenGL is not supposed to tell you if the primitives you draw are visible or not, therefore you can’t know if the window should be resized or scrolled.

If you really need this you’ll have to implement it yourself (could be done using bounding boxes, but it is an advanced topic).

Some stuff to learn OpenGL :
The Redbook
OpenGL 1.5 specs
jogl ports of NeHe tutorials
CodeSampler
Ultimate Game Programming
GameTutorials

Even if the opengl canvas is put on top of a JFrame… can I still not make that scrollable to get round my problem??

No, you still won’t get the result you’re after. And you’ll get problems mixing lightweight & heavyweight controls like that anyway.

You’ll need to do the scrolling by hand somehow, like adding some buttons to your app and moving the OpenGL camera’s position when they’re clicked.

I was thinking about the camera angle option…

Can you give me some sample code on how you could change the camera angle, by two ways…

first zooming in and out, and secondly by tilting along x axis. It would be best if I could allow the application be viewed to the users descretion, i.e. allowing buttons to do the zooming and tilting.

Thanks!

The Jogl gears demo has mouse orbit view control, thats probably a good place to start looking.

where is that demo?? ???

https://jogl-demos.dev.java.net/

I took a look at the demo and its a good effect, but it doesn’t help me as much as I thought…

I want to ‘look down the array’ (like looking into a mirror with a mirror behind it)… so that I could see all the shapes that have been cut off due to the size of my canvas.

I have seen before how you can zoom in and out, but is there a code example where you can rotate the camera on its x axis and y axis using key presses??