Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

glDrawPixels

Name: Sadimir 2011-10-07 10:09

Images drawn with the glDrawPixels method only come our right half of the time  =/

Create 45x45 px image -> load it -> glDrawPixels -> image is ok
Change one color in photoshop -> resave -> glDrawPixels -> half of the image is grey

Most of the tiny images drawn using glDrawPixels seem to break like that (half becomes grey or whatever), larger images around 100x100 always come out ok.

What am I doing wrong OpenGL wizards, what is it about glDrawPixels I am missing?

Name: Anonymous 2011-10-07 10:11

Show us the code and tell us the image format.

Name: Sadimir 2011-10-07 10:15

lol code
...
RGBA = (unsigned char*) malloc(size);
//RGBA - pixel buffer derp
fread(RGBA,1,size,file);
...
glDrawPixels(width,height,GL_RGBA,GL_UNSIGNED_BYTE,RGBA);
...

that's all the code there is, the file is read correctly, the image format is a 4 channel raw.

Name: Anonymous 2011-10-07 10:16

Some stupid line width padding shit?

Name: Sadimir 2011-10-07 10:22

Some stupid only works when it feels like it shit.

Name: Anonymous 2011-10-07 10:51

A lot of I didn't read the documentation shit.

Name: Sadimir 2011-10-07 11:07

A lot of yes I did shit.

Name: Anonymous 2011-10-07 17:33

Go look up the source code for glDrawPixels and don't come back until you figure out what's wrong.

Name: Anonymous 2011-10-07 18:16

what format are you using to store the image? most likely your decoder is up to shits, and/or photoshop cant into correct output.

Name: Sadimir 2011-10-08 11:50

A 4 channel raw. The reader is fine. Large images always work, small ones work sometimes... SOMETIMES!!!
Perhaps using it sets an internal state or something that I'm supposed to clear or something =/

Stupid /prog/ be more useful.

Name: FrozenVoid 2011-10-08 12:14

Name: Anonymous 2011-10-08 15:31

Deprecated method is very deprecated.

Name: Sadimir 2011-10-08 16:07

Be so kind as to suggest something better.

Name: Anonymous 2011-10-08 16:33

>>13
http://www.opengl.org/wiki/Common_Mistakes#glDrawPixels
it is recommened [sic] that you use a texture instead and just update the texture with glTexSubImage2D.

Name: Sadimir 2011-10-08 17:01

Fuck you text board.
Screencap for analysis:
http://img1.uploadscreenshot.com/images/orig/10/28016585541-orig.jpg

I guess I'll just switch to textures if nothing comes up. =/

Name: Anonymous 2011-10-08 18:00

Are you using any OS other than Windows?

Are you using a graphics card not made by nVidia?

If you answered "yes" to any of the previous questions, please test your application under Windows with nVidia hardware.

If you don't have Windows to test with, you can try under Linux using the binary drivers, but that's not as reliable.

Name: Anonymous 2011-10-08 18:33

I'm not an expert faggot or anything but don't you want image widths and heights to be multiples of 2?

Name: Anonymous 2011-10-08 18:38

>>11
See #7 here and >>8
Actually, >>8 should've been /thread.

Name: Sadimir 2011-10-08 18:39

Well yeah when I write it in multiples of 2 it's ok as I remember (i'll have to test that more) but that's too limiting for my needs =/

Name: Anonymous 2011-10-08 19:57

>>19
Are you illiterate?

READ the goddamn posts, they're trying to tell you something.

Don't change these.
Name: Email:
Entire Thread Thread List