Retained Mode Graphics

XL Jedi

Active member
Joined
Apr 2, 2007
Messages
44
Location
Florida
Programming Experience
10+
...interested in applying some concepts related to retained mode graphics systems.

In particular, creating and managing collections of graphic objects.

I know about hit testing and the basics already.

I've already reviewed Bob Powell's FAQ as well, but unfortunately his example for "moving around graphic objects" is all in C# and I'm trying to work with vb.net. Anyone know of any good vb.net examples/tutorials? ...or perhaps I'm just being dense or lazy in not trying to interpret Bob's C# example.

I did find one thing on the MSDN website that actually does too much.:rolleyes: Rather than show how to construct the parts, it just throws a whole pre-built (albeit simplistic) desktop publisher at you. I mean it works nice, but in the "example" the author seems to be doing more showing off than actually explaining or trying to help you understand why it works. If I stare at it :eek: for another week or two I could probably wring out of it what I'm looking for.

My particular focus at the moment is to create a collection of graphic objects. The graphic objects would be a custom class that stores info about how to draw a single graphic shape, stepping thru the collection would update/redraw all graphic objects. I'd like to create a simple example, perhaps a collection of 3 or 4 graphic objects drawn to a picturebox which allows hittesting to click/drag the 3 or 4 objects around the picturebox.

I may be asking for too much all at once but here's what I think I need.

1. Suggested setup for a Graphic object class for my collection
- needs to define and store path (I can do this)
- needs to store a pen (I can do this)
- a draw method (I can do this)
- not sure if I'll need something to help with the dragging?
- if you think I'll need something else speak up!

2. Graphic Shape Collection
- I know how to create/load the collection
- I'm sure a for/each would be required to update the drawing of the collection, but I'm not exactly sure how to code the mouseup/down events of the picturebox in conjunction with mousemove and hittesting to allow the graphic shapes to be manipulated by the user.
- I know the z-order of the graphic shapes should correspond to their index within the collection, but I'm not sure how to code that piece or whether or not I even need to worry about the overlapping graphic images vs. their isvisible property.

A collection of graphic objects like this would be the basic building blocks of any sort of game that required tracking pieces, how they move, allowing user to interact with them and so forth. I'm a little surprised I haven't already found reference to something like this in a basic vb game building discussion somewhere. In my case, I'm building a simple nautical nav-map tool and I need to develop some graphic objects to define ships, their movement, speed, direction and so forth... and allow a user to move/reposition the ships to determine new bearings, AoB, intercept courses and so forth. I know how to do all that stuff I just need to develop a better way (the graphic shape collection, I think) to store things like ships, waypoints, and so forth.

Any thoughts?
 
There is a very basic example in this thread post 2. You also in many cases don't need to be as exect as a GraphicsPath, preserving the object location can be done for example with Rectangle and drawing the different object images within this.
 
Thanks for that example. That's more along the lines of the kind of simple modular example that I was looking for. I appreciate it.

With that as a starting point, I should be able to figure out how to move the shapes around no problems.

I still have to workout how I'm going to structure the collection and graphic objects, but I can muddle through that on my own.

Thanks again.
 
Back
Top