OpenGL and pixel access (might be duplicate)

Thanks for you fast reply.

Yeah, I've been fooling around with that too, my code looks like this:

void draw() {
unsigned char color[3] = { 0xFF, 0xFF, 0xFF };
int w = getWidth();
int h = getHeight();

glRasterPos2i(0, 0);

glDrawPixels(1, 1, GL_RGB, GL_UNSIGNED_BYTE, &color);

}

That, I would think, draws a white dot in top left corner. But this does not

seem to be the case, can you give me a hint to fix it? Do I need to do
something like UpdateRect?On Monday 17 May 2004 14:55, Olof Bjarnason wrote:

I think the general answer, you don’t.

Of course, you could instead use the gl write-to-buffer
functions, eg. glDrawPixels(), for overlays etc.
Mind the “raster position” mechanism of OpenGL though;
it’s a bit non-intuitive.

/Olof


Simon Ejsing, Systemudvikler
esoft ApS, http://www.esoft.dk
Skibhusvej 52C, DK-5000 Odense C.
Tlf: 70 222 466, Fax: 63 122 466

To swap the OpenGL buffers in SDL/OpenGL, you use

SDL_GL_SwapBuffers()

… which completely replaces the SDL updaterects/flip etc.
functions.

Did it help?

/Olof

Simon Ejsing: “Re: [SDL] OpenGL and pixel access (might be duplicate)”…

#On Monday 17 May 2004 14:55, Olof Bjarnason wrote:
#> I think the general answer, you don’t.
#>
#> Of course, you could instead use the gl write-to-buffer
#> functions, eg. glDrawPixels(), for overlays etc.
#> Mind the “raster position” mechanism of OpenGL though;
#> it’s a bit non-intuitive.
#>
#> /Olof#

Thanks for you fast reply.

Yeah, I’ve been fooling around with that too, my code looks like this:

#void draw() {

unsigned char color[3] = { 0xFF, 0xFF, 0xFF };

int w = getWidth();

int h = getHeight();

glRasterPos2i(0, 0);

glDrawPixels(1, 1, GL_RGB, GL_UNSIGNED_BYTE, &color);

#}

That, I would think, draws a white dot in top left corner. But this does not

#seem to be the case, can you give me a hint to fix it? Do I need to do
#something like UpdateRect?

#–
#Simon Ejsing, Systemudvikler
#esoft ApS, http://www.esoft.dk
#Skibhusvej 52C, DK-5000 Odense C.
#Tlf: 70 222 466, Fax: 63 122 466

#_______________________________________________
#SDL mailing list
#SDL at libsdl.org
#http://www.libsdl.org/mailman/listinfo/sdl