How can I make 3D graphic in Java? [closed] - java

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
First, I'm new in Java.
Second, sorry for my English but I'm still learning it.
I need to create object in 3D space, which I would can manipulate from my mouse next.
I can make e.g. square like this:
public void paint(Graphics g){
super.paint(g);
((Graphics2D) g).setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
g.fillRect(50, 50, 40, 40);
}
But what I can do with that? In my opinion its only contour. Have Java special class for that?
I can use only awt;* and derivative from that. Is Canvas3D count to that?
Please, help me:)

I have used jogl in my projects

One possible option is to use JavaFX.
It involves complex math and requires Java8 and for you to understand the threading mechanism of Swing and JavaFX, but it seems the optimal option for 3D graphics implemented in Java.
It also integrates with Swing if you require or stands-alone.
Check Getting Started with JavaFX 3D Graphics
Check JavaFX Transformation overview.

I found this book helpful, it shows you how to create 3D graphics in Java from the ground up:
http://www.amazon.com/Computer-Graphics-Java-Programmers-Ammeraal/dp/0470031603

Related

2d collisions engine for irregular shapes formed with straight equations [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
Contex: I'm trying to make a 2d physic engine, i'm starting to think about how to draw shapes that i could rotate. So i thought i could draw irregular shapes by drawing lines from several equations of straight. Now i have some doubts:
There is a easy way of draw a straight by giving an equation?
There is a library that can help me to handle equations?
The reason to use equations instead of using functions to draw lines from x1,y1 to x2,y2 is that i want the equations to calculate collisions between shapes.
Do you know a book or an article that could help me pull this off?
I'm gonna work in java, for now this is just an idea.
Not an expert in this field but quick search on java 2d engine collision engine returns dyn4j library on the first page. You can explore their examples and consequently the implementation code.
https://github.com/wnbittle/dyn4j

Basic Graphics. Need help in drawing [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
I'm just beginning to learn basic graphics, particularly drawing, and I would like to ask for suggestions on how I draw animals such as this fox.
http://www.wikihow.com/images/2/2f/Draw-a-Fox-Step-9.jpg
Do I use polygons and hard code the whole drawing? Or is there a program that allows me to input the image in it and it outputs the x and y coordinates of all the vertices that I'd need in order to draw it? Basically, what I have to do is I'd draw that fox in Java but I have to draw it on my own using shapes. I'd have to start from scratch and work my way up until I recreate the fox using Java's shapes. Any suggestions how I do this?
When people want graphics like that in their games/applications, they usually create the files in other applications and then import the image files. There are many different application to create images in, but two of the popular ones are Photoshop and Illustrator. For a free application to create images, look into GIMP.
There are a variety of different files types you can use in almost all languages and platforms. For example, .png files are particularly useful because they can have transparency. For resolution independent images people often use .svn file format.
It is rare for anyone to have the program generate the images with polygons, unless you have some type of severe constraint, there is no reason to.
Look up how to load and display image files in the language and platform of your choice.
This block'll paint the fox:
#Override
public void paintComponent(Graphics g) {
super.paintComponent(g);
ImageIcon fox = new ImageIcon(new URL('http://i.stack.imgur.com/vJOsv.jpg'));
fox.paintIcon(this, g, x, y) // Replace x and y with the x/y coordinates
}

Starting flow free game development [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
I'm starting the developpement of a flow free game on android.
I'm a bit confused about the architecture design.
Should I use grids/tablelayout available on android framework or just draw my own objects by specifying the position and which object to draw.
I created classes for each object as : POINT, EMPTY, SQUARE.
I want to create a prototype like on those links :
http://forums.gamesalad.com/discussion/48641/my-flow-free-inspired-game-development-thread
For the moment, I don't have to design the IA, I just need to focus on the game architecture and physics.
Should I use grids/tablelayout available on android framework or just draw my own objects by specifying the position and which object to draw.
You shouldn't use grids/tablelayout.
For 2D games where you need performance, use OpenGL or take a look at the andengine library.
Since this is going to be a simple 2D game, you should look at Canvas. Take a look at Android Sample Project > TicTacToeLib and Android Sample Project > TicTacToeMain (you need to use them both toghether). The GameView inside TicTacToeLib shows you how to use Canvas in a game.
What you will see when you compile TicTacToeMain with TicTacToeLib:

Does any one know how to make alternative to Google recently start page in java swing? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
Has anyone idea how to make recently Google Search page in java swing?
Please take a look at http://www.google.com.
Nice effect :-)
If you wanted to do this in Swing, I would take the following approach:
Render the original screen to an offscreen BufferedImage
Render the new screen to an offcreen BufferedImage
Do an animated transition between the two by drawing the new screen then painting over it with the correct portions of the old screen, twisted and rotated to the right location (you can use the Java2D AffineTransformation for the rotating/twisting)
The tricky bit will be getting the position to change over time in a way that looks visually appealing and doesn't cause any nasty visual artefacts. This will take some maths and quite a bit of trial and error!

Roulette wheel rotating [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I'm trying to program a Roulette game for my capstone class. I've been trying to find a way to code the wheel but I'm new to java and have no idea how to start. I found paintComponent(Graphics g) method helps rotating my wheel image but not the way the wheel should spin. Is there any way I can do it, any articles that would give me an ideas how to start. Any help will be much appreciated.
This example shows how to rotate an arbitrary image. This Q&A may suggest how to rotate the text, if you create your own image at run-time.
Addendum: In helpful comments, #Robin recalls this example, as well as #camickr's pivotal article Rotated Icon. As the goal is to model a game of roulette with a rotating wheel view, the MVC pattern may prove useful.
Here's two great rotation libraries that have an out-of-the-box fling-to-spin behaviour
https://bitbucket.org/warwick/hg_dial_v2
https://bitbucket.org/warwick/hgdialrepo
And here's a gesture library that implements the above code.
https://bitbucket.org/warwick/hacergestov3

Categories

Resources