opengl questions

hi i am new to opengl ,
how do you create a (interactive)button in opengl java?
I am trying to have it so if the user clicks the button it creates a sphere or some type of object. I konw its basic but I am trying to get the hang of opengl

thanks ahead of time

anyone?

OpenGL is a really low level graphic api. There is no such things like “controls” or “buttons”. It’s more about drawing textured polygons, lines and points. So the short answer is NO. Still, you can create your own widgets ( see http://glow.sourceforge.net/ for an example ), but if you’re new to OpenGL, it’s probably too much of a challenge.

Create an object, add dimensions and a renderer to it.

Add something to convert mouse click coords into OpenGL coords, or create your own viewport with integer coords.

Check every frame to see if the mouse coords are inside the object.

Works for me.

Its a little bit more complicated than that Killer…

In game, its like saying:

Open a window, render the player, if he shoots, kill the person in front of him. Move him around with the cursor keys. And when you get through that door, you finished the game :slight_smile:

DP

Implementing it code wise isn’t difficult.
Effectively you will need layers and your GUI would be the top layer and you have to render everything in order and you can check your clicks by the z-order of objects.

Yeh it is a little bit more complicated than I made it out to be, but the idea is pretty simple and if you understand OpenGL’s basics it isn’t all that difficult to implement a button.

Implementing text is probably going to give him a larger headache than anything.

[quote]Its a little bit more complicated than that Killer…

In game, its like saying:

Open a window, render the player, if he shoots, kill the person in front of him. Move him around with the cursor keys. And when you get through that door, you finished the game :slight_smile:

DP
[/quote]