Pixel output in OpenGl?

Started by
6 comments, last by Kranomano 23 years, 2 months ago
Im willing to bet this has been asked before, but how would I write an RGB value to a specific x and y screen coord in OpenGl? Please give me some code, maybe a function like PutPixel(int x, int y, float r, float g, float b) or something. Thanks
Advertisement
for color use glColor3f and use float value, if you don''t like them, get use to them, if not I think you can also use glColor3i or something like that, for specifics go here http://www.eecs.tulane.edu/www/graphics/doc/OpenGL-Man-Pages/opengl_index_spec.html is as all the OGL functions. To position your pixel use glTranslate3f and then use glBegin(GL_POINTS) you can set the point size with a function , just look at the functions list on the site I mentioned you should find it.

WHO DO THEY
THINK THEY''RE
FOOLING : YOU ?



GARAL website
WHO DO THEYTHINK THEY'REFOOLING : YOU ?
glDrawPixels(....)

http://members.xoom.com/myBollux
You know what? Never mind. From what Im hearing, glDrawPixels is way too slow for what I want to do... I'll just use DX. Thanks anyway.

Edited by - Kranomano on January 26, 2001 8:56:46 PM
The way to draw single pixels effectively is, as previously mentioned) to use the ''GL_POINTS'' primitive (with antialiasing off and a 2D ortho projection).
To draw batches (rectangles) of pixels you can use glDrawPixels, also mentioned previously (though a textured quad will generally give better performance).

However - I''d say that if you have an intention of writing very many single pixels to the GL framebuffer then either your design is at fault or you''ve chosen the wrong API.

Jans.
>>You know what? Never mind. From what Im hearing, glDrawPixels is way too slow for what I want to do... I''ll just use DX. Thanks anyway<<

what exactlly do u wanna do.

question: why was direct access (ie directdraw) to the frame buffer dropped in directx8

answer: cause it causes major slowdowns

http://members.xoom.com/myBollux
I was planning on making a 2d library, like the turbo graphics library from the turbo c++. Just some handy, easy way to do 2d gfx without a bunch of work. I do stuff like that a lot...

Im familiar with OGL, thats why I wanted to use it, but I''ll just learn a little DX for it.
maybe u wanna have a look at SDL
http://www.libsdl.org/

supports directdraw under windows as well as opengl.

quite a few programs have been written using it eg for linux simcity 3000 , tribes2 , quake3 , deus ex
etc

http://members.xoom.com/myBollux

This topic is closed to new replies.

Advertisement