It is a shame that, when doing a serious blog, one that tries to emphasise the technical element of a given career set, or learning module, that the host somehow confuses you with a computer, and tells you that your very own blog is spam. This, by the way, is my explanation of the lateness of this new post.
--------------------------------------------------------------
Vectors (going back over a week unfortunately)
I found My first steps into the world of graphics programming a daunting prospect, one that seemed to loom far above me as i ran headlong into to its immense foot.
Metaphor really isnt my thing. Taking on board that this was something that i will be needing to know for the rest of the year, i promptly began to look through available information, trawling through pages of literature, and not really understanding. MSDN
(http://msdn.microsoft.com/en-gb/default.aspx) once again proves itself as a useful tool for would be developers, giving easy to understand information, and tutorials on coding. a small problem persists, whenever i attempt to run my code (of which i will be talking more on shortly) i get 17 build errors. I know the code is right, all the components are there for the programme to run and show a simple line on screen, but it just doesn't happen. after consulting with a number of my peers, i finally learn that this is a result of a rookie mistake, i have only been building the main .cpp file (by using build solution, visual studio ONLY builds the .cpp file where the main function is.) instead of the whole programme, that sorted, and a lesson learned, i moved on.
Vectors, Drawing Code, and Microsoft windows.h header files
I would like to start this post by detailing the issue with the Windows.h header file, in case any fellow students are reading this for help, and are having the same issue. It seems, through some fluke of programming or settings error, that some users on the university network do not have access to the windows.h header file. This isnt usually a problem, unless you are a programmer, and you are trying to do your introduction to 3d programming tutorials. The error appears to stem from the user settings applied to each university students account, though i am not sure of the specifics, it would seem resetting your account solves the problem.
Microsoft Visual studio is an incredible tool, one i know i won't be using forever, but as it stands, and for the p[urposes we are using it, it is an incredible thing to have access to. I say this because, for the first tutorials for intro to 3d, the majority of the code can be automatically built for you, something that saves a lot of time, however it is important that one knows what this code does, at least in the general sense, so that when visual studio is not available, you can still use the framework.
working through the first tutorials (bar my minor issue with rookie mistakes) was easy enough, once i understood the basic theory, which was easy enough to achieve with a little discussion among my peers, and a lot of looking at msdn to figure out why it wasn't working properly.
in the end, the actual code for drawing a line, or line of text, is simple enough
the code just below here is used to write the phrase "welcome to my blog!" in black, with an underline of blue.
void OnPaint(HDC hdc)
{
Graphics graphics (hdc);
Pen pen
(Color(255,0,0,255), 5);
SolidBrush
brush(Color(255,0,0,0));
FontFamily
fontFamily(L"Times New Roman");Font
font (&fontFamily,24,FontStyleRegular,
UnitPixel);
PointF
pointF(10.0f,20.0f);
graphics.DrawLine(&pen, 10,
50, 230,
50);
graphics.DrawString(L"Welcome to my blog!", -1, &font,
pointF,
&brush);
}
The resulting screen should resemble the one below
the window that is opened with the effects of the code snippet above inside, is mostly generated by windows visual studio. the only modifications made to the original code were to allow for the use of GDI+ and vector drawing code to work in the window.
One more note, on the use of time, i realise that i did not put as much time into learning about vectors as i should have, and i will put more time into understanding matrice's.
No comments:
Post a Comment