Sign in to follow this  

2D artillery game

This topic is 4841 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi all. First, I know the basics of opengl since i've been doing it a while ago. I forgot some things though and have never been coding anything in 2D. Now I'm busy working on a classic 2D artillery game in ortho2d using glut. My question: I need to draw a lot of pixels very fast, since the landscape needs to be able to collapse and changes all the time. I have a few options. - Use a texture on a quad and change the texture every time the landscape is updated (seems slow) - Use glPoint (was it glPoint anyways?!? I mean the one where glPointSize works with) - something a lot better. ?!? Please help. Thanx, Marty

Share this post


Link to post
Share on other sites
hehehehe. new technology, old problems. when i created that game in basic :), the whole mountain between tanks was a bitmap. pixels was drawn only when the missile explode (tank move etc). next to all explodes, create texture with any changes, and use it to display it when you change weapons, angle and move (per pixel color). this is a very fast method. it works on amstrad cpc (remember that?), so i think it will works on 2GHz processor too :)

Share this post


Link to post
Share on other sites
Ok, thanks. I'll use a landscape texture which i'll update when the landscape is hit in any way. The missiles, tanks, explotions, etc. wil be sprites. I'll just do an alpha check on the landscape texture to for collision detection.

Now for another question: How do i manipulate a texture per pixel? Can I keep the aux_rgbimagerec and modify that (i think it's just a bitmap) and then reload the texture from the map? Then: What exactly is the rgb imagemap... Does it have a header, like : with, height, data... Or is it just plain data? Are RGB values just bytes, or floats or something?

Thanks, Marty.

Share this post


Link to post
Share on other sites
First of all I think OpenGL has a function like glBitmap(); (look it up in the red book), and it basically renders a bitmap directly from memory, so you have direct acces to modify the bitmap.

Or you can just do render to texture in OpenGL. I don't know which way is faster.

Share this post


Link to post
Share on other sites
I looked it up. glBitmap is really a bitmap, so it's bichromatic. glDrawPixels is what i'm going to use. The problem is i'm getting strange results. The image is on it's side and interlaced (looks like scanlines of some sort). It's probably the way i set up the array, so i'm going to try to mess around with that. It looks like this now:

GLubute landscape[width][height][4]
And I use the GL_RGBA mode, so that isn't it. Got any clues?

Thanx,
Marty

Share this post


Link to post
Share on other sites

This topic is 4841 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this