Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: API from scratch instead of Java 2D or OpenGL (?)

  1. #1
    Junior Member
    Join Date
    Jan 2012
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default API from scratch instead of Java 2D or OpenGL (?)

    Hey everyone!

    I'm a beginner in Java, but have moderate programming skills. I want to program a basic game(engine) but don't have enough experience with Java 2D or OpenGL to really do what I want to do. So I thought about making my own API so I have full control and understanding over what's happening. But I have two questions regarding this:

    1) To make an API for graphics, is basic understanding about coloring individual pixels enough to get started?
    Because as far as I can figure, all that you would ever have to do is assign RGB and alpha values to an array of pixels, add or subtract them from other arrays to perform color/alpha blending and then draw the individual pixels from the final composite with a function that draws an individual pixel. Is this the proper way or a possible (basic) way to do this? Or is it far more complex than how I described it?

    2) Will custom/improvised API's for graphics inherently be less efficient than established ones like Java 2D and OpenGL?
    Are the functions that are accessible to me in a Java SDK enough to make a proper API? Or do the established API's make use of very sophisticated/inaccessible thingies that make them valid or more efficient to use as functional drawing tools?

    I hope you could all understand what I meant and I hope that some of you have some good answers for me!
    (...and I hope my use of the term 'API' is correct, lol.)

    Thanks for reading!
    Last edited by MrDropC; January 30th, 2012 at 04:25 PM.


  2. #2
    Forum Squatter newbie's Avatar
    Join Date
    Nov 2010
    Location
    North Wales
    Posts
    661
    My Mood
    Stressed
    Thanks
    28
    Thanked 115 Times in 106 Posts
    Blog Entries
    1

    Default Re: API from scratch instead of Java 2D or OpenGL (?)

    Phwoar...! Making your own extensive graphics library is so much more complex than assigning pixel values.
    I personally highly recommend you don't approaching this [read: create custom library] at the current time unless you're a math freak :p

    My thoughts on the 2nd topic would be as follows:
    • As far as Java 2D is concerned, I can only imagine it provides very little overhead as It's developed by Oracle.
    • JOGL does have some overhead through binding of JNI, but wouldn't be too noticeable for a small game.
    • I have no experience with Java 3D, so wouldn't be able to comment on that.


    There are plenty of examples for JOGL and Java2D out there, but you might have a slightly harder learning curve with JOGL.
    Please use [highlight=Java]//code goes here...[/highlight] tags when posting your code

  3. #3
    Junior Member
    Join Date
    Jan 2012
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: API from scratch instead of Java 2D or OpenGL (?)

    Thanks for your reply! I realize it's a few days old now but I haven't had much time to check this thread again and to thank you.

Similar Threads

  1. Custom GUI in j2me
    By thiruv in forum Java ME (Mobile Edition)
    Replies: 1
    Last Post: December 15th, 2011, 08:38 AM
  2. [SOLVED] Problem with OpenGL via LWJGL
    By paulo.carabuena in forum What's Wrong With My Code?
    Replies: 1
    Last Post: December 6th, 2011, 02:52 PM
  3. about making rubick with openGL
    By crimx in forum Java Theory & Questions
    Replies: 0
    Last Post: December 6th, 2011, 10:20 AM
  4. OpenGL Texture won't draw
    By nivangerow in forum Android Development
    Replies: 1
    Last Post: November 26th, 2011, 06:03 AM
  5. 3D picking in opengl
    By eshvartz in forum Java Theory & Questions
    Replies: 0
    Last Post: November 21st, 2011, 03:52 AM