matt moen

Upload: leonichev

Post on 14-Apr-2018

214 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/27/2019 Matt Moen

    1/4

    Mrmoen.com / Matt Moen

    Technical Projects, Interests, and Tutorials

    Home

    April 8th, 2008 by Matt Moen

    With alternative operating systems like Ubuntu and OS X more popular than ever, programming for Windows

    alone is no longer an option. Simple DirectMedia Layer(SDL) is a popular, cross-platform library that

    provides an interface for graphics, sound, and input. SDL and OpenGL can be used together to provide basic

    functionality to create graphics intensive games and simulations that build in Windows, Linux, and OS X.

    Many notable games have used this approach including Second Life, Doom 3, SimCity 3000, and Unreal

    Tournament 2004.

    The following is a step-by-step procedure for setting up SDL and OpenGL in a Windows environment using

    Visual C++ 2008 Express Edition, a free IDE and compiler from Microsoft.

    Download the SDL development libraries:

    Download the appropriate SDL development library from theirdownload page. For this tutorial I use

    SDL-devel-1.2.13-VC8.zip (for Visual C++ 2005 SP1)

    Extract (unzip) the file to a convenient location. This tutorial assumes the location to be C:\SDL.

    At minimum, SDL.dll is needed to run SDL programs on Windows. The easiest way to use this is to

    copy SDL.dll from C:\SDL\lib to C:\Windows\System32. Alternatively, you may place a copy in the

    project directory or in the same directory as the compiled executable.

    Run Visual C++ and create a new project:

    Under the File menu select New Project (Ctrl+Shift+N).Select Win32 Project, enter a Name, and click OK.

    In the Wizard click Next, then check the box next to Empty Project, and click

    Finish.

    Add a new source file for the project:

    Under the Project menu select Add New Item (Ctrl+Shift+A).

    Select C++ File (.cpp), enter a Name, and click OK.

    Configure the compiler:

    Under the Project menu select Project Properties (Alt+F7) at the bottom.

    Select Configuration Properties from the navigation panel on the left.

    Select All Configurations from the Configuration drop-down box at the top of the

    dialog. This ensures you are changing the settings for both the Debug and Release configurations.

    Under C/C++General, set Additional Include Directories to C:\SDL\include.

    Under C/C++ Code Generation, set Runtime Library to Multi-threaded DLL (/MD).

    Configure the linker:

    Under LinkerGeneral, set Additional Library Directories to C:\SDL\lib.

    oen.com / Matt Moen http://www.mrm

    2/18/2013

  • 7/27/2019 Matt Moen

    2/4

    Under Linker Input, set Additional Dependencies to sdl.lib sdlmain.lib

    opengl32.lib glu32.lib.

    Click OK to save the project properties.

    Visual C++ is now basically set up to use SDL and OpenGL. Coding for these libraries is

    beyond the scope of this tutorial, but you can use sdlopengl.cpp to get started with a

    simple demonstration program. When built successfully this code will draw a red square

    on a black background.

    SDL and OpenGL documentation can be found on the SDL website including tutorials,

    doc wiki, and OpenGL resources. For other OpenGL tutorials and resources tryNeHe Productions, OpenGL

    API Documentation, and GameDev.net.

    Posted in Tutorials | 4 Comments

    March 30th, 2008 by Matt Moen

    OpenGL is a popular cross-platform library for 2-D and 3-D graphics programming. OpenGL comes with

    implementations on most operating systems and many compilers, including Visual C++ 2008 Express Edition,

    a modern, free IDE and compiler from Microsoft. Once VC++ 2008 is installed you simply need to create a

    new project and link to the correct libraries and headers to start using OpenGL.

    Run Visual C++ and create a new project:

    Under the File menu select New Project (Ctrl+Shift+N).

    Select Win32 Project, enter a Name, and click OK.In the Wizard click Next, then check the box next to Empty Project, and click

    Finish.

    Add a new source file for the project:

    Under the Project menu select Add New Item (Ctrl+Shift+A).

    Select C++ File (.cpp), enter a Name, and click OK.

    Link to the OpenGL libraries:

    Under the Project menu select Project Properties (Alt+F7) at the bottom.

    Select Configuration Properties Linker Input from the navigation panel onthe left.

    Select All Configurations from the Configuration drop-down box at the top of the dialog. This ensures

    you are changing the settings for both the Debug and Release configurations.

    Type opengl32.lib glu32.lib in Additional Dependencies and click OK.

    Now that your project is set up to use OpenGL you can start coding. Download

    opengl.cpp to begin with a basic Win32/OpenGL demonstration that compiles on VC++

    2008.

    If everything is correct you should see a red square when running the code. Credit for this

    oen.com / Matt Moen http://www.mrm

    2/18/2013

  • 7/27/2019 Matt Moen

    3/4

    code goes mostly to examples from MSDN andNeHe.

    To learn more about OpenGL programming there are several great online resources includingNeHe

    Productions, OpenGL API Documentation, and GameDev.net.

    Posted in Tutorials | 48 Comments

    March 26th, 2008 by Matt Moen

    From Wikipedia, the free encyclopedia:

    In numerical analysis, computational physics, and simulation, discretization error is error

    resulting from the fact that a function of a continuous variable is represented in the computer by

    a finite number of evaluations, for example, on a lattice. Discretization error can usually be

    reduced by using a more finely spaced lattice, with an increased computational cost.

    Posted in General |No Comments

    March 26th, 2008 by Matt Moen

    The purpose of this website is to document and share my technical projects and interests. Additionally, this

    site will serve as a central contact point for my online presence. Please excuse any instability while I continue

    to set up and modify this site.

    Thanks,

    Matt Moen

    Posted in General | 1 Comment

    General

    Tutorials

    April 2008

    March 2008

    oen.com / Matt Moen http://www.mrm

    2/18/2013

  • 7/27/2019 Matt Moen

    4/4

    Digg News

    Facebook

    Pandora Radio

    YouTube

    RSS

    Comments RSS

    Valid XHTML

    XFN

    2013 Mrmoen.com / Matt MoenWordpress Theme by Arcsin

    oen.com / Matt Moen http://www.mrm

    2/18/2013