Archived

This topic is now archived and is closed to further replies.

gunne

Plot a pixel.

Recommended Posts

gunne    122
I know this has been brought up before... How do I plot a pixel using c++ under win2k? I have done it using c under Dos/win98 so I know the algoritms and all that. Is the easiest way to use OpenGl or another API? Any help is appreciated. oh. Forgot to mention that I'm using Borland C++ Builder. Edited by - gunne on October 15, 2001 1:38:51 PM

Share this post


Link to post
Share on other sites
Scarab0    122
Well to plot ONE lousy pixel, it doesn''t really matter what API you use. But if you want to draw lot''s of pixels (for a 2D game or a software 3D engine perhaps) then I think DirectDraw would get you the highest framerates in Windows. But there are lot''s of alternatives, like Direct3D, OpenGL, GDI, etc.

But since you say that you already know how to do it in C under DOS/Win98 then I guess you already knew that. It''s just the same in C++ with Win2k! C++ is C with lots of extra features, so all your C code will still work, and *MOST* programs written for Win98 work in Win2k too. (Or can be made to work without too much effort.)

I hope that helps, good luck plotting your pixel.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster   
Guest Anonymous Poster
Well, I''ve never used an API. But I have programmed 13h and mode-x under Dos. And that is not the same.

So an API is the way to go? In that case I think OpenGl is the one for me...

Any good tutorials on openGl?

Share this post


Link to post
Share on other sites
Scarab0    122
http://nehe.gamedev.net/ has the best (I think) beginners tutorials on OpenGL, but AFAIK it doesn''t teach you how to draw a pixel. OpenGL is all about triangles, not really about pixels. It is possible to draw individual pixels but it is slow.

Sprites however is something else. If you want to make a 2D game using sprites then OpenGL can be a great API. (I use it for my own 2D game in progress.) You can do scaling, rotation and other sprite effects very easily and all hardware accelerated!

Share this post


Link to post
Share on other sites
gunne    122
I''m doing a fractal program for my math class, so i need to plot a pixel. I know it can be done in OpenGl, but it might be smarter to draw a small sprite instead of plot a pixel to speed up performance. Right?

Share this post


Link to post
Share on other sites
Scarab0    122
That depends. If you need to create that sprite each frame using your fractal generator and then render it to OpenGL, that would be slow. The reason for this is that you''d have to upload that sprite from system ram to video ram each and every frame, which is slow. (But maybe that doesn''t matter for a fractal generator??)

However, if the sprite is only created once at start-up then drawing the sprite with OpenGL is definately very fast indeed.

I think that for what you want to do, DirectDraw will be faster because it seems that you want to draw at a pixel level. But if speed is not very important for your purpose (that is, 25 fps is more than enough) then OpenGL would also do the job.

Share this post


Link to post
Share on other sites