The SDL forums have moved to discourse.libsdl.org.
This is just a read-only archive of the previous forums, to keep old links working.


SDL Forum Index
SDL
Simple Directmedia Layer Forums
Can I plot individual pixels using SDL?
bilsch01


Joined: 26 Feb 2015
Posts: 55
Location: Seattle, WA, USA
I have a screen saver program that plots mathematical functions (using graphics from TurboC). The graphics is really slow. I have SDL2 library installed on my Ubuntu computer and have tinkered with an SDL tutorial - I didn't see anything in the commands described in the SDL online manual that plots individual points. Does SDL have capability to plot points? If so please tell me what commands to use. TIA. Bill S.
MrTAToad


Joined: 13 Feb 2014
Posts: 205
Location: Chichester, England
You would use SDL_RenderDrawPoint for rendering to a texture/screen
Alex


Joined: 19 Sep 2014
Posts: 35
Additionally you can use SDL_Surface as a pixel array and manipulate any pixel you want. After this manipulations draw this surface.
Can I plot individual pixels using SDL?
j_post
Guest

On Saturday 28 February 2015 07:33:08 bilsch01 wrote:
Quote:
I have a screen saver program that plots mathematical functions (using
graphics from TurboC). The graphics is really slow. I have SDL2 library
installed on my Ubuntu computer and have tinkered with an SDL tutorial - I
didn't see anything in the commands described in the SDL online manual
that plots individual points. Does SDL have capability to plot points?
If so please tell me what commands to use. TIA. Bill S.

I wrote a program over 8 years ago that plots polynomials (up to 7th order)
and their derivatives (up to the 4th) and displays them quickly. If your
screen saver is animated, though, it may not be fast enough. If you like, let
me know and I'll send you the source directly.

It's written in C++ and uses SDL 1.2, but should easily adapt to SDL2.

If all you need is a function that plots individual points, the code used is


// Set pixel at given coordinates to the given color

void setPixel(int x, int y, int color)
{
Uint8 *row8;
Uint16 *row16;
Uint32 *row32;

if (x < 0 || x >= SCREEN_PIXEL_WIDTH || y < 0 || y >=
SCREEN_PIXEL_HEIGHT)
return; // Don't allow overwriting boundaries of the screen

switch (bytes_per_pixel)
{
case 1:
row8 = (Uint8 *) (screen->pixels + y * pitch + x *
bytes_per_pixel);
*row8 = (Uint8) color;
break;

case 2:
row16 = (Uint16 *) (screen->pixels + y * pitch + x *
bytes_per_pixel);
*row16 = (Uint16) color;
break;

case 4:
row32 = (Uint32 *) (screen->pixels + y * pitch + x *
bytes_per_pixel);
*row32 = (Uint32) color;
break;
}
}

The 'screen' variable above is a pointer to an SDL_Surface.

Jeff
_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
bilsch01


Joined: 26 Feb 2015
Posts: 55
Location: Seattle, WA, USA
MrTAToad wrote:
You would use SDL_RenderDrawPoint for rendering to a texture/screen


I can run other SDL programs so I think I have the SDL libraries I need. But when I put SDL_RenderDrawPoint in the program I get the following error:

sdlsnx2.cSad.text+0x192): undefined reference to `SDL_RenderDrawPoint'
collect2: error: ld returned 1 exit status

Is there some other library or header file I need? I notice the command is not included in the reference pages at:
http://www.libsdl.org/release/SDL-1.2.15/docs/html/. Apparently that site is missing some commands. Can you tell me a site that has complete set of SDL commands? Thanks.
Alex


Joined: 19 Sep 2014
Posts: 35
http://libsdl.org/download-2.0.php
http://wiki.libsdl.org/
Can I plot individual pixels using SDL?
Jared Maddox
Guest

Quote:
Date: Sat, 28 Feb 2015 15:33:08 +0000
From: "bilsch01"
To:
Subject: [SDL] Can I plot individual pixels using SDL?
Message-ID:
Content-Type: text/plain; charset="iso-8859-1"

I have a screen saver program that plots mathematical functions (using graphics from TurboC). The graphics is really slow. I have SDL2 library installed on my Ubuntu computer and have tinkered with an SDL tutorial - I didn't see anything in the commands described in the SDL online manual that plots individual points. Does SDL have capability to plot points? If so please tell me what commands to use. TIA. Bill S.


You want to use either the renderer with the SDL_Render* functions, or
an SDL_Surface with a hand-written pixel manipulation function. Only
you can decide which is the correct choice.
_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
Can I plot individual pixels using SDL?
Jared Maddox
Guest

Quote:
Date: Sat, 28 Feb 2015 15:43:14 -0800
From: "j_post"
To:
Subject: Re: [SDL] Can I plot individual pixels using SDL?
Message-ID:
Content-Type: Text/Plain; charset="iso-8859-6"

On Saturday 28 February 2015 07:33:08 bilsch01 wrote:
Quote:
I have a screen saver program that plots mathematical functions (using
graphics from TurboC). The graphics is really slow. I have SDL2 library
installed on my Ubuntu computer and have tinkered with an SDL tutorial - I
didn't see anything in the commands described in the SDL online manual
that plots individual points. Does SDL have capability to plot points?
If so please tell me what commands to use. TIA. Bill S.

I wrote a program over 8 years ago that plots polynomials (up to 7th order)
and their derivatives (up to the 4th) and displays them quickly.

<snip>

Quote:
It's written in C++ and uses SDL 1.2, but should easily adapt to SDL2.

If all you need is a function that plots individual points, the code used is


// Set pixel at given coordinates to the given color

void setPixel(int x, int y, int color)
{


<snip>

Quote:
Jeff


If you don't have an objection, then I'm going to use this for my own
textured-triangles code.
_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
Can I plot individual pixels using SDL?
Jared Maddox
Guest

Quote:
Date: Sun, 01 Mar 2015 00:57:59 +0000
From: "bilsch01"
To:
Subject: Re: [SDL] Can I plot individual pixels using SDL?
Message-ID:
Content-Type: text/plain; charset="iso-8859-1"


MrTAToad wrote:
Quote:
You would use SDL_RenderDrawPoint for rendering to a texture/screen


I can run other SDL programs so I think I have the SDL libraries I need. But when I put SDL_RenderDrawPoint in the program I get the following error:

sdlsnx2.cSad.text+0x192): undefined reference to `SDL_RenderDrawPoint'
collect2: error: ld returned 1 exit status

Is there some other library or header file I need? I notice the command is not included in the reference pages at:
http://www.libsdl.org/release/SDL-1.2.15/docs/html/. Apparently that site is missing some commands. Can you tell me a site that has complete set of SDL commands? Thanks.


Are you COMPLETELY certain that you're using SDL 2? The reference link
that you posted is for SDL 1.2, which is one of the predecessor
versions, but actually doesn't have API or ABI compatibility with SDL
2.

If for some reason you need to use SDL 1.2, then you'll need to go
with the software-surface method that Jeff mentioned.
_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
Can I plot individual pixels using SDL?
j_post
Guest

On Saturday 28 February 2015 21:03:50 Jared Maddox wrote:
Quote:
Quote:

// Set pixel at given coordinates to the given color

void setPixel(int x, int y, int color)
{

<snip>

Quote:
Jeff

If you don't have an objection, then I'm going to use this for my own
textured-triangles code.

No objection at all, glad it's of use to you or anyone else.

Jeff
_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
Re: Can I plot individual pixels using SDL?
bilsch01


Joined: 26 Feb 2015
Posts: 55
Location: Seattle, WA, USA
[/quote]
Are you COMPLETELY certain that you're using SDL 2? The reference link
that you posted is for SDL 1.2, which is one of the predecessor
versions, but actually doesn't have API or ABI compatibility with SDL
2.

If for some reason you need to use SDL 1.2, then you'll need to go
with the software-surface method that Jeff mentioned.

The SDL2 library is in my system however I think my capability is limited to 1.2 because the compiler says UNDEFINED REFERENCE to SDL_RenderDrawPoint. I don't see that the code posted by Jeff will plot a pixel. My code computes x and y coordinates for 640x480 display and uses TurboC putpixel() to display the computed point. putpixel is very slow. SDL_RenderDrawPoint is not available apparently because I have SDL 1.2 capability only. Apparently there is no command in SDL 1.2 that displays individual pixels.
Re: Can I plot individual pixels using SDL?
Alex


Joined: 19 Sep 2014
Posts: 35
bilsch01 wrote:
The SDL2 library is in my system however I think my capability is limited to 1.2 because the compiler says UNDEFINED REFERENCE to SDL_RenderDrawPoint.

You should correctly add paths to your include and libs files when compiling and linking your app.
Try this console commands:
sdl2-config --cflags
sdl2-config --libs
Is this commands show something on your system?
Can I plot individual pixels using SDL?
j_post
Guest

On Sunday 01 March 2015 05:46:34 bilsch01 wrote:
Quote:
I don't see that the code posted by Jeff will plot a
pixel.

It sets the pixel in the SDL_Surface pointed to by 'screen'. At some point you
need to call SDL_UpdateRect to actually display the changes, but you don't
want to do that after every call to setPixel or it will be *real* slow.

What my code (call 'polygraph' for polynomial graphing) does is plot the
entire function within the applicable domain and range using calls to setPixel
and only then calls SDL_UpdateRect. I've never actually timed how long it
takes since once it begins plotting, the curve appears on screen faster than a
human can detect. Good enough for my uses.

If, on the other hand, by 'plot a pixel' you mean knowing which pixel to set
to what color, that's the job of your application code.

Again, if you'd like the program's source code (which is GPL'd) I'll send you
a zip or tar.gz file, but I see no need to burden the mailing list with it. It
will compile for either Linux or Windows, but not OSX, 'cause, you know, Apple
sucks Wink

Quote:
My code computes x and y coordinates for 640x480 display and uses
TurboC putpixel() to display the computed point. putpixel is very slow.


It's been ages since I've used TurboC so I can't say for sure, but it could be
that the TurboC library is updating the displayed data (the physical screen)
after every call to putpixel(). See above.

Jeff
_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
Re: Can I plot individual pixels using SDL?
Alex


Joined: 19 Sep 2014
Posts: 35
Jared Maddox wrote:

If you don't have an objection, then I'm going to use this for my own
textured-triangles code.

Jared, if you plan to publish your textured-triangles code under conditions of zlib license, like SDL2 library license, then you can't use that code because it under GPL license. This two licenses are incompatible. I think you can use zlib-licensed code in GPL-ed application, but you can't use GPL-ed code in zlib-licensed app or library. Be careful with this licenses.
Can I plot individual pixels using SDL?
j_post
Guest

On Sunday 01 March 2015 08:31:00 Alex wrote:
Quote:
Jared Maddox wrote:
Quote:
If you don't have an objection, then I'm going to use this for my own
textured-triangles code.

Jared, if you plan to publish your textured-triangles code under conditions
of zlib license, like SDL2 library license, then you can't use that code
because it under GPL license. This two licenses are incompatible. I think
you can use zlib-licensed code in GPL-ed application, but you can't use
GPL-ed code in zlib-licensed app or library. Be careful with this
licenses.

The application program is GPL. Anyone has my permission to use the setPixel
routine in their software under any license they choose as long as said
license doesn't try to make the code proprietary. Same applies to any function
in the program that interfaces to SDL functions or structures, as opposed to
the higher level application code which must remain GPL.

I'm no lawyer (I have ethics :-), but the above statement is legally binding.

---------------------------
| Application | GPL
| (bunch of math stuff) |
---------------------------
|
V
------------------
| SDL interface | any license you want that is not proprietary
-------------------
|
V
--------------
| SDL | SDL's license
--------------

Jeff

_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
Re: Can I plot individual pixels using SDL?
Alex


Joined: 19 Sep 2014
Posts: 35
j_post wrote:
The application program is GPL. Anyone has my permission to use the setPixel
routine in their software under any license they choose as long as said
license doesn't try to make the code proprietary.

Thanks, Jeff.
I'm not lawyer too, but I have some (limited) knowledge about licenses Smile
Cause you can use SDL2 in your GPL application - zlib-license permit you to use it.
Zlib-license is much more permissive than GPL. Any code licensed under zlib conditions can be used even inside of proprietary application (not only in free apps). If you forbid to use this code in proprietary application, then this code can't be licensed under zlib conditions.

You right, this scheme is correct:
|GPL App| (use/include code)-> |SDL2|

This scheme is correct too:
|Proprietary app| (use/include code)-> |SDL2|

This scheme is not correct:
|SDL2| (use/include code)-> |GPL code|

I mean you can't use GPL code inside SDL2 library. But you can use SDL2 code even in proprietary app or lib.

Sorry for offtopic. This topic is not about licenses.
Can I plot individual pixels using SDL?
j_post
Guest

On Sunday 01 March 2015 09:33:22 Alex wrote:
Quote:
j_post wrote:
Quote:
The application program is GPL. Anyone has my permission to use the
setPixel routine in their software under any license they choose as long
as said license doesn't try to make the code proprietary.

Thanks, Jeff.
I'm not lawyer too, but I have some (limited) knowledge about licenses Smile
Cause you can use SDL2 in your GPL application - zlib-license permit you to
use it.

Since I wrote that app more than 8 years ago, it uses SDL1.2. If anyone cares
to port it to SDL2, please let me know. I'd love to have an SDL2 version of
it, but I lack the time to port it myself. (It's written in C++, but much of
it is very C-ish.)

Jeff


_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
Re: Can I plot individual pixels using SDL?
Alex


Joined: 19 Sep 2014
Posts: 35
j_post wrote:
Since I wrote that app more than 8 years ago, it uses SDL1.2. If anyone cares
to port it to SDL2, please let me know. I'd love to have an SDL2 version of
it, but I lack the time to port it myself. (It's written in C++, but much of
it is very C-ish.)

Jeff

You still can use SDL_Surface to draw in SDL2 (http://wiki.libsdl.org/SDL_Surface). I think it is not very hard work to port your code to SDL2. Just rewrite some small parts of code Smile
Can I plot individual pixels using SDL?
Jared Maddox
Guest

Quote:
Date: Sun, 01 Mar 2015 13:46:34 +0000
From: "bilsch01"
To:
Subject: Re: [SDL] Can I plot individual pixels using SDL?
Message-ID:
Content-Type: text/plain; charset="iso-8859-1"


Are you COMPLETELY certain that you're using SDL 2? The reference link
that you posted is for SDL 1.2, which is one of the predecessor
versions, but actually doesn't have API or ABI compatibility with SDL
2.

If for some reason you need to use SDL 1.2, then you'll need to go
with the software-surface method that Jeff mentioned.

The SDL2 library is in my system however I think my capability is limited to 1.2 because the compiler says UNDEFINED REFERENCE to SDL_RenderDrawPoint. I don't see that the code posted by Jeff will plot a pixel. My code computes x and y coordinates for 640x480 display and uses TurboC putpixel() to display the computed point. putpixel is very slow. SDL_RenderDrawPoint is not available apparently because I have SDL 1.2 capability only. Apparently there is no command in SDL 1.2 that displays individual pixels.

[/quote]
Time for a history lesson.

Once upon a time ( specifically, before the mid-90s), programs
accessed the display card directly. This worked in the following
manner: the card would have a block of memory, and that block of
memory could be accessed by the CPU as if it was part of the
computer's normal memory. The display card would in turn also be
accessing that block of memory, through a physically separate set of
access pins (this type of memory is called "dual-ported", and still
exists for this type of application), and use the information that it
obtained to control the actual display. The arrangement of this memory
was that of a set of one-dimensional matrixes, arranged sequentially
in memory, with the elements of each array also in sequential order,
with whatever padding was necessary inside or between the arrays. Text
displays would have a byte-per-character + a separate ROM to contain
the appearance of the actual characters, black and white displays
would usually have a bit-per-pixel, "True-color" displays would (and
technically still do, for the sake of boot-stage graphics and
backwards-compatibility) usually have either 3 bytes or 4 bytes per
pixel, etc.

To access the space of an individual pixel you would determine the X
and Y coordinates of the pixel, calculate the affect of bit-alignment
on the location (we don't do this with SDL, because SDL doesn't do
pixels that are a non-whole multiple of a byte), and then do some
multiplication and addition to determine the location in memory of the
pixel.

SDL's surfaces work with this exact same scheme. The "pitch" variable
in Jeff's code is the distance between the beginning of adjacent
one-dimensional pixel matrixes (called scanlines): this number takes
into account both the space occupied by the pixels, as well as any
padding.

The TurboC putpixel() function most likely works very similarly, since
Windows started using "dib" (basically the in-memory form of a .bmp
file) images in it's rendering system very early.

SDL 1.2 (and 2, though for more recent graphics models) is basically
built around providing a platform-independent interface to graphics
that's compatible with common rendering practices, so the natural
assumption going in was that the pixel access code would already be
there (and probably be optimized already), and just need to be
modified instead of being written from scratch. Thus, it didn't
actually make sense to include pixel access routines.
_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
Can I plot individual pixels using SDL?
Jared Maddox
Guest

Quote:
Date: Sun, 1 Mar 2015 09:10:30 -0800
From: "j_post"
To:
Subject: Re: [SDL] Can I plot individual pixels using SDL?
Message-ID:
Content-Type: Text/Plain; charset="iso-8859-6"

On Sunday 01 March 2015 08:31:00 Alex wrote:
Quote:
Jared Maddox wrote:
Quote:
If you don't have an objection, then I'm going to use this for my own
textured-triangles code.

Jared, if you plan to publish your textured-triangles code under conditions
of zlib license, like SDL2 library license, then you can't use that code
because it under GPL license. This two licenses are incompatible. I think
you can use zlib-licensed code in GPL-ed application, but you can't use
GPL-ed code in zlib-licensed app or library. Be careful with this
licenses.

The application program is GPL. Anyone has my permission to use the setPixel
routine in their software under any license they choose as long as said
license doesn't try to make the code proprietary.

I was going to point out that Alex's point about this still not being
compatible was right (since SDL 2 is allowed to be static-linked, the
code in it can become INDIRECTLY subject to a license making the code
proprietary, thereby conflicting with your terms), but then I looked
at the code and noticed it doesn't actually calculate the pixel value
from raw RGB(A) values, so it isn't actually useful to me anyways Sad .

I'll just go digging around in the Hg for a while to see if I can find
something.
_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
MrTAToad


Joined: 13 Feb 2014
Posts: 205
Location: Chichester, England
bilsch01 wrote:
MrTAToad wrote:
You would use SDL_RenderDrawPoint for rendering to a texture/screen


I can run other SDL programs so I think I have the SDL libraries I need. But when I put SDL_RenderDrawPoint in the program I get the following error:

sdlsnx2.cSad.text+0x192): undefined reference to `SDL_RenderDrawPoint'
collect2: error: ld returned 1 exit status

Is there some other library or header file I need? I notice the command is not included in the reference pages at:
http://www.libsdl.org/release/SDL-1.2.15/docs/html/. Apparently that site is missing some commands. Can you tell me a site that has complete set of SDL commands? Thanks.

I would go with the fact that your library pathing is somewhat inaccurate - you need to
#include "SDL2.h" and make sure that the libraries are accessible when compiling.
Can I plot individual pixels using SDL?
Jonny D


Joined: 12 Sep 2009
Posts: 932
I'm wondering why a putpixel function is suddenly so desirable to you guys...  Smile

Anyhow, just use SDL_MapRGBA() to get a Uint32 instead of the int that Jeff's code uses.  I'm pretty sure you can easily find the same code elsewhere online.


Jonny D






On Sun, Mar 1, 2015 at 4:56 PM, MrTAToad wrote:
Quote:



bilsch01 wrote:




MrTAToad wrote:

You would use SDL_RenderDrawPoint for rendering to a texture/screen




I can run other SDL programs so I think I have the SDL libraries I need. But when I put SDL_RenderDrawPoint in the program I get the following error:

sdlsnx2.c.text+0x192): undefined reference to `SDL_RenderDrawPoint'
collect2: error: ld returned 1 exit status

Is there some other library or header file I need? I notice the command is not included in the reference pages at:
http://www.libsdl.org/release/SDL-1.2.15/docs/html/. Apparently that site is missing some commands. Can you tell me a site that has complete set of SDL commands? Thanks.



I would go with the fact that your library pathing is somewhat inaccurate - you need to
#include "SDL2.h" and make sure that the libraries are accessible when compiling.


_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Can I plot individual pixels using SDL?
j_post
Guest

On Sunday 01 March 2015 13:00:21 Jonathan Dearborn wrote:
Quote:
I'm wondering why a putpixel function is suddenly so desirable to you
guys... Smile

It has its uses.

(Disclaimer: I don't write games. I use SDL for application software involving
math and/or software development tools. I've also done some wrapper
applications for graphic and video software on Linux.)

Quote:

Anyhow, just use SDL_MapRGBA() to get a Uint32 instead of the int that
Jeff's code uses.

Actually, it is a Uint32. I set up the colors I need for my app during
initialization.

Uint32 red;

red = SDL_MapRGB(vfmt, (Uint8) 0xa6, (Uint8) 0x00, (Uint8) 0x00);

and likewise for other colors. The colors are stored in an indexed array for
speed.

I probably should change the declaration of setPixel's color
void setPixel(int x, int y, int color)
to be Uint32 instead of int just to be pedantic, but on both my 32 bit and 64
bit machines, an int is 32 bits so it's no big deal. (64 bits is a 'long' to
the compiler.)

<rant>

And as for the licensing issues....

C'mon guys, this is trivial code! It's not a big deal. Do what you want with
it except don't try to claim you have exclusive rights to it and can prevent
others from using it in their projects, which is what I mean by 'proprietary'.

Okay, maybe I'm a bit overly sensitive on that issue right now. I'm having to
deal with an a-hole lawyer in a civil case who bitches about nickels and dimes
when hundreds of thousands of dollars are at stake. He's convinced me that
'Stupidity 101' was a required course at his law school. Let's behave like
grown-up software developers and not a-hole lawyers, okay?

(And just in case anyone might be feeling a little sympathy for my plight,
don't bother. My lawyer intends to ask the court to issue sanctions against
the a-hole because in addition to his stupidity, he's lied on forms he signed
under penalty of perjury and we can prove it.)

</rant>

Jeff

_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
Re: Can I plot individual pixels using SDL?
Alex


Joined: 19 Sep 2014
Posts: 35
j_post wrote:
C'mon guys, this is trivial code! It's not a big deal. Do what you want with
it except don't try to claim you have exclusive rights to it and can prevent
others from using it in their projects, which is what I mean by 'proprietary'.

Jeff, can you, please, post a link to your code (at any site)? I don't like to show my email at public forum.
Re: Can I plot individual pixels using SDL?
bilsch01


Joined: 26 Feb 2015
Posts: 55
Location: Seattle, WA, USA
j_post wrote:
On Sunday 01 March 2015 05:46:34 bilsch01 wrote:
Quote:
I don't see that the code posted by Jeff will plot a
pixel.

It sets the pixel in the SDL_Surface pointed to by 'screen'. At some point you
need to call SDL_UpdateRect to actually display the changes, but you don't
want to do that after every call to setPixel or it will be *real* slow.

What my code (call 'polygraph' for polynomial graphing) does is plot the
entire function within the applicable domain and range using calls to setPixel
and only then calls SDL_UpdateRect. I've never actually timed how long it
takes since once it begins plotting, the curve appears on screen faster than a
human can detect. Good enough for my uses.

If, on the other hand, by 'plot a pixel' you mean knowing which pixel to set
to what color, that's the job of your application code.

Again, if you'd like the program's source code (which is GPL'd) I'll send you
a zip or tar.gz file, but I see no need to burden the mailing list with it. It
will compile for either Linux or Windows, but not OSX, 'cause, you know, Apple
sucks Wink

Quote:
My code computes x and y coordinates for 640x480 display and uses
TurboC putpixel() to display the computed point. putpixel is very slow.


It's been ages since I've used TurboC so I can't say for sure, but it could be
that the TurboC library is updating the displayed data (the physical screen)
after every call to putpixel(). See above.

Jeff


Thanks Jeff, but I'm going to abandon SDL for now.

Bill S.
_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
Re: Can I plot individual pixels using SDL?
bilsch01


Joined: 26 Feb 2015
Posts: 55
Location: Seattle, WA, USA
Alex wrote:
bilsch01 wrote:
The SDL2 library is in my system however I think my capability is limited to 1.2 because the compiler says UNDEFINED REFERENCE to SDL_RenderDrawPoint.

You should correctly add paths to your include and libs files when compiling and linking your app.
Try this console commands:
sdl2-config --cflags
sdl2-config --libs
Is this commands show something on your system?



Those console commands generate more errors. I'm going to abandon SDL for now. Thanks for your time.

Bill S.
Can I plot individual pixels using SDL?
j_post
Guest

On Sunday 01 March 2015 15:16:52 Alex wrote:
Quote:
j_post wrote:
Quote:
C'mon guys, this is trivial code! It's not a big deal. Do what you want
with it except don't try to claim you have exclusive rights to it and can
prevent others from using it in their projects, which is what I mean by
'proprietary'.

Jeff, can you, please, post a link to your code (at any site)? I don't like
to show my email at public forum.

I don't have a web site since AT&T reneged on their deal. Your email is in the
From header and I've sent the tar.gz file of the source code to that address.

Jeff

_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
Can I plot individual pixels using SDL?
Driedfruit
Guest

On Sun, 1 Mar 2015 14:55:30 -0800
"j_post" wrote:

Quote:
On Sunday 01 March 2015 13:00:21 Jonathan Dearborn wrote:
Quote:
I'm wondering why a putpixel function is suddenly so desirable to
you guys... Smile

It has its uses.

It certainly has. Personally, for all my pixel-crunching needs, I've
been using the putpixel/setpixel (or variations of those) described in
the SDL 1.2 docs

http://www.libsdl.org/release/SDL-1.2.15/docs/html/guidevideo.html

and although I never liked them not being in the SDL itself, I think
being in the docs is the next best thing.

--
driedfruit
_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
Can I plot individual pixels using SDL?
Jared Maddox
Guest

Quote:
Date: Sun, 1 Mar 2015 17:00:21 -0400
From: Jonathan Dearborn
To: "A list for developers using the SDL library. (includes
SDL-announce)"
Subject: Re: [SDL] Can I plot individual pixels using SDL?
Message-ID:

Content-Type: text/plain; charset="utf-8"

I'm wondering why a putpixel function is suddenly so desirable to you
guys... Smile


In my case, it's because the last time that I tried writing it myself
I eventually just gave up on debugging the code that used it.


Quote:
Anyhow, just use SDL_MapRGBA() to get a Uint32 instead of the int that
Jeff's code uses. I'm pretty sure you can easily find the same code
elsewhere online.


I already dug it up in Hg. Thanks, though.


Quote:
Jonny D

_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org