Java-Gaming.org Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (744)
Games in Android Showcase (225)
games submitted by our members
Games in WIP (825)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Trying to project a 2d drawing in 3D space ...  (Read 2439 times)
0 Members and 1 Guest are viewing this topic.
Offline augusto

Senior Newbie





« Posted 2005-05-12 00:13:29 »

... is jogl the right hammer?

Basically, I have a 2D renderer written in Java2D for all kinds of schematics and maps (not quite GIS) that we use a lot. One of the features we'd like to play with is the following;

Say we have a small map rendered in 2D of a geographical area. Scattered across this maps we have "values" we track that are defined at different levels across the map.

What I'd like to do is rotate the map a bit, (or let users rotate the map) say like an isometric version of it. Then have the values that are contained in the map be represented by 3d lines (maybe normalized) that graphically show what values are higher than the others. At one point, I might even want to create a mesh with these values, but for now imagine they are just cylinders that project from the 2d map.

So if I understand jogl well enough, the apporach should be to somehow grab the rendered image from my JComponent that draws maps (this is easy) and then load that image as a texture on a square surface.

When I redraw the image, I update the texture.

Does this make sense or am I making my life more complicated? I seem to remember some library out there, maybe for Java3D that would let you project the drawing of a JComponent onto a 3D surface. I may have imagined this :-)

Is jogl the right technology for this, or should I look at something more high level. For this functionality, which seems fairly simple, it seems jogl is a good fit.

Any ideas, opions? Thanks!
Offline rexguo

Junior Devvie




Real-Time Java


« Reply #1 - Posted 2005-05-12 02:29:30 »

Yes it is definitely possible to get a Java2D
rendered image across to JOGL as a texture.
I've done quite a bit of this in fact. The way
I'm doing it requires a custom BufferedImage
that wraps an int[] supplied by me.
This is for 2 reasons:

1. JOGL can update a texture directly from an int[].
Not the fastest approach, but good enough for
many purposes.

2. I can perform a swizzle from Java2D's native
pixel format (ARGB) to OpenGL's fast pixel format
(BGRA) by operating directly on the int[]. If you
get Java2D to render in BGRA, you're gonna get
horrendous speeds; if you wanna get OpenGL to
update the texture in ARGB, there's a problem
because ARGB is not supported, only RGBA :-)

Also note that most OpenGL drivers support
a max of 2048x2048 texture size. If your image
is bigger than this, you either have to scale
it down or split it into tiles that you manage
yourself.

.rex

http://www.rexguo.com - Technologist + Designer
Offline ozak

Junior Devvie




Java demon has no respect for bad code!!!


« Reply #2 - Posted 2005-05-12 05:10:56 »

Don't you want to render the map in 3D to get the proper isometric perspective? If you map schematics are made of lines with heights (like in the SOSI geographical format used in norway Smiley) you could simply render it as 3D lines and get a rough 3D representation of your map.

Just mapping the image as a texture will allow you to rotate it, but you'll get no 3D effect.

Want to do multiplayer? Why not try my free Socky socket server?
It's scriptable through JavaScript!
Check it out at http://www.furi.dk/socky
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline devent

Junior Newbie




Java games rock!


« Reply #3 - Posted 2005-05-12 12:04:24 »

you can get 3D-effect with bumpmapping  Wink
Offline augusto

Senior Newbie





« Reply #4 - Posted 2005-05-12 19:57:41 »

> Don't you want to render the map in 3D to get the proper isometric perspective?

That would be nice, but the information we have is very flat, is has no z information, so it's practically impossible. That would be very neat, but it's really 2D drawings.

The reason I want to do this is just to experiment to see how 3D visualizations can help you analyse this type of information. When you add the values (what I want to project from the map) to the coordinates, then you get a quick view of problem areas.

Thanks for the suggestions, I have a lot of stuff to learn, I just wanted to make sure I'm using the right tool. This is not for a game, but it seems like a perfect fit.
Offline cylab

JGO Kernel


Medals: 174



« Reply #5 - Posted 2005-05-13 05:50:32 »

Maybe you should look into Java3D if it's for visualization. It might be easier to use a scenegraph instead of an immediate mode API like OpenGL.

Mathias - I Know What [you] Did Last Summer!
Offline ryanm

Senior Devvie


Projects: 1
Exp: 15 years


Used to be bleb


« Reply #6 - Posted 2005-05-13 10:12:09 »

I dunno, all he's after sounds like a textured quad and some gluCylinders.
I would have thought that a full-blown scenegraph was a bit of overkill.
Pages: [1]
  ignore  |  Print  
 
 

 
Ecumene (149 views)
2017-09-30 02:57:34

theagentd (214 views)
2017-09-26 18:23:31

cybrmynd (301 views)
2017-08-02 12:28:51

cybrmynd (288 views)
2017-08-02 12:19:43

cybrmynd (297 views)
2017-08-02 12:18:09

Sralse (291 views)
2017-07-25 17:13:48

Archive (968 views)
2017-04-27 17:45:51

buddyBro (1094 views)
2017-04-05 03:38:00

CopyableCougar4 (1670 views)
2017-03-24 15:39:42

theagentd (1430 views)
2017-03-24 15:32:08
Java Gaming Resources
by philfrei
2017-12-05 19:38:37

Java Gaming Resources
by philfrei
2017-12-05 19:37:39

Java Gaming Resources
by philfrei
2017-12-05 19:36:10

Java Gaming Resources
by philfrei
2017-12-05 19:33:10

List of Learning Resources
by elect
2017-03-13 14:05:44

List of Learning Resources
by elect
2017-03-13 14:04:45

SF/X Libraries
by philfrei
2017-03-02 08:45:19

SF/X Libraries
by philfrei
2017-03-02 08:44:05
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!