Marleys Ghost Posted August 2, 2010 Share Posted August 2, 2010 I have had a couple of requests as to how I managed the rotating compass graphic seen in some of my demo videos. BlitzMax has direct OpenGL support so you can use BlitzMax for direct OpenGL programming. I simply created a function that can be called the same way as other 2D drawing commands. Function DrawAndRotateImage(itr:TTexture, Ax:Int, Ay:Int, Sx:Int, Sy:Int, Ir:Float) glMatrixMode(GL_TEXTURE) glLoadIdentity() glTranslatef(0.5,0.5,0) glRotatef(Ir,0,0,1) glTranslatef(-0.5,-0.5,0) glMatrixMode(GL_MODELVIEW) glEnable itr.Target() itr.Bind() itr.Clamp(1,1,1) DrawRect(Ax,Ay,Sx,Sy) glDisable(GL_TEXTURE_2D) End Function The function works the same as DrawImage but has the extra parameter for rotation (Ir:Float) Draws a texture on screen. The image rectangle will start at the specified coordinate (Ax:Int, Ay:Int) and the image will be stretched to match the specified width and height (Sx:Int, Sy:Int) and rotated (Ir:Float). 1 Quote AMD Bulldozer FX-4 Quad Core 4100 Black Edition 2 x 4GB DDR3 1333Mhz Memory Gigabyte GeForce GTX 550 Ti OC 1024MB GDDR5 Windows 7 Home 64 bit BlitzMax 1.50 • Lua 5.1 • MaxGUI 1.41 • UU3D Pro • MessiahStudio Pro • Silo Pro 3D Coat • ShaderMap Pro • Hexagon 2 • Photoshop, Gimp & Paint.NET LE 2.5/3.4 • Skyline • UE4 • CE3 SDK • Unity 5 • Esenthel Engine 2.0 Marleys Ghost's YouTube Channel • Marleys Ghost's Blog "I used to be alive like you .... then I took an arrow to the head" Link to comment Share on other sites More sharing options...
macklebee Posted August 2, 2010 Share Posted August 2, 2010 cool stuff, MG... thanks for sharing! Quote Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590 LE / 3DWS / BMX / Hexagon macklebee's channel Link to comment Share on other sites More sharing options...
cocopino Posted August 2, 2010 Share Posted August 2, 2010 Nicely done MG. Also, I like the AI trying to flank you (from 0:55). Good stuff! Quote desktop: Quad core Q6600 + 4GB + ATI HD4890 + XP laptop: Dual core T6400 + 4 GB + NVidia 9600M GT + Vista 32 Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.