Java-Gaming.org    
Featured games (91)
games approved by the League of Dukes
Games in Showcase (579)
games submitted by our members
Games in WIP (500)
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  
  Texture Mapping w/ Java2D  (Read 1889 times)
0 Members and 1 Guest are viewing this topic.
Offline Sentient-Absence

Junior Newbie





« Posted 2005-02-02 21:41:35 »

Hello, I am fairly new to Java game programming, and I was wondering how I should go about texture mapping polygons in a 3D environment with Java2D, with No polygon scan conversions... Can anyone help?
Sorry if this is the wrong place for this topic =\

Aut viam inveniam aut faciam - I will either find a way or make one
Offline tom
« Reply #1 - Posted 2005-02-02 21:51:08 »

I assume that "with No polygon scan conversions" you mean you don't want to code the texture mapper yourself? Then it is not possible. As the name aplies it is a 2D api.

Offline Sentient-Absence

Junior Newbie





« Reply #2 - Posted 2005-02-02 21:59:34 »

hmm.... I meant without turning the polygons on the screen into horizontal scans, like
900 (1 scan)
990 (another scan)
999  (yet another scan)
= a triangle (sort of)
|\
| \
----

Is that what you meant? Sorry if I don't seem to make the best sense .. =(

Is is still not possible without scan converting?  ..

Aut viam inveniam aut faciam - I will either find a way or make one
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline tom
« Reply #3 - Posted 2005-02-02 22:20:08 »

It's not possible.

Offline Sentient-Absence

Junior Newbie





« Reply #4 - Posted 2005-02-02 22:55:40 »

Ah.. ok I see.

Btw, do you know where to look for on the internet to learn how to texture map w/o Java3D?

Aut viam inveniam aut faciam - I will either find a way or make one
Offline jbanes

JGO Coder


Projects: 1


"Java Games? Incredible! Mr. Incredible, that is!"


« Reply #5 - Posted 2005-02-02 23:09:21 »

Quote
It's not possible.


Of course it's possible! You just have to get imaginitive! The Graphics2D object provides everything you need to draw 3D graphics. The downside is that they'll be Affine Texture Mapped, slow, and you'll have to do all the 3D transforms yourself.

All you have to do is figure out the scaling factor for a texture, set the 2D clipping area for the polygon (see: setClip(Shape clip)), and draw the image with an AffineTransform object that includes the scaling and rotation factors.

That's it. <sarcasm>Simple, isn't it?</sarcasm> ;-)

Java Game Console Project
Last Journal Entry: 12/17/04
Offline Sentient-Absence

Junior Newbie





« Reply #6 - Posted 2005-02-02 23:44:57 »

Cheesy

When you say slow... does that mean so slow that you shouldn't even bother for a game?   Huh

Where can I learn this in detail?

The way you say it, it sounds not too hard  Smiley  Or is it?

tyvm.

Aut viam inveniam aut faciam - I will either find a way or make one
Offline jbanes

JGO Coder


Projects: 1


"Java Games? Incredible! Mr. Incredible, that is!"


« Reply #7 - Posted 2005-02-02 23:59:27 »

Quote
When you say slow... does that mean so slow that you shouldn't even bother for a game?   Huh


It wouldn't be my first choice. But I have no hard data on perfomance one way or the other. My opinion is that it would be spectacularly slow, but that's no guarante.

You can see a demo of what you can do in the jfc/Java2D demos that come with the JDK.

Quote
Where can I learn this in detail?


The 2D Graphics trail in the Java Tutorial is a good place to start:

http://java.sun.com/docs/books/tutorial/2d/index.html


Quote
The way you say it, it sounds not too hard  Smiley  Or is it?


It's not so bad. You still have to have a grip on 3D math, so you're not getting away scot free. However, Java2D can handle the intracasies of rendering to the screen.

The primary things you need to understand are:

1. How to convert 3D coordinates to screen coordinates.
2. How to rotate and translate 3D coodinates.
3. How to calculate the distance from a 3D normal.

If you can handle those three, then the rendering should be something of a snap.

One other thing. I said that Java2D could only do Affine texture mapping. (Affine means that a texture is literally cut out of an image, and is thus unable to "tilt" if a polygon is tilted away from the screen.) This is only partially correct. Something called "perspective affine" can be accomplished by pinching and shearing the image in line with the 3D polygon's rotation. However, it's much more difficult to implement, so you probably want to start with simple affine.

Java Game Console Project
Last Journal Entry: 12/17/04
Offline tom
« Reply #8 - Posted 2005-02-02 23:59:44 »

Quote


Of course it's possible! You just have to get imaginitive! The Graphics2D object provides everything you need to draw 3D graphics. The downside is that they'll be Affine Texture Mapped, slow, and you'll have to do all the 3D transforms yourself.

All you have to do is figure out the scaling factor for a texture, set the 2D clipping area for the polygon (see: setClip(Shape clip)), and draw the image with an AffineTransform object that includes the scaling and rotation factors.

That's it. <sarcasm>Simple, isn't it?</sarcasm> ;-)


Shocked Well I stand corrected.

Quote
Cheesy

When you say slow... does that mean so slow that you shouldn't even bother for a game?   Huh

Where can I learn this in detail?

The way you say it, it sounds not too hard  Smiley  Or is it?

tyvm.


It was meant as a joke (I hope). Although it is possible in theory, it would be easier and faster to do your own rastariser.

There are texture mapping articles on flipcode.

Why don't you use OpenGL with JOGL or LWJGL?

Offline Sentient-Absence

Junior Newbie





« Reply #9 - Posted 2005-02-03 01:04:33 »

I'm moving under the disguise that I'm trying to learn how they work  Wink

But really, I'm just doing this in my free time, just for my own quasi-entertainement/satisfaction.  My entertainement values tell me that I should do it without OpenGL or anything else.  Just for the sake of making the game.

Call it a complete waste of my time, but I see it as fun.   Semi.  Wink  

Thx for the articles, I'll be sure to look into them.

Aut viam inveniam aut faciam - I will either find a way or make one
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline tom
« Reply #10 - Posted 2005-02-03 01:32:32 »

If you want to make a game you should just use OpenGL. If you are after entertainment then nothing beats creating your first rotating cube from scratch Smiley

Offline Sentient-Absence

Junior Newbie





« Reply #11 - Posted 2005-02-03 19:31:36 »

Yep, I've heard of the '3D rotating cube.'  Made one with solid polygons (because I have not much of an idea how to go about texture mapping ) Tongue  /  Embarrassed

But a complete game would provide so much more entertainement  Wink

Aut viam inveniam aut faciam - I will either find a way or make one
Offline darkprophet

Senior Member




Go Go Gadget Arms


« Reply #12 - Posted 2005-02-03 21:36:04 »

How did your particle system and matrix calculations go?

*Hint*, both names start with a D! Smiley

Anyways, to get you started off with 3D and OpenGL. I suggest you look at the neHe tutorials like previously suggested (http://nehe.gamedev.net), then if your seriously confused like I was, go and have a bash at jME (its a scene graph btw), so it should get you started onto making a game as fast as possible!

And i'l also be around to help ya with stuff too!

DP (or should i say digiwired?)


Friends don't let friends make MMORPGs.

Blog | Volatile-Engine
Offline Sentient-Absence

Junior Newbie





« Reply #13 - Posted 2005-02-03 22:26:50 »

ehh.... i dunno....
Particles, I sort of put off until later(is it supposed to be easy or hard?), and matrices;... well instead of using matricies directly I used trig functions, like
1  
2  
3  
        
camLoc.location.x -= distanceChange * camLoc.getCosAngleY();
camLoc.location.z += distanceChange * camLoc.getSinAngleY();

which might be better or worse than matricies (im guessing worse  Tongue).  

Aut viam inveniam aut faciam - I will either find a way or make one
Offline darkprophet

Senior Member




Go Go Gadget Arms


« Reply #14 - Posted 2005-02-04 22:46:40 »

really, matrices aren't as hard as everyone makes them out to be. Just grab a good book/site and just read the section. The hard part is knowing when to use them, but fortunetly, thats well documented on where and why you should use them.

About particle systems, i wouldnt' say easy, but i wouldn't say hard either. Somewhere in the middle verging on hard a likkle bit...Just start with a simple particle factory emitting simple dots, then build it up.

DP

Friends don't let friends make MMORPGs.

Blog | Volatile-Engine
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

xsi3rr4x (37 views)
2014-04-15 18:08:23

BurntPizza (33 views)
2014-04-15 03:46:01

UprightPath (48 views)
2014-04-14 17:39:50

UprightPath (31 views)
2014-04-14 17:35:47

Porlus (48 views)
2014-04-14 15:48:38

tom_mai78101 (69 views)
2014-04-10 04:04:31

BurntPizza (129 views)
2014-04-08 23:06:04

tom_mai78101 (229 views)
2014-04-05 13:34:39

trollwarrior1 (193 views)
2014-04-04 12:06:45

CJLetsGame (200 views)
2014-04-01 02:16:10
List of Learning Resources
by SHC
2014-04-18 03:17:39

List of Learning Resources
by Longarmx
2014-04-08 03:14:44

Good Examples
by matheus23
2014-04-05 13:51:37

Good Examples
by Grunnt
2014-04-03 15:48:46

Good Examples
by Grunnt
2014-04-03 15:48:37

Good Examples
by matheus23
2014-04-01 18:40:51

Good Examples
by matheus23
2014-04-01 18:40:34

Anonymous/Local/Inner class gotchas
by Roquen
2014-03-11 15:22:30
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!