Jump to content

  • Log In with Google      Sign In   
  • Create Account

Glass_Knife

Member Since 08 Aug 2001
Offline Last Active May 26 2016 09:51 PM

#5293652 how to chose open_gl libary?

Posted by Glass_Knife on 26 May 2016 - 01:46 PM

My latest OpenGL project, where I did all the graphics from scratch, used:

 

https://www.libsdl.org/ - SDL for window and input

https://github.com/nothings/stb - stb_image to save png files

http://glm.g-truc.net/0.9.7/index.html - glm library for math

http://glew.sourceforge.net/ - glew for loading the OpenGL version

 

I've had no problems with Windows, Linux, or Mac so far.  These things work well, but get out of your way and let you code.

 

As you learn more, you can replace these libraries with your own code if you really want to understand everything, but it's just too hard to start from scratch when you've never done this before.




#5293626 Can I write a browser game only using Java?

Posted by Glass_Knife on 26 May 2016 - 11:49 AM

 

Yes you can, using the built in Java Applet

 

 Please note that a lot of folks do not have Java enabled in their web browser.

 

I strongly advise against this. Java Applets are a huge security hole, not to mention the negative reputation they have. Much better just to go with LibGDX. Code everything in Java and deploy to HTML5/JS, Android, iOS, PC, Mac, Linux and who knows what else.

 

^^^ This

 

I wrote the book on Java game programming, and even I say don't try this.  Your time is better spent literally doing anything else.




#5293218 Spaghetti code

Posted by Glass_Knife on 24 May 2016 - 09:15 AM

I'm pretty sure the best "spaghetti" environments are:

  1. Matlab
  2. Visual Basic
  3. Javascript
  4. Simulink
  5. Labview

Sadly, you're only 5th.   :cool:




#5292390 How should I organize Java Classes?

Posted by Glass_Knife on 18 May 2016 - 06:56 PM

The exact details are unique to every project. Naming things is a hard problem in computer science.

 

The two hardest problems in computer science:

1. Naming things

2. Cache invalidation

3. Off-by-one errors

 

But seriously, with Java, there is a crazy convention with many libraries to have a com.org.package.module.ClassName.  Don't worry about it.  Do what Frob says, and learn how to search for classes, objects, methods, and instances with your IDE of choice.  That makes finding things very easy, no matter where you put them.




#5291768 Learning from Other's Code

Posted by Glass_Knife on 15 May 2016 - 10:22 PM

If you're reading other people's code, you will see stuff done in a way you've never seen it before.  Maybe it's a new algorithm, or C++ trick, or just understand how they structure their header files and code, resources, and build scripts.

 

If you are just copying other's code, you aren't learning anything.




#5291747 Learning from Other's Code

Posted by Glass_Knife on 15 May 2016 - 06:20 PM

Here's a good place to start:

 

http://fabiensanglard.net/




#5291128 A Brain Dump of What I Worked on for Uncharted 4

Posted by Glass_Knife on 11 May 2016 - 07:32 AM

Awesome thanks for sharing.  Would be nice to see this posted as an article.

 

Yes please, make it an article!  At least an overview pointing to the original if nothing else.  This post will get lost in all the complaining about Unity.




#5289589 Is making game with c possible?

Posted by Glass_Knife on 01 May 2016 - 11:00 AM

To play Devil's advocate, OOP isn't loved by everyone.

 

 

A lot of people think it is terrible.  They will say don't use C++ because it has objects.  But, as pointed out above, you can write C++ and not abuse OOP.

You need tons of games to find your style and figure out if it saves you time and energy and money, or it doesn't.

 

Don't worry about it.  Go write games.




#5288632 OOP and DOD

Posted by Glass_Knife on 25 April 2016 - 12:52 PM

 I think I've gotten a little confused about structuring my code. Code is never clean enough. So I spend much time refactoring and thinking of better ways to simplify code to make it easier to read later.

 

 

I fell into this trap when I first started writing code.  Things would look messy, sloppy, or seem like they could be refactored, redone, renamed, restructured, just to make the code better. Do you know what I learned from all this?  You can spend way too much time on this, when the code is never used again or read by anyone.  There are so many projects that I spent a lot of time on designing, testing, refactoring, and nurturing only to find that the project was canceled, requirements changed so the code wasn't needed, or I designed a generic, all-purpose solution and ended up only needing 10% of the features.

 

Many times I made a one-off program to do a little thing, and didn't worry about the structure and all, and those turned into multi-year projects.  That messy code at the beginning never really hurt me at all.  I just refactored or rewrote the ugly stuff once I knew what I really needed.

 

Bottom line, don't worry about the "right" way.  Right this very minute people are arguing that OOP is terrible and the reason all software is crap.  We don't know the "Right" way because its different for every project.




#5287790 OpenGL (Game) Engine

Posted by Glass_Knife on 20 April 2016 - 09:53 AM

 

 

Pick a simple game to create. Just building an engine is nebulous. I've done it before, and I just ended up working on cool features that never actually get used. Feature creep was particularly bad. You can definitely still create the engine, but just view it as reusable code for your game projects. You could make a game as simple as 3d pong.

GLFW is its own window and input manager. You will either have to pick one or the other. If you want to go with Qt then this might be useful
http://doc.qt.io/qt-5/qtgui-index.html

 

Thanks, i completely understand what your saying and i agree, but you didnt really answer most of my questions about the libraries. 

 

That post actually does answer your questions about GLFW -- "GLFW is its own window and input manager." It does provide an API to get the native window handle which you might be able to use to embed the window in some frameworks, but GLFW is primarily intended to create the main window of your application, i.e. if you're using GLFW, you aren't using QT or anything else. That's why I recommend you avoid it in the engine code.

 

 

^^^^^^ This.

 

I was thinking the same thing.  SDL and GLFW are the two popular cross-platform window managers.  They handle the interaction of the application with the operating system.  Windows, Keyboard, mouse, controllers, file system.  Also, they make it "easier" to get an OpenGL context.  These things are really hard to get right.  GLM is a library for math, and GLEW loads OpenGL extensions for you and checks versions.  These things don't make an engine.

 

The reason everyone around these forums says "Make games not engines" is because trying to start with an engine will only end in 99% of people giving up.

 

http://geometrian.com/programming/tutorials/write-games-not-engines/

 

We need new people to make games so we can play them.




#5281215 Why didn't somebody tell me?

Posted by Glass_Knife on 14 March 2016 - 09:50 AM

I know that Sean and I disagree on just about everything, except math.  It took me a long time to figure this stuff out on my own.  Don't let it be you.  Keep re-reading it until you stop saying "huh" and say "Oh".

 

http://seanmiddleditch.com/matrices-handedness-pre-and-post-multiplication-row-vs-column-major-and-notations/




#5280245 When you realize how dumb a bug is...

Posted by Glass_Knife on 08 March 2016 - 03:57 PM

Just when I think I've written all the dumbest bugs possible, and I'll never top myself, along comes Friday.

void some_func() {

   GLuint loc = glGetUniformLocation( program, "mvp" );
   SDL_assert( loc != -1 );

   // more code here...
}

Either it returns an unsigned int, or it doesn't.  Hm....

 

Ah, more context.  So I accidentally wrote

// in shader
mat4 mvp;

void main() { 
   // shader code
}

But what I really wanted was:

// in shader
uniform mat4 mvp;

void main() { 
   // shader code
}

By leaving off the "uniform" it was never getting set, which I would have caught if the return value was -1, which it never was, because unsigned int.  I hate programming some times...




#5279771 When you realize how dumb a bug is...

Posted by Glass_Knife on 05 March 2016 - 09:51 PM


But you probably shouldn't assert on that, as it might just have been optimized away...

 

When I'm testing algorithms, this is exactly the thing I don't want (because I've screwed up the shader)




#5279517 When you realize how dumb a bug is...

Posted by Glass_Knife on 04 March 2016 - 12:24 PM

Just when I think I've written all the dumbest bugs possible, and I'll never top myself, along comes Friday.


void some_func() {

   GLuint loc = glGetUniformLocation( program, "mvp" );
   SDL_assert( loc != -1 );

   // more code here...
}

Either it returns an unsigned int, or it doesn't.  Hm....




#5274131 When you realize how dumb a bug is...

Posted by Glass_Knife on 03 February 2016 - 05:26 PM

I just spend an hour to find a issue causing always a conditional check entering in the "then" scope despite the evaluation of the boolean expression... I just realized there was one too many semicolon...

	if( !CloseHandle( event ) );
	{
		throwFailure( GetLastError(), throwInfo );
	}

I was starting thinking I broke MS VS.... I hate waste time, especially when I am sick :|

 

You've just gained +5 development points in the programming skill-tree.






PARTNERS