Matrix Multiplication (Open GL behaviour problem)

Why does Open GL draw my object on the origin the first time round when I place my object?
Additional info:

•I have an object which is written/ initialised on the origin? (x = 0, y=0)
•However I call a matrix transformation just after its in draw(); E.G.: draw_shape(); glMatrixLoad();…
•Afterwards the following objects are drawn accordingly but I’m annoyed at the first object which ruins the whole function.

for (int letter = 0;letter != strlen(s);letter++)



 //draw font in array

  qva_Fonts[((int)*s)- 32]-> draw();



 //loadmatrix Position & Scalling

  gfaaSca[0] = gfFont_Size;

      gfaaSca[5] = gfFont_Size;

          gfaaSca[10] = gfFont_Size;

               gfaaSca[15] = gfFont_Size;

  gfText_PosX += gfFont_Spacing;

     gfaaPos[12] = gfText_PosX;

  gfaaPos[13] = gfText_PosY;

 //multiply matrix




  glLoadMatrixf(gfaaSca); glLoadMatrixf(gfaaPos);  




However I call a matrix transformation just after its in draw(); E.G.: draw_shape(); glMatrixLoad();…

All OpenGL rendering functions use the state of OpenGL at the time the rendering command was issued. Calling glLoadMatrix after rendering will not affect the rendering of the stuff you called before glLoadMatrix.

So if you want some matrix functions to affect the rendering of something, call them before rendering that something.

so basically, its just loading the matrix before multiplying. By the way would it be possible to load it when there is nothing being draw.

Or would it be a case of drawing then glSwapBuffers();(for clearing the default drawing)at which afterwards you’ll redraw the same at the desire location?

I’m not entirely sure what you’re trying to accomplish here, but you seem to have misunderstood how matrixes work. The correct order of operation for each object should be:[ul][li]Set up matrix.[]Load matrix.[]Draw stuff.[/ul]In your case, as well as getting the order completely backwards, you’re calling glLoadMatrix twice - are you aware that the second glLoadMatrix (for gfaaPos) will overwrite the first (for gfaaSca)?[/li]
A SwapBuffers call has nothing to do with clearing stuff; it exchanges the front and back buffers in a double buffered context, and should only be called once per frame and at the end of the frame. glClear is for clearing, and thinking of using SwapBuffers to do it is - to put it bluntly and with no offense intended - a kind of cargo-cult hacking and slashing at code in the desperate hope that something will work.

I think that you’re trying to jump too far ahead of your current level of ability to be honest. You need to step back a little and focus on how transforms actually work, what the correct order of operations actually is, and correct your current misunderstandings first.

Oh is it.

All I just wanted to do was to scale my matrix then reposition it (I thought I needed two matrices for it).But, how would I go about doing this?