Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (498)
Games in Android Showcase (115)
games submitted by our members
Games in WIP (562)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
   Home   Help   Search   Login   Register   
  Show Posts
Pages: [1]
1  Game Development / Newbie & Debugging Questions / Re: some Garbage Collection and LWJGL memory managment questions on: 2013-09-07 15:47:49
Haha the reason I asked the third question was because I was far into my game and realized I forgot to give all the objects a delete function since then I have taken the time to add them to avoid weird errors that redocam mentioned thanks for all the information guys
2  Java Game APIs & Engines / OpenGL Development / Re: Cube is rendering faces out of order! on: 2013-09-02 05:40:41
I suggest atleast starting with vertex arrays, or VBOs

google:

vertex buffer objects

or

vertex arrays

also:

glprogramming.com/red/

(a little outdated but much better than immediate mode)
3  Java Game APIs & Engines / OpenGL Development / Re: Cube is rendering faces out of order! on: 2013-09-02 05:37:30
This form of OpenGL rendering is very, very deprecated.

anyway add

glEnable(GL_DEPTH_TEST);


with your init calls and make sure your


   glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

edit: beat me to it Smiley still make sure your glClear is right
4  Game Development / Newbie & Debugging Questions / some Garbage Collection and LWJGL memory managment questions on: 2013-09-01 06:55:14
Hi i have a couple questions in regards to the stuff i mentioned in the title.

Question 1:

First if i do something like

1  
2  
3  
int vboID = GL15.glGenBuffers();
...
vboID = GL15.glGenBuffers();

would it create a memory leak?

Question 2:

I've heard a couple times that if you set big objects (such as large floatbuffers) to null after you are done using them it can speed up the java GC is this true?

and lastly,
Question 3:

in some of my lazy test code i don't delete my VBOs, VAOs, Textures, etc. at the end of the program. Ive always assumed that the OS would handle the memory deallocation like it would on regular non-openGL CPU based programs. Does the OS or the actual graphics card handle this? Or could this lead to potential problems. If it does handle it, then why bother deleting everything at the end of a program?

I know that's a lot of questions, if you happen to know any answers they would be appreciated Smiley

thanks in advance
5  Discussions / General Discussions / Re: jME: What's the Catch? on: 2013-08-27 05:44:08
When getting a Computer Science degree you must take some ASM classes. Now most people out of college will never touch ASM again for practical purposes, but what you get out of it is increased knowledge of what goes on in the computer when you press compile and run which can then be used to optimize a higher language code.

This can translate back to choosing between writing a game engine or using someone elses. Chance are any engine you write wont be as powerful as one like jMe, much as a beginners assembly code wont be nearly  as fast and efficient as that created by the compiler, but it will be a good learning experience that may help you understand the underlying processes of the game engine you are using, and help you use them better.

Understanding you tools, though not necessary, can help you implement them better.
6  Game Development / Game Mechanics / Re: [LibGDX] Calling LWJGL/OpenGL glBegin on: 2013-08-14 16:11:19
make sure your alpha blend in enabled and i would assume you would want to use 1f, 1f, 1f for your rgb's since 0f, 0f, 0f is black.
 
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
         Gl11.glEnable(GL11.GL_BLEND);
         GL11.glBegin(GL11.GL_TRIANGLE_FAN);
           {
           
             GL11.glColor4f(1f, 1f, 1f,  intensity);
             GL11.glVertex3f(center.x,center.y, 0f);
               
             GL11.glColor4f(1f, 1f, 1f, 0f);
               
             for (float angle=0; angle<=Math.PI*2; angle+=((Math.PI*2)/subdivisions) )
             {
               GL11.glVertex3f( radius *(float)Math.cos(angle)+ center.x,
                              radius * (float)Math.sin(angle)+ center.y, 0);  
             }
               
             GL11.glVertex3f(radius + center.x, center.y, 0);
           }
             GL11.glEnd();


keep in mind that this method of rendering has been deprecated for a long time. with lower subdivisions it will look a little weird that's because the alpha is blended for each triangle separately making the fact that there are many different triangles apparent

edit: Just realized your talking about using LWJGL through LibGDX. dunno how you would do this in LibGDX this is just the straight LWJGL way to do it. If it exists in LibGDX i would assume it would be very similar to the above code though
7  Game Development / Newbie & Debugging Questions / Re: Is it bad practice to use the super class as a parameter. on: 2013-08-14 05:49:16
Ok i understand now Smiley, and yes that's the point of polymorphism so that is the right way to do it
8  Java Game APIs & Engines / Java 2D / Re: Efficiency in custom Map Editor - Swing or Graphics drawing? on: 2013-08-14 02:25:20
Whole point of using a JPanel is for the Swing functionality. Using a BufferedImage instead is like writing your own GUI system.

ah Ok i see where you are coming from, you are right in your own sense, but i hope you see where i'm coming from too. Also using more concrete JLabels/JPanels or a table of bufferedimages would work almost the same way which is why i mentioned it. i didnt mean cut all the scrollpane and all.
9  Java Game APIs & Engines / Java 2D / Re: Efficiency in custom Map Editor - Swing or Graphics drawing? on: 2013-08-14 02:19:25
Don't worry about efficiency too much while it's still in early development, especially since this is just a tool and not the actual game. Anyways, I don't know too much about this, but I highly doubt overriding it would be more efficient than setting it.

@Simba Productions -
That's completely off topic. He's asking about efficiency.

My question: is using Swing components like this the most efficient way of doing this?

Imho i thought drawing onto a buffered image and cut all the extra JPanels would save memory and make the program run faster, which (using Java2D) is a more efficient way of "doing this". due to the fact that its a big change from what he is doing now it could be a little too much of a change but my answer answers the question, i believe, so it isn't "completely" off topic.
10  Java Game APIs & Engines / Java 2D / Re: Efficiency in custom Map Editor - Swing or Graphics drawing? on: 2013-08-14 02:11:54
You could use a table of BufferedImage in one JPanel (instead of the jLabels), and compare speeds, or you could just create one large BufferedImage in your JPanel and just draw onto it in memory.
11  Game Development / Newbie & Debugging Questions / Re: Is it bad practice to use the super class as a parameter. on: 2013-08-14 02:00:13
Since a subclass has all the variables and methods of the superclass (though it can not necessarily access all of them) you could always use "this" instead of super which is much better practice.

I had a hard time understanding what you were trying to do with your "statecheck" function or where that function is, but maybe try putting that function in life forms or use lots of is-accessors such as "isPoisened()" in the super class and have them return booleans, and maybe interfaces like "poisonable" if not every life form can be poisoned for example.

The later way would be the most correct for a object-oriented language, but using this instead of super should suffice.
12  Game Development / Game Mechanics / Re: Ray - 3d triangle intersection test on: 2013-08-12 21:24:12
I'm still shaky on vectors so I didnt feel confident trying to find a mistake in your code.

I thought up another way to do it, by using 2D ray-plane intersection test 3x so that it would work for a 3D object

If you arent interested in another way to do it, i dont blame you, your way seems a lot more "correct" than mine and is probably more efficient, but anyway heres how i would do it

{
a triangle is made up of 3 points with x,y,z coordinates. a ray is just a line that is infinite in one direction.

first, i would take the x,y components of every one of the points in the triangle and break the triangle up into three lines. check if the ray intersects any of these 3 lines (once it intersects one move on to the next step ). In other words imagine flattening out the 3D object into 2D. If the line intersects it in 3D it must intersect it in 2D as well no matter which way you look at it.

second, take the y,z components of the lines of the triangles and ray, do it again.

third, x,z check intersections again.

if it intersects on every plane then the ray intersects the triangle. Again im not saying this way is "fast" or "correct". Its just the way i would do it. shouldn't kill performance too bad unless you are checking a ton of triangles.

You need to figure out an algorithm to see if two lines intersect. There are many, google is your friend.

there are also many algorithms that can quickly check if the ray even has a chance of intersecting the triangle.

Hope that wasn't too stupid an algorithm, I made that up off the top of my head when i read the title of this thread, though it will work i don't know if it'll be too fast.
}

Good Luck!
13  Game Development / Game Play & Game Design / Re: Switching from LibGDX to LWJGL good choice? on: 2013-08-12 18:21:57
I program using model opengl (4.x with 3.x shaders) using LWJGL.

Creating your first big game/ useful game engine is a long and grueling process, but it is also very rewarding.

In terms of the game you create, it will take you a long time of learning and a ton of code to create a game that even closely compares to the things you can probably make easily in LibGDX, so it all depends on where you want to take yourself.

If you just want to work on games and focus on the higher aspects of the game (the characters/storyline) then don't bother going to LWJGL it would not be worth it for a long time, but if you want to simply learn more about programming, are very interested in game mechanics, and if you like math/physics then LWJGL can teach you a lot and once you get over the steep learning curve it can become very rewarding.
Pages: [1]
 

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

The first screenshot will be displayed as a thumbnail.

radar3301 (9 views)
2014-09-21 23:33:17

BurntPizza (28 views)
2014-09-21 02:42:18

BurntPizza (18 views)
2014-09-21 01:30:30

moogie (20 views)
2014-09-21 00:26:15

UprightPath (27 views)
2014-09-20 20:14:06

BurntPizza (29 views)
2014-09-19 03:14:18

Dwinin (46 views)
2014-09-12 09:08:26

Norakomi (74 views)
2014-09-10 13:57:51

TehJavaDev (102 views)
2014-09-10 06:39:09

Tekkerue (50 views)
2014-09-09 02:24:56
List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
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!