Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 13 Sep 2012
Offline Last Active Today, 04:34 PM

#5242782 Who wants to see a C replacement?

Posted by TheChubu on 26 July 2015 - 11:27 AM

think a pretty good indication of that fact is that the only languages on the planet with the notion of separate header files are C, C++ and COBOL, of all things. Hardly role-models for modern language design...

 And Ada! :D

#5240539 Help me to clear up my confusion about OpenGL

Posted by TheChubu on 15 July 2015 - 11:46 AM

What about Vulkan? Is it worth learning OpenGL right now? When is Vulkan coming out? Will it differ much from OpenGL? I read that it will be even more low level than OpenGL? Or would it be smarter to wait for it instead of deep diving into OpenGL right now?
There is a big initial learning curve for 3D, a big important chunk of it is API agnostic, this is linear algebra theory, rendering pipeline, etc. You'll still be using matrices in Vulkan, OpenGL or D3D, you'll still be rasterizing polygons in Vulkan, OpenGL or D3D, and so on.


There is no reason to artificially delay your learning, you'll be learning a lot for a lot of time, so you might aswell get started as soon as you can :)


In any case, the only good reason to start at that level is because you enjoy a lot that kind of coding or because its literally your job, if you don't feel like its your thing, you could always grab a framework/engine that does those things for you. It takes a lot of time to learn that stuff, so no problem if you feel you'd enjoy more coding something else.


As for how to make sure you're reading/using "modern" features, simply avoid anything that uses a "compatibility" profile. If they don't start with a "core" profile in OpenGL 3 or 4, skip it.


I dont care how easy is to draw a fullscreen triangle in OpenGL 1.1, that shit should die already.

#5239832 Why Do People Use DirectX?

Posted by TheChubu on 11 July 2015 - 06:57 PM

The third rule is that if you swear at people when doing your investigation, as to highlight your frustration regarding the fact that your obvious avenues are apparently not followed, then no one will take you seriously ;)
Hey! Why the fuck asking something is a perfectly reasonable way of finding out something. I ask why the fuck everything!

#5239398 Java ArrayList Remove. Synchronize?

Posted by TheChubu on 09 July 2015 - 08:32 PM

I'd use an ArrayBlockingQueue instead.


Producer (whatever generates your input events) puts stuff in, consumer (whatever translates events into actions) consumes the stuff you put in there. Straightforward enough.

#5239257 How Does Unreal Engine 4's Rendering Engine Stand Out

Posted by TheChubu on 09 July 2015 - 10:31 AM

Unreal engine's strength has historically been editors/tools, and being feature rich, not really the engine quality which was about avera
Whereas the ID Tech's strength has historically been the engine itself, not really the editors and tools :D (until recently apparently).

#5238880 BufferStrategy error

Posted by TheChubu on 07 July 2015 - 05:29 PM

Your 'render()' methd is static. It has no Canvas instance to call that "getBufferStrategy" on. So you're calling it from nowhere essentially. Thats why its telling you "getBufferStrategy isn't static, you can't call it from nowhere!" ( "nowhere" here being a static method context, like say, your 'render' method).

#5237916 Java Integer and Double memory question

Posted by TheChubu on 01 July 2015 - 05:12 PM

Exactly. Its syntax sugar.


When you do this:

Integer val = 23;


In reality the JVM will do this:

Integer val = Integer.valueOf(23);


If you look at the implementation of Integer.valueOf(int) you'll see the integer cache in action.


If you look at the implementation of Double.valueOf(double) you'll see that there is no cache for Double objects.


Have in mind that this depends on the JVM, in reality both Google's Android SDK (Apache Harmony libs) and OpenJDK do the same thing in this case. Moreover, different JVM installations could have different default cache sizes, you can even specify your own cache size in the application (look at how Integer's cache is initialized).


As always, you got the javadocs and the sources at your disposal to remove any doubt :)


In any case, I wouldn't use objects for holding primitive types. You pay 4 bytes for the reference size, 12 bytes of object instance overhead and +1/2/4/8 bytes for the primitive the object is holding. Moreover, references equal pointer indirections in the places the VM can't remove the object's allocation. And all objects need to occupy 8 byte aligned boundaries, so a Double instance will be 12 bytes overhead + 8 bytes for a double + 4 bytes for padding.


Thats why I don't use any fancy alternative JVM language, they tend to go with the "everything is an object route!" and numeric performance goes to hell.

#5237120 Does ArrayList, Iterator use affect heap memory?

Posted by TheChubu on 27 June 2015 - 11:32 AM

If you think it might be a problem, just use regular for loops.


for ( int i = 0; i < objArray.length; ++i ) {
    CreateObjVertices obj = objArray.get(i);
    obj.rotateObject(eAxis, Globals.cuboidRotAngle, midAxisLine);


And so on. Then again, it seems you're storing vertices/points in their own objects. That's going to have a much worse impact than any of those iterators. I'll give you an example on how HotSpot (desktop JVM) handles things. Dalvik should be similar.


For each object the JVM needs 12 bytes for internal stuff, also it aligns things to 8 byte boundaries. So if you have a "3d point" object, with 3 float fields, you'd have:


[12 bytes]

4 bytes for float x // 16 bytes to far.

4 bytes for float y // 20 bytes so far.

4 bytes for float z // 24 bytes so far.


AND you'll be paying an extra 4 bytes for each time you store a reference to that object (ie, pointer size). So you're bloating the heap. Use objects if you really need to encapsulate some behavior, if you have a bit more data for the object to hold or if you know you'll only have a few instances around.


Points and vertices don't really answer to any of those three. They don't have any behavior that can't be solved by static methods, they hold relatively very tiny data and you'll have thousands of them around.

#5236031 Do you comment Above or Below your code?

Posted by TheChubu on 21 June 2015 - 11:39 AM

I'm not a fan of "alongside" comments. So 90% of the time, every time my comments are above the code.

#5235926 Is OpenGL enough or should I also support DirectX?

Posted by TheChubu on 20 June 2015 - 03:41 PM

Khronos and the ARB (who went on to form the Khronos group for graphics), on the other hand, have historically not managed very well and are showing worrying signs of lapsing back in to the old habits which plagued OpenGL.
As in shutting up for 8 months and then delivering OpenGL 1.1 The Reckoning 2: Stateful API Awakens Again ? :D

#5233976 Int Vertex Attrib Array not passing

Posted by TheChubu on 09 June 2015 - 07:59 PM

You need to use glVertexAttribIPointer (the 'I' after Attrib stands for integer).


When you hand integer data to glVertexAttribPointer, it can either be normalized and converted to float or non-normalized and interpreted as float.


When handing integer data intended to be interpreted as integer data you use glVertexAttribIPointer instead.


More info here: https://www.opengl.org/sdk/docs/man3/xhtml/glVertexAttribPointer.xml

#5233386 Serialize Object to specific directory

Posted by TheChubu on 07 June 2015 - 11:43 AM

Should I set the directory on FileOutputStream fos = new FileOutputStream(filename); ??
Read the docs of FileOutputStream constructor then you tell us.



#5232252 An Open World Idea

Posted by TheChubu on 01 June 2015 - 04:39 PM

I had an idea for a game where players could explore a To-Scale Model of the Continental United States,
Well that sounds easy enough to do.

#5231739 Newb question on terrain rendering

Posted by TheChubu on 29 May 2015 - 03:18 PM

I'd argue OP is choosing a very artist driven example for his project. Blizzard has tons of artists, you don't, what works for them wont work for you. Skyrim was mostly sculpted by hand too for example (base Skyrim heightmap + more artist hours than you could count).


What you want as an example is things like Outerra, where they procedurally generate all these details, so you could find some heuristic to define what textures to use instead of having to edit a massive heightmap by hand.

#5230508 Game Programming from 0 or using already made game engine?

Posted by TheChubu on 22 May 2015 - 05:34 PM

I know that making a game in Unity would be much easier, but the game wouldn't be completely yours
OpenGL aint mine either but you don't see me complaining :D


I make a distinction:


Want to learn how to make a game? Start from the bottom (scratch, or some basic framework).

Want to make a game? Start with an engine.


Want both? Reduce the scope of the game as much as you can, have a try at it... and fail, rinse and repeat until you actually have a game.