Jump to content

Featured Replies

Posted

Ok. I'm trying to draw an isometric room, using these loops:

 

for (count4 = 0; count4 < WINDOW_HEIGHT/TILE_HEIGHT*1.5; count4++){
	for (count = 0; count < WINDOW_WIDTH/TILE_WIDTH; count++){
		SelectObject(hdcCompatible,hbmBitmap[rand()%2]);
		for (count2 = 0; count2 < TILE_WIDTH; count2++){
			for (count3 = 0; count3 < TILE_HEIGHT; count3++){
				if (GetPixel(hdcCompatible,count2,count3) != RGB(255,0,255)){
					if (count4%2 == 0)
						SetPixel(hdcBuffer,count2+(count*TILE_WIDTH),count3+(count4*12),GetPixel(hdcCompatible,count2,count3));
					else
						SetPixel(hdcBuffer,count2+(count*TILE_WIDTH)+25,count3+(count4*12),GetPixel(hdcCompatible,count2,count3));
				}
			}
		}
	}
}

 

Now, these loops work, everything's peachy, but it's slow. Like, nowhere near fast enough. I thought this was how one drew some tiles in an isometric game, but apparently it's not. What's the faster way?

 

Let me take a wild guess? I have to switch from raster graphics and blitting to OpenGL or D3D, right?

SetPixel is SLOW.

Don't use it.

 

GDI is slow enough already, SetPixel is probably one of the worst functions performance-wise.

  • Author

So do I just use OpenGL and GL_POINTS to draw what I want?

 

Or should I use some of OpenGL's other stuff to draw the shapes instead of pixel by pixel?

Guest
This topic is now closed to further replies.