projects
/
mesa.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
51b728c
)
clamp float colors
author
Brian
<brian.paul@tungstengraphics.com>
Thu, 26 Jul 2007 14:22:47 +0000
(08:22 -0600)
committer
Brian
<brian.paul@tungstengraphics.com>
Thu, 26 Jul 2007 14:22:47 +0000
(08:22 -0600)
progs/osdemos/ostest1.c
patch
|
blob
|
history
diff --git
a/progs/osdemos/ostest1.c
b/progs/osdemos/ostest1.c
index 001e3686162fbb2c03098098155621bae3c9cbc8..2c7adfc3537aeb8d0a422e462c892e8d61333db6 100644
(file)
--- a/
progs/osdemos/ostest1.c
+++ b/
progs/osdemos/ostest1.c
@@
-409,6
+409,8
@@
test(GLenum type, GLint bits, const char *filename)
printf("Rendering %d bit/channel image: %s\n", bits, filename);
printf("Rendering %d bit/channel image: %s\n", bits, filename);
+ OSMesaColorClamp(GL_TRUE);
+
init_context();
render_image();
if (Gradient)
init_context();
render_image();
if (Gradient)
@@
-421,7
+423,7
@@
test(GLenum type, GLint bits, const char *filename)
if (WriteFiles && filename != NULL) {
if (type == GL_UNSIGNED_SHORT) {
GLushort *buffer16 = (GLushort *) buffer;
if (WriteFiles && filename != NULL) {
if (type == GL_UNSIGNED_SHORT) {
GLushort *buffer16 = (GLushort *) buffer;
- GLubyte *buffer8 = malloc(WIDTH * HEIGHT * 4);
+ GLubyte *buffer8 =
(GLubyte *)
malloc(WIDTH * HEIGHT * 4);
int i;
for (i = 0; i < WIDTH * HEIGHT * 4; i++)
buffer8[i] = buffer16[i] >> 8;
int i;
for (i = 0; i < WIDTH * HEIGHT * 4; i++)
buffer8[i] = buffer16[i] >> 8;
@@
-430,8
+432,9
@@
test(GLenum type, GLint bits, const char *filename)
}
else if (type == GL_FLOAT) {
GLfloat *buffer32 = (GLfloat *) buffer;
}
else if (type == GL_FLOAT) {
GLfloat *buffer32 = (GLfloat *) buffer;
- GLubyte *buffer8 = malloc(WIDTH * HEIGHT * 4);
+ GLubyte *buffer8 =
(GLubyte *)
malloc(WIDTH * HEIGHT * 4);
int i;
int i;
+ /* colors may be outside [0,1] so we need to clamp */
for (i = 0; i < WIDTH * HEIGHT * 4; i++)
buffer8[i] = (GLubyte) (buffer32[i] * 255.0);
write_ppm(filename, buffer8, WIDTH, HEIGHT);
for (i = 0; i < WIDTH * HEIGHT * 4; i++)
buffer8[i] = (GLubyte) (buffer32[i] * 255.0);
write_ppm(filename, buffer8, WIDTH, HEIGHT);