Jump to content

  • Log In with Google      Sign In   
  • Create Account

We need your feedback on a survey! Each completed response supports our community and gives you a chance to win a $25 Amazon gift card!


Member Since 28 Feb 2012
Offline Last Active Dec 16 2014 09:32 AM

#5174762 Where to start (kind of)

Posted by Aliii on 19 August 2014 - 10:50 AM

"Building my own engine for the sake of building my own engine" would not be a very good idea. If you mean "start making small games with the focus on components and code reusability" thats better. But you have to finish things, not just always be working on something  - like an engine - or you will lose motivation soon. ...even if you have a lot of it now.

#5173786 Avoiding unnessecary if/else choice in loop for Virtual Camera

Posted by Aliii on 14 August 2014 - 11:05 PM

If you are concerned about branch misprediction put the less likely case into the "else" block. But things that are done once-per-frame usually have no effect on performance, I would choose the solution that gives the cleanest code.

#5173268 glDrawElements isn't drawing anything

Posted by Aliii on 12 August 2014 - 10:48 PM

You cant just replace it with DrawArrays, they work differently. DrawArrays needs a vertex buffer(or more), DrawElements also needs an index buffer.



#5151675 Replacing glMultMatrixd with Shaders ...

Posted by Aliii on 05 May 2014 - 01:20 PM

He said that you multiply the matrices on CPU side once per every mesh/model. ...then upload it to the shader in an uniform, ...so you dont have to do the PVM = M * V * P per every single vertex(in the shader).

If you have 1000 vertices that would mean 1000 of this: PVM = P * V * M.


(but dont worry about this, unless you are about to finish your game. That is not much work for the GPU. Doing the same thing on the CPU - doing software rendering - would result in very low framerate with a 4-8MB mesh.)

#5151584 Replacing glMultMatrixd with Shaders ...

Posted by Aliii on 05 May 2014 - 05:14 AM

I didn't see an exact tutorial online or writeup on how to replace the glMultMatrixd functionality in shaders as I searched


glMultMatrixd is just one of the many deprecated functions. It wouldnt make sense to make tutorials separately for every single one.

On the other hand, there are very good tutorials on shaders. For-dummies and advanced ones.

(+if you switch to shaders you cant replace all the functions one-by-one and still have your stuff rendered properly, if thats what you mean. Also it would help if you would ask more direct questions:))






You replace glMultMatrix with simple multiplying in the shaders. Like: PVM = P * V * M

(Im guessing "pGlobalPosition" is your camera/view matrix)


It seems like I would just:

Create another array buffer
send my global position into that array buffer
multiply the buffered vertic data with the global position buffer in a shader
and then go from there

But is that right?


At first:

create one VBO and fill it with some test vertex data. (also use a VAO).

load the shader source code for the vertex and fragment shaders.(dont use matrices at first)

compile the shaders and link the shader-program.

activate the program with glUseProgram, bind the VAO/VBO, draw.


If that works, you can start adding the matrices. For data that is small and is expected to change every frame you use "uniforms". You need to create one and load the view matrix(global position?) into it every frame.(for matrices that are used in many shaders - like the view matrix - you could create an uniform buffer, ...but dont do that now.)

...then you can add the projection matrix.


If you want to see a really basic example of shaders/VAOs, ...see this example Ive made not so long ago:


#5149616 Where is a good place to start?

Posted by Aliii on 26 April 2014 - 06:05 AM

I have a basic storyboard written out for a rpg I want to make. Is there a logical next step to take?


Dont start with an RPG if this is your first game.



What i mean is, what is the general steps one takes to build a game?


Choose a platform(one is enough:)), choose a programming language(or experiment with a few and see which one works for you). Choose an IDE. Decide which engine/libraries/tools you want to use. ....do a research about them.


"When should i start coding?":

Depends. What is your current skill with programming?

#5149596 recommended, up to date tutorials for begining open GL

Posted by Aliii on 26 April 2014 - 04:04 AM








The "opengl-tutorial.org" is the best one I think.


If you dont yet have any GL project done, Ive just posted this a day ago:


#5149208 Basic OpenGL / SDL 2 app - Source

Posted by Aliii on 24 April 2014 - 01:35 PM

Ive tried to use SDL2 recently. Before I use it in my existing projects I wanted to write a basic app that puts something minimal on the screen using the "old" and "modern" OpenGL. It turned out fine, so I thought Im sharing the source. (plus Ive added some comments to it.) I hope Im not posting this to the wrong place.


It uses GLLoad to get the GL functions but you can replace it with GLEW or any other library.


It works for me on both Linux and Windows.(compiled with GCC, using C++11 standard). ....you have to install/add the necessary libraries to your project of course.

I hope it helps someone to start using OpenGL or SDL.

Attached Files

#5134313 Macros vs inline functions.

Posted by Aliii on 24 February 2014 - 08:56 PM

2) Token pasting and stringization operators ##, #. In C you can use those for template-style stuff but you would use actual templates for that in C++. They are sometimes used in C++ for generating class names for unit test frameworks etc.


...and for Assert messages.

#5131839 Portal for a free demo?

Posted by Aliii on 16 February 2014 - 04:29 PM

IndieDB, Desura?

#5131692 Uptading parts of data in a VBO

Posted by Aliii on 16 February 2014 - 06:14 AM

Use glMapBuffer or use separate VBOs.

#5131266 small inline lib for math in mingw

Posted by Aliii on 14 February 2014 - 07:57 AM

and better is to get some better code at all


Like unreadable, non-portable, bugprone hand-optimized code? inline assembly?

If you code in a way that helps the compiler it will usually output pretty neat assembly.


(But anyway you asked for a proper library and not for coding advice so sorry, disregard me.)

#5131239 small inline lib for math in mingw

Posted by Aliii on 14 February 2014 - 05:09 AM

You cant be sure that GCC inlines certain functions. (thats a good thing because it also optimizes for instruction cache, etc) and there is not much to speed up on a 2 line function I think. Maybe change divisions to multiplications, eliminate every branch?

Here is my dot, normalize, cross:

static float    scalarNumber(const CVector3f *const v1, const CVector3f *const v2)              {return (v1->x * v2->x + v1->y * v2->y + v1->z * v2->z);}

float CVector3f::normalize(){

    float length = sqrt( x*x + y*y + z*z);

    if( unlikely( CMathUtilEA::isNearZero( length)))
        return 0.0f;

        x /= length;
        y /= length;
        z /= length;
        return length;


void CVector3f::crossP(const CVector3f *const A, const CVector3f *const B, const CVector3f *const C){

    CVector3f v1( A, B);
    CVector3f v2( A, C);
    x = v1.y * v2.z - v1.z * v2.y;
    y = v1.z * v2.x - v1.x * v2.z;
    z = v1.x * v2.y - v1.y * v2.x;


#5130769 From C to ?

Posted by Aliii on 12 February 2014 - 03:21 AM

On Youtube you can find long presentations form Stroustrup where he talks about how not to look at at C++ as C with classes and how to do things the C++11 way. They might sound a bit advanced though.


This was the last one I saw: "The Essence of C++: With Examples in C++84, C++98, C++11, and C++14"

#5130654 OpenGL supporting libs

Posted by Aliii on 11 February 2014 - 05:29 PM

I dont recommend GLFW, except for a really small project.

If you need an extension loader, consider GLLoad. (GLEW didnt work out for me so well.)