Home » Newcomers » Newcomers » 3d Shape Class(How to write a class for a 3d cube.)
3d Shape Class [message #1768257] |
Sun, 16 July 2017 00:38  |
Eclipse User |
|
|
|
Hi my name is Paul and not only am I new to Java, I am also new to programming all out. So I am sorry if I'm asking a very elementary question.
I am trying to figure out how to write a class for a 3d cube. I can not figure out how and where you're suppose to write the code for the vertices and nodes. This is what I have written and it's completely wrong so far.
package shapes;
public class CubeMain extends Object {
//Fields
private int nodes;
private int edges;
//Constructors
public CubeMain() {
int nodes = x,y,z,w,h,d;
nodes = x,y,z,
x,y,z+d,
x,y+h,z,
x, y+h, z+d,
x+w, y, z,
x+w, y, z+d,
x+w, y+h, z,
x+w, y+h, z+d;
}
//Methods
}
|
|
| |
Re: 3d Shape Class [message #1768280 is a reply to message #1768262] |
Sun, 16 July 2017 15:20  |
Eclipse User |
|
|
|
Paul,
As you are new to programming, it's very easy to understand your mistake, so let me try and explain what's going on.
By analogy, you've stumbled into a power tools seminar and you're asking a table saw vendor "How do I build a 2-story colonial home with aluminum siding?". The table saw vendor doesn't know, and is confused why you're asking him.
Eclipse is a tool, like a hammer or saw, that can be used to do many things, including write programs, including writing programs in java, and including writing programs in java that do graphics.
Your question is about using java, probably with OpenGL or LWJGL, to write a program to draw a cube.
Since your question has to do with java programming, it's not an eclipse question. Beyond that it's a library-specific question (how do I put a cube on the screen) so it's not really a java question either. You need to find a forum (such as at opengl.org or lwjgl.org) which will have people more likely to have experience aligned with your question.
Allow me to further recommend searching "opengl java tutorial" in Google and Youtube for more information.
Good luck, sir!
-Jeff
|
|
|
Goto Forum:
Current Time: Mon Mar 17 15:13:01 EDT 2025
Powered by FUDForum. Page generated in 0.07081 seconds
|