Page 1 of 2 12 LastLast
Results 1 to 20 of 26
Like Tree5Likes

Thread: What is the Root class that draws to a Window using Graphics

  1. #1
    Join Date
    Aug 2014
    Posts
    8
    Rep Power
    0

    Exclamation What is the Root class that draws to a Window using Graphics

    I have been working with Java for a while and its swing components, however I want to make a 3D rasterizer called Rasterizer and implement my own Graphics context called Graphics3D as a subclass of Graphics. In order to do that, I need to understand exactly how Graphics works and how it draws to a JFrame/Window/Frame. I have been using my Eclipse IDE to search for which methods may be causing the Window or JFrame to paint, however obviously there is a native method somewhere that a certain class calls to actually paint to the Window which I cannot find. What might that class be hmmmmm? I also need to know how the abstract methods in Graphics are defined elsewhere as to the reason for why we can draw with them.

    My reason is that in knowing the class that paints to the Window, My Rasterizer can do the same, but with OpenGL definitions of those methods. And yes there is Java3D, I have seen that. That is what I will use to build the Rasterizer. While it has a Canvas3D, creating a 3D Graphics context will simplify things and it would be just like working with Graphics2D or Graphics.

    And while I'm at it, my reason for all this is to create a new OOP design for Minecraft, making it smaller, easier to understand (because the current code sucks), and more efficient.

  2. #2
    KevinWorkman's Avatar
    KevinWorkman is offline Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    3,963
    Rep Power
    8

    Default Re: What is the Root class that draws to a Window using Graphics

    Recommended reading: Lesson: Performing Custom Painting (The Java™ Tutorials > Creating a GUI With JFC/Swing)

    Quote Originally Posted by Link_The_Programmer View Post
    And while I'm at it, my reason for all this is to create a new OOP design for Minecraft, making it smaller, easier to understand (because the current code sucks), and more efficient.
    Minecraft uses OpenGL. That's a completely separate thing from regular painting in Java using the Graphics classes. Saying that you're going to start out programming by rewriting Minecraft using Graphics classes because "the code sucks" is like saying you're going to start working on cars by rebuilding a Ferrari using a Toyota Corolla engine because "Ferrari's engine sucks". I don't mean to be discouraging or negative, but what you're saying just isn't going to happen. Start smaller: think Pong instead of Minecraft.
    How to Ask Questions the Smart Way
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  3. #3
    Join Date
    Aug 2014
    Posts
    8
    Rep Power
    0

    Angry Re: What is the Root class that draws to a Window using Graphics

    Quote Originally Posted by KevinWorkman View Post
    Recommended reading: Lesson: Performing Custom Painting (The Java™ Tutorials > Creating a GUI With JFC/Swing)



    Minecraft uses OpenGL. That's a completely separate thing from regular painting in Java using the Graphics classes. Saying that you're going to start out programming by rewriting Minecraft using Graphics classes because "the code sucks" is like saying you're going to start working on cars by rebuilding a Ferrari using a Toyota Corolla engine because "Ferrari's engine sucks". I don't mean to be discouraging or negative, but what you're saying just isn't going to happen. Start smaller: think Pong instead of Minecraft.
    Umm "Minecraft uses OpenGL" ya no. Not my version that I specifically stated "I am making an OOP version of Minecraft" but I left out, "that will not be using OpenGL".

    Start smaller: think Pong instead of Minecraft.
    I already made pong -_-

    This is not helping me at all. I am not saying that just because the code sucks (which it does according to about 85% of people that I speak to), I'm rewriting it to make it BETTER. Also your analogy is not synonymous to what I'm doing. I'm sure you can see why now. Also, I've seen the unobfuscated, decompiled alpha code, and it does suck. See for yourself. I suggest giving me an answer than telling me what to do.

    I would like an answer please: http://stackoverflow.com/questions/2...ng-to-a-window

    And minecraft is not the sole reason for this, so with all due respect, I want an answer. Not critique.
    Last edited by Link_The_Programmer; 08-13-2014 at 06:20 PM.

  4. #4
    Join Date
    Aug 2014
    Posts
    8
    Rep Power
    0

    Default Re: What is the Root class that draws to a Window using Graphics

    might I add, I will no longer be using Java 3D for this Rasterizer, I will be using a purely Java approach. see my stack over flow question at one of my comments to know why. Sad that I had to answer my own question there, so I came here for additional help. Perhaps someone can explain what in awt.dll is painting to the window?

    java - What is the "secret" behind Graphics drawing to a window? - Stack Overflow

  5. #5
    KevinWorkman's Avatar
    KevinWorkman is offline Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    3,963
    Rep Power
    8

    Default Re: What is the Root class that draws to a Window using Graphics

    Quote Originally Posted by Link_The_Programmer View Post
    Umm "Minecraft uses OpenGL" ya no. Not my version that I specifically stated "I am making an OOP version of Minecraft" but I left out, "that will not be using OpenGL".
    I told you that Minecraft uses OpenGL so that you don't go barking up the wrong tree. It's certainly possibly to do basic game animations using Java2D and the Graphics class, but it's going to be inherently slower than anything that uses OpenGL.

    In fact, it's going to be next to impossible to do *anything* in 3D without using OpenGL or some other native equivalent.

    I'm not telling you this to discourage you. I'm telling you this so you have a better idea of the reality of your goals.


    Quote Originally Posted by Link_The_Programmer View Post
    I already made pong -_-
    Okay, then your next step should be something like breakout, or a shmup, or some other 2D game. Going from Pong to trying to recreate Minecraft using your own 3D render just isn't going to happen.

    Quote Originally Posted by Link_The_Programmer View Post
    This is not helping me at all. I am not saying that just because the code sucks (which it does according to about 85% of people that I speak to), I'm rewriting it to make it BETTER.
    How exactly are you planning on making it better? By "making it OOP"? How many big projects have you worked on? It's a common pitfall for novices to bite off more than they can chew, and that is definitely what's happening here. Again, I'm not telling you that to insult or discourage you. I'm just telling you that you need to start much smaller.

    Quote Originally Posted by Link_The_Programmer View Post
    Also your analogy is not synonymous to what I'm doing. I'm sure you can see why now.
    I do not.

    Quote Originally Posted by Link_The_Programmer View Post
    Also, I've seen the unobfuscated, decompiled alpha code, and it does suck.
    Hahaha. First off, unobfuscating and decompiling code does not give you the original code. Secondly, alpha code is meant to suck, sorta like a first draft of a paper. Third, what exactly does "suck" mean in this case? Even if it does "suck", many large projects make capitulations for increased efficiency, unintended features, etc. Novice programmers are hardly in the position to offer criticism of code that works.

    Quote Originally Posted by Link_The_Programmer View Post
    I suggest giving me an answer than telling me what to do.
    You really need to think about adjusting your attitude. I have not tried to be insulting, so I'm not sure why you've become so defensive. What you're doing is a common pitfall that many novices fall into and don't get out of, and the best way I know to help you is by helping you see the reality of your goals. They aren't going to happen with your current approach.

    Quote Originally Posted by Link_The_Programmer View Post
    I'll get right on that. It looks like other people have already told you the answer: reinventing the wheel is an exercise in futility. But it looks like you're reacting to that feedback in the same way you've reacted to me.

    Quote Originally Posted by Link_The_Programmer View Post
    And minecraft is not the sole reason for this, so with all due respect, I want an answer. Not critique.
    Good luck.
    How to Ask Questions the Smart Way
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  6. #6
    Join Date
    Aug 2014
    Posts
    8
    Rep Power
    0

    Cool Re: What is the Root class that draws to a Window using Graphics

    Quote Originally Posted by KevinWorkman View Post
    I told you that Minecraft uses OpenGL so that you don't go barking up the wrong tree. It's certainly possibly to do basic game animations using Java2D and the Graphics class, but it's going to be inherently slower than anything that uses OpenGL.

    In fact, it's going to be next to impossible to do *anything* in 3D without using OpenGL or some other native equivalent.

    I'm not telling you this to discourage you. I'm telling you this so you have a better idea of the reality of your goals.




    Okay, then your next step should be something like breakout, or a shmup, or some other 2D game. Going from Pong to trying to recreate Minecraft using your own 3D render just isn't going to happen.



    How exactly are you planning on making it better? By "making it OOP"? How many big projects have you worked on? It's a common pitfall for novices to bite off more than they can chew, and that is definitely what's happening here. Again, I'm not telling you that to insult or discourage you. I'm just telling you that you need to start much smaller.



    I do not.



    Hahaha. First off, unobfuscating and decompiling code does not give you the original code. Secondly, alpha code is meant to suck, sorta like a first draft of a paper. Third, what exactly does "suck" mean in this case? Even if it does "suck", many large projects make capitulations for increased efficiency, unintended features, etc. Novice programmers are hardly in the position to offer criticism of code that works.



    You really need to think about adjusting your attitude. I have not tried to be insulting, so I'm not sure why you've become so defensive. What you're doing is a common pitfall that many novices fall into and don't get out of, and the best way I know to help you is by helping you see the reality of your goals. They aren't going to happen with your current approach.



    I'll get right on that. It looks like other people have already told you the answer: reinventing the wheel is an exercise in futility. But it looks like you're reacting to that feedback in the same way you've reacted to me.



    Good luck.

    Well thanks anyways.

    It's a common pitfall for novices to bite off more than they can chew, and ...
    I'm not a novice Java programmer whatsoever, despite my age. A novice does not keep up with Java seriously for 4 years since he was 10 yrs old.

  7. #7
    Join Date
    Aug 2014
    Posts
    8
    Rep Power
    0

    Default Re: What is the Root class that draws to a Window using Graphics

    Might I add that you mention its next to impossible to do anything without openGl, well no, you're quite wrong about that. All you need is math, and you can mimic what OpenGL or Direct3D does, slower or not. I will program how I wish, and that is exactly what I want. Also, stackoverflow gave me an answer. I guess now its safe to say that Java-Forums are not a reliable source for answers, just critique and discussion, and the fact that people jump to the automatic conclusion that every new forum member is a "novice". :L

  8. #8
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    4,029
    Rep Power
    6

    Default Re: What is the Root class that draws to a Window using Graphics

    Well, I'm glad it wasn't me who got the festering asshole this week.
    KevinWorkman and DarrylBurke like this.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  9. #9
    KevinWorkman's Avatar
    KevinWorkman is offline Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    3,963
    Rep Power
    8

    Default Re: What is the Root class that draws to a Window using Graphics

    Quote Originally Posted by Link_The_Programmer View Post
    Well thanks anyways.
    I know you're being flippant, but I really am trying to help you. The best way I know how to do that is to warn you that your goals aren't reasonable, that way you can hopefully adjust them. I was hoping to get into an interesting conversation about the options you have available to you for rendering these types of graphics, but instead you became defensive and rude. That type of attitude won't get you very far as a programmer, but I wish you luck nonetheless.

    Quote Originally Posted by Link_The_Programmer View Post
    I'm not a novice Java programmer whatsoever, despite my age. A novice does not keep up with Java seriously for 4 years since he was 10 yrs old.
    The types of questions you're asking, and the way you're asking them, tell me more about you than your registration date. I have nothing against novices (in fact they're my favorite type of programmer), but your approach to not only programming but also to basic human contact won't get you very far.

    Quote Originally Posted by Link_The_Programmer View Post
    Might I add that you mention its next to impossible to do anything without openGl, well no, you're quite wrong about that. All you need is math, and you can mimic what OpenGL or Direct3D does, slower or not.
    Again, saying "all you need is math" is really missing the point. All you need is math to get to the moon too, but you don't see a lot of novice mathematicians building rockets. There are ways to approach this problem, and I was looking forward to discussing them, but doing this all using the Graphics class is certainly not one of them.

    Good luck though. And when you realize that it's not going to happen, let us know, and we'll try to help you build something smaller.
    How to Ask Questions the Smart Way
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  10. #10
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,014
    Rep Power
    20

    Default Re: What is the Root class that draws to a Window using Graphics

    "All you need is math(s)"

    Didn't the Beatles do a song about that?
    KevinWorkman and DarrylBurke like this.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  11. #11
    KevinWorkman's Avatar
    KevinWorkman is offline Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    3,963
    Rep Power
    8

    Default Re: What is the Root class that draws to a Window using Graphics

    ALL YOU NEED IS MATH would make a pretty sweet t-shirt...
    How to Ask Questions the Smart Way
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  12. #12
    jim829 is offline Senior Member
    Join Date
    Jan 2013
    Location
    Northern Virginia, United States
    Posts
    3,616
    Rep Power
    5

    Default Re: What is the Root class that draws to a Window using Graphics

    Four years of java. So you are an intermediate novice. And 14 years old. That explains a lot about your attitude.

    Regards,
    Jim
    The Java™ Tutorial | SSCCE | Java Naming Conventions
    Poor planning our your part does not constitute an emergency on my part.

  13. #13
    Join Date
    Aug 2014
    Posts
    8
    Rep Power
    0

    Thumbs up Re: What is the Root class that draws to a Window using Graphics

    Quote Originally Posted by jim829 View Post
    Four years of java. So you are an intermediate novice. And 14 years old. That explains a lot about your attitude.

    Regards,
    Jim
    Excuse me for my attitude that day, I was not in the best of moods. However, I reasonably had hoped for an *answer* not *alternatives*. Need I say more?

    Secondly moreover, I would like to apologize to Kevin because he was the victim of my mood.

    Quote Originally Posted by KevinWorkman
    Again, saying "all you need is math" is really missing the point. All you need is math to get to the moon too, but you don't see a lot of novice mathematicians building rockets. There are ways to approach this problem, and I was looking forward to discussing them, but doing this all using the Graphics class is certainly not one of them.
    Novice mathematicians may not be building them for they say "nope. too early" or they *just dont want to* or because they *think* they can't. It's not like in math class you are restricted from going straight into Chapter 9 when you just started. If you don't understand something in Chp 9, then learn it. Even a novice mathematician has just barely enough skills to get measurements, with plenty of trial and error along the way. And they aren't the ones building the rockets, or making the parts, they are just the `Designer` that creates the constructor for a `Rocket`(blueprints) and the `RocketPart`s are forged by a `Factory`, and assembled on the `RocketAssemblyLine` with the specified parts for parameters. Technically I could have just made a program out of what I just said, but I have other business to attend to.

    However, my goals are set, so alternatives are out of the question. I expected an answer, not a conversation.

    Quote Originally Posted by KevinWorkman
    I know you're being flippant, but I really am trying to help you. The best way I know how to do that is to warn you that your goals aren't reasonable...
    Humans are not vulcans. If you're Spock, then I'm Captain Kirk.
    "That is highly illogical captain. May I suggest that-"
    "Yes I know Spock, but logic isn't always the answer"

    Quote Originally Posted by KevinWorkman
    Good luck though. And when you realize that it's not going to happen, let us know, and we'll try to help you build something smaller.
    Anything is possible. The realization is now unreachable code.

    1 quick fix available:
    remove unreachable code

    Thanks, but I don't need luck. Ever. Just the internet, Java, and Eclipse Luna. And a programmer or two to help from time to time.


    Also, if 4 years is still novice, then what the heck is 8 yrs!? Expert novice? You can't call a novice an expert!


    I'm not here to brag, but I learn a lot faster than the average person. I could guess I've accumulated 5 years worth of knowledge? I probably would know double the information if I didn't have school. That is the only way I could be ever faster. Now with highschool, I can program in the classroom, which is great for me, as well as I learn even faster because its the Academy of Information Technology and Robotics. FoundOfProgramming is what they call it on the schedule. I hope I can skip ahead or I may have a repeat of last year. Ugh. Last year. I'm sad again.

  14. #14
    KevinWorkman's Avatar
    KevinWorkman is offline Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    3,963
    Rep Power
    8

    Default Re: What is the Root class that draws to a Window using Graphics

    Quote Originally Posted by Link_The_Programmer View Post
    It's not like in math class you are restricted from going straight into Chapter 9 when you just started. If you don't understand something in Chp 9, then learn it.
    You say that like the stuff in chapter 9 doesn't depend on the stuff in chapter 8, which depends on chapter 7, etc. The questions you're asking depend on information that we're trying to give you, but you refuse to listen to. I'm not sure how you expect to learn with that approach.

    Quote Originally Posted by Link_The_Programmer View Post
    However, my goals are set, so alternatives are out of the question. I expected an answer, not a conversation.
    Just a little piece of advice: you might want to think about how your words are coming across to the people reading them. We're all volunteers who hang out on the forum in our spare time in the hopes that we can help someone learn something. So saying things like "I expect this" comes off as pretty rude. You've been told that the answer to your question is native code, and that anything involving 3D will require something like OpenGL so you have access to the GPU. If that's not what you're looking for, then ask a more specific technical question.

    Quote Originally Posted by Link_The_Programmer View Post
    Humans are not vulcans. If you're Spock, then I'm Captain Kirk.
    "That is highly illogical captain. May I suggest that-"
    "Yes I know Spock, but logic isn't always the answer"
    That's all well and good in a fictional plot, but you're talking about real life programming here. You can't have programming without logic.

    Quote Originally Posted by Link_The_Programmer View Post
    Thanks, but I don't need luck. Ever. Just the internet, Java, and Eclipse Luna. And a programmer or two to help from time to time.
    I remember that feeling.

    Quote Originally Posted by Link_The_Programmer View Post
    Also, if 4 years is still novice, then what the heck is 8 yrs!? Expert novice? You can't call a novice an expert!
    There really isn't a hard line between "novice" and "expert", but the attitudes you've shown so far, along with the questions you're asking, hint that you're more of a novice than you might realize. (Rhetorical questions: How many big projects have you worked on? How many of those did you finish? What types of Java technologies have you used?) And there's nothing wrong with that. We're just trying to help you realize that your goals are non-trivial.

    Quote Originally Posted by Link_The_Programmer View Post
    I'm not here to brag, but I learn a lot faster than the average person.
    Haha, okay.

    You might also want to check out the Java Gaming forum, I'm sure they'd love to hear about your new 3D renderer and Minecraft killer: Java-Gaming.org - home of the largest java game developer community
    How to Ask Questions the Smart Way
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  15. #15
    jim829 is offline Senior Member
    Join Date
    Jan 2013
    Location
    Northern Virginia, United States
    Posts
    3,616
    Rep Power
    5

    Default Re: What is the Root class that draws to a Window using Graphics

    Quote Originally Posted by KevinWorkman View Post
    We're all volunteers who hang out on the forum in our spare time in the hopes that we can help someone learn something.
    Now you tell me! I guess I had better stop waiting for my paycheck.

    Regards,
    Jim
    KevinWorkman likes this.
    The Java™ Tutorial | SSCCE | Java Naming Conventions
    Poor planning our your part does not constitute an emergency on my part.

  16. #16
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,014
    Rep Power
    20

    Default Re: What is the Root class that draws to a Window using Graphics

    Quote Originally Posted by Link_The_Programmer View Post
    Also, if 4 years is still novice, then what the heck is 8 yrs!? Expert novice? You can't call a novice an expert!
    A talented amateur?
    Hate to say this, but you could do this for 20 years, but until you do this as a job then "talented amateur" is about the best you're going to get, IMO.
    Information is only a part of the equation.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  17. #17
    jim829 is offline Senior Member
    Join Date
    Jan 2013
    Location
    Northern Virginia, United States
    Posts
    3,616
    Rep Power
    5

    Default Re: What is the Root class that draws to a Window using Graphics

    Quote Originally Posted by Link_The_Programmer View Post
    Also, if 4 years is still novice, then what the heck is 8 yrs!? Expert novice? You can't call a novice an expert!
    A nugget from my Dad. In algebra, x is an unknown quantity. And a spurt is a little drip. So an expert is an unknown little drip.

    Regards,
    Jim
    Last edited by jim829; 08-18-2014 at 04:19 PM.
    The Java™ Tutorial | SSCCE | Java Naming Conventions
    Poor planning our your part does not constitute an emergency on my part.

  18. #18
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    4,029
    Rep Power
    6

    Default Re: What is the Root class that draws to a Window using Graphics

    Quote Originally Posted by jim829 View Post
    A nugget from my Dad. In algebra, x is an unknown quantity. And a spurt is a litter drip. So an expert is an unknown little drip.
    ...

    Say what!?
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  19. #19
    jim829 is offline Senior Member
    Join Date
    Jan 2013
    Location
    Northern Virginia, United States
    Posts
    3,616
    Rep Power
    5

    Default Re: What is the Root class that draws to a Window using Graphics

    Apparently, in spite of my spelling, an ill-fated attempt at humor.

    Regards,
    Jim
    The Java™ Tutorial | SSCCE | Java Naming Conventions
    Poor planning our your part does not constitute an emergency on my part.

  20. #20
    Join Date
    Aug 2014
    Posts
    8
    Rep Power
    0

    Talking Re: What is the Root class that draws to a Window using Graphics

    Quote Originally Posted by KevinWorkman
    You might also want to check out the Java Gaming forum, I'm sure they'd love to hear about your new 3D renderer and Minecraft killer: Java-Gaming.org - home of the largest java game developer community
    Thanks kev. :D

Page 1 of 2 12 LastLast

Similar Threads

  1. how to place a graphics window
    By Snake006 in forum New To Java
    Replies: 1
    Last Post: 06-16-2014, 12:08 AM
  2. A window pops up, but no graphics
    By MW130 in forum New To Java
    Replies: 1
    Last Post: 01-07-2014, 08:58 AM
  3. Centering graphics on the graphics window
    By janyc71876 in forum New To Java
    Replies: 5
    Last Post: 11-25-2013, 07:25 PM
  4. Replies: 9
    Last Post: 07-28-2011, 10:05 AM
  5. Scrollbar on graphics output window
    By ann123 in forum AWT / Swing
    Replies: 3
    Last Post: 06-27-2009, 08:47 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •