To you who have done OGL iso

Started by
2 comments, last by Moogle 22 years, 3 months ago
Okay... I dont know if I am doing things right, but I just draw a bunch of quads with 45 degree rotation applied...

glRotatef(45.0f, 0.0f, 0.0f, 1.0f);				    //Rotate for isometric view

		for (int y = 0; y < 10; y++)						//Loop trough the map id	
		{
			for (int x = 0; x < 10; x++)
			{
				tileid = map [x] [y];								//Grab the current map id
				glBindTexture(GL_TEXTURE_2D, texture[tileid]);		//and make it the current texture
				glBegin(GL_QUADS);									//Draw tile at correct position
					glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
					glTexCoord2f(0.0f, 0.0f); glVertex3f(float(x), float(y), 0.0f);
					glTexCoord2f(1.0f, 0.0f); glVertex3f(float(x + 1), float(y), 0.0f);
					glTexCoord2f(1.0f, 1.0f); glVertex3f(float(x + 1), float(y + 1), 0.0f);
					glTexCoord2f(0.0f, 1.0f); glVertex3f(float(x), float(y + 1), 0.0f);
				glEnd();
			}
		}
 
But how do I add characters to this... Bugs me a lot ...
-=Moogle=-
Advertisement
Well, if you are planning to make 2D sprites (ie an image that walks around on the screen - not a 3d model) you can just draw textured quads using an alpha channel on the texture so that it will ignore that part of the image - in this cas the part surrounding the character.

0 0 0 . . 0 0 00 0 . . . . 0 00 0 . . . . 0 0 0 0 0 . . 0 0 00 0 . . . . 0 00 . 0 . . 0 . 0. 0 0 . . 0 0 .0 0 0 . . 0 0 00 0 . 0 0 . 0 00 . 0 0 0 0 . 0. 0 0 0 0 0 0 .


If the alpha setting is set to ignore the 0 pixels, then you should get a stick figure on your screen (thats if you use the above bitmap).


To so something like this simply, I would draw the bitmap in mspaint or something, make the parts I want invisible set to a colour (lets say to that pink colour).
In my code, I would use auxDIBLoadImage to load it, then I would resize (realloc) the image data to 4 times the image width*image height. It should start as 3 times... Next thing is to search through the array and add in the new channel when you come across that pink pixel. It is easier if you work backwards as you have to move the whole block along for each pixel.

When you set your mipmaps or whatever you are, remember that it is now a 32 bit image, not 24 bits.


Beer - the love catalyst
good ol'' homepage
Beer - the love catalystgood ol' homepage
IIRC from my drafting classes, isometric representation correspond to a 30° or 60° rotation (not 45°), so that you have all three axes projecting at 120° from each other, with equal scaling (hence iso (equal) metric (measure) ).

Edited by - Fruny on January 14, 2002 10:02:26 AM
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." — Brian W. Kernighan
I'm a mechanical engineer. Common isometric views are both 30* offset and 45*. They can be others, but are uncommon.
Oblique is most commonly 45* and halved.
Perspective when drawn is two point perspective, but most 3d api's and games use single point. I've written two point perspective engines and they looked awesome, even though it was for a 286 .

Well anyway, you would probably only have been taught 30* iso as lets face it, it looks cool.

As a note, if you are rendering in a perspective, it isn't really isometric. It is best to rotate the view (if it starts flat) as 60 degrees from the screen lay it "flat" on the ground.

For anyone who has absolutely no idea what I am on about, this is what I am on about (good old ms-paint)

Posted as a link as the resolution is large (don't worry, the file size is small)

http://members.optushome.com.au/jlferry/image/modes.jpg





Beer - the love catalyst
good ol' homepage

Edited by - Dredge-Master on January 14, 2002 11:01:22 AM
Beer - the love catalystgood ol' homepage

This topic is closed to new replies.

Advertisement