Jump to content
  • Advertisement
Sign in to follow this  
  • entries
    3
  • comments
    6
  • views
    5406

Entries in this blog

 

SDL / GLUT

I've recently started looking at OpenGL. To some extent I feel hesitant. The 3D world seems too vast for a "one man show". Nevertheless I've decided to look at a small subset of OpenGL capabilities, specifically rendering 2D primitives. I feel that OpenGL has some nice features built in already to perform some imaging magic. Overlays, blending, anti aliasing and translucency to mention a few. I'm hoping to find nice support for SVG in OpenGL, this will mean that I should be able to create resolution independent backgrounds ... which really beats standard images.

As for using OpenGL in an application (specifically a game) I've started looking at two technologies:
- SDL (http://www.libsdl.org/)
- GLUT (http://www.opengl.org/resources/libraries/glut/)

First off GLUT is a really nice tool to get an OpenGL sample up and running quickly, but that's about where it ends as far as I can see. SDL on the other hand integrates easily into OpenGL and takes over all the windowing stuff you need, but also adds everything else. That is timing, game loop, networking, better / easier event handling for keyboard and mouse ... and more.

That's about as far as I got, now to do some more reading -O-o-

MaskedAvenger

MaskedAvenger

 

Software Engineer or Over Engineer?

I'm trying extremely hard not to over engineer anything. In fact I'm trying hard not to dive right into OOP. When I first started out developing, I picked up some game dev books and immediately tried to create my own - not so much improved - version of what the book already had. I couldn't understand why there weren't any C++ samples, mostly the beginner books did C. I now realise these guys were smart. If they had to do everything OOP they would have never finished the book ...

I have never written a game, but I've made an amazing amount of class hierarchies resembling names of Game Engine Entities, these entities looked pretty good on file. Unfortunately they never made it all the way to any type of output device ... well, maybe stdout ... or should I say cout.

The point is, if I don't get off this "plan till perfection" train now I fear that I may never see more than a blit on screen.

Wish me luck

MaskedAvenger

MaskedAvenger

 

Fancy Cursor

I'm busy playing around with fancy cursers, i.e. hiding the default cursor and rendering one on a surface.

Here are some top level ideas that I think can be useful in making interesting cursors:
- Keep a ring buffer of the last x mouse motion events
- Use the events from the ring buffer during render time to create some type of sweeping effect of the mouse

SDL Sample (High Level):
-----------------------------------
#define MAX_MOTIONS 12

SDL_MouseMotionEvent motions[MAX_MOTIONS];

int last_motion = 0;
int lap = 0; // have we gone around at least once?

void
handle_motion(SDL_MouseMotionEvent *e)
{
/* Amazingly complex ring buffer impl. */
if (last_motion > MAX_MOTIONS - 1) {
lap = 1;
last_motion = 0;
} /* if */

motions[last_motion] = e->motion;
last_motion++;
}

void
update_graphics(void)
{
int i;
int end = lap ? MAX_MOTIONS : last_motion;
/* Scale end to relative motion - good idea, bad idea? */
for (i = 0; i SDL_MouseMotionEvent m = motions;
putpixel(screen, m.x, m.y, color);
} /* for */
}
--

Its times like these that things just don't look as good as they should.

MaskedAvenger

MaskedAvenger

Sign in to follow this  
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!