Archived

This topic is now archived and is closed to further replies.

making interface

This topic is 5776 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Can anyone please point me to a site that shows how I might develop a simple Ogl interface to draw lines, polygons, etc. I mean, with buttons to press to choose a rectangle or circle, then draw it in the other viewport?

Share this post


Link to post
Share on other sites
I dunno, but you can make I use a real stupid method, I just used texturized quads, then place another quad on it with a different texture. Then I just use picking and voila it works.

Share this post


Link to post
Share on other sites
I dunno, but you can make I use a real stupid method, I just used texturized quads, then place another quad on it with a different texture. Then I just use picking and voila it works.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
or you could use colored quads for buttons, with 2d-texture text drawn on them, and use a 2D bsp for detecting collisions between the mouse and the buttons...

Share this post


Link to post
Share on other sites
Why the hell would you want to use 2D bsp? has everyone decided.. "Ooo... John Carmack uses BSP trees... so let's all go out and use them to decide what i'm gonna have for breakfast!"?

Arrgghh! it's 2D! 2D! you don't need a bsp tree for that! it complicates matters infinitly!
Sure you could use it if you are so inclined to BSP trees... i never could get them to work properly and use Octrees instead! so there!

Anyway....
A simple way would be just to use Bounds Checking... ie. get mouse x and y co-ords and check to see if it's in the bounds of the object you want.. eg...
  
mx=mouse x;
my=moues y;
max_x=maximum x bounds of object;
min_x=minimum x bounds of object;
max_y=maximum y bounds of object;
min_y=minimum y bounds of object;

if (mx < max_x and mx > min_x and my < max_y and my > min_y)
mouseclickbutton();

Seems pretty Simple to me..

btw: no offence Mr. "Anonymouse Poster" about the bsp tree thing.. they sure are useful for some stuff.. but i think it's time to invent a more effecient manner to do stuff then "BSP" tree....

I bet you are saying right now...
"But he has to iterate through every object to get what he wants.."
yes.. that's true.. but unless he has a billion bjects on the screen, surely he can afford the cost of *NOT* having the overhead of a BSP tree?


Edited by - Spikeles on February 23, 2002 11:08:55 AM

Share this post


Link to post
Share on other sites
Sorry "Anomymus Poster" I shouldnt have said any of that... i had at think about it and i do belive a 2D bsp tree might actually be quite usefull for more advanced apllications of interfaces... again i apologize for my rash words...

Share this post


Link to post
Share on other sites
You obviously program quite elegantly. I am just growing my cutting teeth on Ogl. Maybe I should just define an array of rectangles, then see if the point clicked is within any of them by iterating through.

Share this post


Link to post
Share on other sites