Jump to content
  • Advertisement


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

3d Wolf

Draw a pixel in C++

This topic is 6489 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

Hey, I want to know how to draw a pixel in c++, can somebody tell my how i can draw a pixel in c++ (for linux)

Share this post

Link to post
Share on other sites
Uhh, i hate to do this, but since this thread already exists on this board (please read the messages before posting), i don''t feel so bad doing it.

Check www.libsdl.org and look at the tutorials. Granted, SDL is in C, not C++, but as you don''t really need object orientation for drawing a pixel, i don''t think this should be that much of a problem for you.

Unless, of course, you don''t know C++ or C, in which case you''ll want to start with something a bit simpler... There''s a free book on learning C++ at http://www.bruceeckel.com/ThinkingInCPP2e.html. Once you get through that, then you should be ready to start thinking about games.


Share this post

Link to post
Share on other sites
C++ is a programming language alone, it''s purpose is
provide the `meat'' between IO layer languages that work
with C or C++.

You have three options at this point, you can interact
with the Linux kernel''s video IO and attempt to draw
a pixel (most difficult approach and not recommended).

Use either SVGALIB (library) for fulll screen drawing
or XLib for GUI drawing (you''ll be drawing to a Window
on a GUI enviroment).

A more experimental approach is to use a proprietery
library such as (previously recommended) SDL. This is
perhaps the best approach but most limited and
difficult to set up.

XLib would be my recommendation as it gives you
direct access to the GUI (X windows) at the lowest
possable level and not require players to install any
additional libs (SDL is hard to set up and get
working at the moment). SDL games I''ve seen were not
very impressive, but it''s a good start for beginners.

Share this post

Link to post
Share on other sites
EXCUSE ME?!?!?!?!

SDL is shitloads better than Xlib for simple graphics, especially if you''ve ever done any DirectX coding...

Xlib adds way too much complexity, while SDL acts as a wrapper for several technologies, including GGI and DGA.

Share this post

Link to post
Share on other sites
I didn''t imply that XLib should be choosen over SDL
for everyone. I''ve worked with X, Windows, and many
portability libs/SDL for a couple of years now.

I may not have the best experiance but I do have a
development team with more than 20+ years of experiance.
We agreed that Xlib provides a better lower level access
for graphics for game development at a major cost of
coding work.

SDL does have some limitations, a lack of X style event
handling, multiple toplevel windows (though newer
versions may support it now) and network transparent
game input and sound device support.

SDL''s advantages in coding simplicity and is a good
start for newbies. There are pros and cons for both
choices based on my experiance and those I''ve worked
game projects with.

Share this post

Link to post
Share on other sites

  • 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!