Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrea Weikert <elubie@gmx.net>2007-09-02 21:25:03 +0400
committerAndrea Weikert <elubie@gmx.net>2007-09-02 21:25:03 +0400
commit356ab943736e8a2434a8ff5845873482597ba5e2 (patch)
tree910356ace904dc4f11f1daf15330bb0827934f5b /source/blender/src/glutil.c
parent22c23fb04f7f1297b971f03d69b8b04b7dd9caa4 (diff)
== imagebrowser ==
Initial commit of imagebrowser in trunk. BIG COMMIT! Main changes: * completely reworked imasel space * creation and storage of the preview images for materials, textures, world and lamp * thumbnails of images and movie files when browsing in the file system * loading previews from external .blend when linking or appending * thumbnail caching according to the Thumbnail Managing Standard: http://jens.triq.net/thumbnail-spec/ * for now just kept imasel access mostly as old imgbrowser (CTRL+F4, CTRL+F1) a bit hidden still. * filtering of file types (images, movies, .blend, py,...) * preliminary managing of bookmarks ('B' button to add, XKEY while bookmark active to delete) More detailed info which will be updated here: http://wiki.blender.org/index.php/User:Elubie/PreviewImageBrowser Places that need special review (and probably fixes): * BLO_blendhandle_get_previews in readblenentry * readfile.c: do_version and refactorings of do_library_append * UI integration TODO and known issues still: * Accented characters do not display correctly with international fonts * Crash was reported when browsing in directory with movie files * Bookmark management still needs some UI work (second scrollbar?), feedback here is welcome! Credits: Samir Bharadwaj (samirbharadwaj@yahoo.com) for the icon images. Many thanks to everyone who gave feedback and helped so far!
Diffstat (limited to 'source/blender/src/glutil.c')
-rw-r--r--source/blender/src/glutil.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/source/blender/src/glutil.c b/source/blender/src/glutil.c
index 248d36dcb1e..13922bb7eef 100644
--- a/source/blender/src/glutil.c
+++ b/source/blender/src/glutil.c
@@ -50,6 +50,11 @@
#include "BIF_glutil.h"
#include "BIF_mywindow.h"
+#ifndef GL_CLAMP_TO_EDGE
+#define GL_CLAMP_TO_EDGE 0x812F
+#endif
+
+
/* Invert line handling */
#define glToggle(mode, onoff) (((onoff)?glEnable:glDisable)(mode))
@@ -263,10 +268,17 @@ void glaDrawPixelsTex(float x, float y, int img_w, int img_h, int format, void *
int nsubparts_x= (img_w+(tex_w-1))/tex_w;
int nsubparts_y= (img_h+(tex_h-1))/tex_h;
- glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
+ /* Specify the color outside this function, and tex will modulate it.
+ * This is useful for changing alpha without using glPixelTransferf()
+ */
+ glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glPixelStorei(GL_UNPACK_ROW_LENGTH, img_w);
glBindTexture(GL_TEXTURE_2D, texid);
+ /* don't want nasty border artifacts */
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
+
for (subpart_y=0; subpart_y<nsubparts_y; subpart_y++) {
for (subpart_x=0; subpart_x<nsubparts_x; subpart_x++) {
int subpart_w= (subpart_x==nsubparts_x-1)?(img_w-subpart_x*tex_w):tex_w;
@@ -278,17 +290,16 @@ void glaDrawPixelsTex(float x, float y, int img_w, int img_h, int format, void *
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, subpart_w, subpart_h, GL_RGBA, GL_FLOAT, &f_rect[(subpart_y*tex_w)*img_w*4 + (subpart_x*tex_w)*4]);
else
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, subpart_w, subpart_h, GL_RGBA, GL_UNSIGNED_BYTE, &uc_rect[(subpart_y*tex_w)*img_w*4 + (subpart_x*tex_w)*4]);
-
- glColor3ub(255, 255, 255);
+
glEnable(GL_TEXTURE_2D);
glBegin(GL_QUADS);
glTexCoord2f(0, 0);
glVertex2f(rast_x, rast_y);
- glTexCoord2f((float) subpart_w/tex_w, 0);
+ glTexCoord2f((float) (subpart_w-1)/tex_w, 0);
glVertex2f(rast_x+subpart_w*xzoom, rast_y);
- glTexCoord2f((float) subpart_w/tex_w, (float) subpart_h/tex_h);
+ glTexCoord2f((float) (subpart_w-1)/tex_w, (float) subpart_h/tex_h);
glVertex2f(rast_x+subpart_w*xzoom, rast_y+subpart_h*yzoom);
glTexCoord2f(0, (float) subpart_h/tex_h);