annotate src/imtk.c @ 13:9c7987064bb0
- fixed the frame drawing a bit
- added global alpha value and various drawing parameters
- backported the checkbox check mark from glamtk
- fixed progress bar drawing so that the bevels of the trough and the bar won't overlap
author |
John Tsiombikas <nuclear@siggraph.org> |
date |
Mon, 18 Apr 2011 06:15:46 +0300 |
parents |
6d35e6c7b2ca |
children |
c7a7ddbe7714 |
rev |
line source |
nuclear@3
|
1 #include <stdio.h>
|
nuclear@2
|
2 #include <stdlib.h>
|
nuclear@1
|
3 #include <string.h>
|
nuclear@2
|
4 #include <ctype.h>
|
nuclear@0
|
5 #include <assert.h>
|
nuclear@0
|
6 #ifndef __APPLE__
|
nuclear@0
|
7 #include <GL/glut.h>
|
nuclear@0
|
8 #else
|
nuclear@0
|
9 #include <GLUT/glut.h>
|
nuclear@0
|
10 #endif
|
nuclear@0
|
11 #include "imtk.h"
|
nuclear@7
|
12 #include "state.h"
|
nuclear@13
|
13 #include "draw.h"
|
nuclear@1
|
14
|
nuclear@0
|
15
|
nuclear@13
|
16 void imtk_post_redisplay(void)
|
nuclear@13
|
17 {
|
nuclear@13
|
18 glutPostRedisplay();
|
nuclear@13
|
19 }
|
nuclear@13
|
20
|
nuclear@0
|
21 void imtk_begin(void)
|
nuclear@0
|
22 {
|
nuclear@7
|
23 int width, height;
|
nuclear@7
|
24
|
nuclear@7
|
25 imtk_get_viewport(&width, &height);
|
nuclear@7
|
26
|
nuclear@0
|
27 glMatrixMode(GL_PROJECTION);
|
nuclear@0
|
28 glPushMatrix();
|
nuclear@0
|
29 glLoadIdentity();
|
nuclear@0
|
30 glTranslatef(-1, 1, 0);
|
nuclear@7
|
31 glScalef(2.0 / width, -2.0 / height, 1.0);
|
nuclear@2
|
32
|
nuclear@2
|
33 glMatrixMode(GL_MODELVIEW);
|
nuclear@2
|
34 glPushMatrix();
|
nuclear@2
|
35 glLoadIdentity();
|
nuclear@2
|
36
|
nuclear@2
|
37 glPushAttrib(GL_ENABLE_BIT);
|
nuclear@2
|
38 glDisable(GL_DEPTH_TEST);
|
nuclear@2
|
39 glDisable(GL_CULL_FACE);
|
nuclear@2
|
40 glDisable(GL_LIGHTING);
|
nuclear@13
|
41 glEnable(GL_BLEND);
|
nuclear@13
|
42
|
nuclear@13
|
43 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
nuclear@0
|
44 }
|
nuclear@0
|
45
|
nuclear@0
|
46 void imtk_end(void)
|
nuclear@0
|
47 {
|
nuclear@2
|
48 glPopAttrib();
|
nuclear@2
|
49
|
nuclear@0
|
50 glMatrixMode(GL_PROJECTION);
|
nuclear@0
|
51 glPopMatrix();
|
nuclear@2
|
52 glMatrixMode(GL_MODELVIEW);
|
nuclear@2
|
53 glPopMatrix();
|
nuclear@0
|
54 }
|
nuclear@0
|
55
|
nuclear@13
|
56 void imtk_label(const char *str, int x, int y)
|
nuclear@0
|
57 {
|
nuclear@13
|
58 glColor4fv(imtk_get_color(IMTK_TEXT_COLOR));
|
nuclear@13
|
59 imtk_draw_string(x, y, str);
|
nuclear@0
|
60 }
|
nuclear@0
|
61
|
nuclear@1
|
62
|
nuclear@13
|
63 /*
|
nuclear@4
|
64 int imtk_combobox(int id, char *textbuf, size_t buf_sz, const char *list, int sel, int x, int y)
|
nuclear@4
|
65 {
|
nuclear@4
|
66 imtk_textbox(id + 1, textbuf, buf_sz, x, y);
|
nuclear@4
|
67 imtk_button(id + 3, "V", x + TEXTBOX_SIZE, y);
|
nuclear@4
|
68
|
nuclear@4
|
69 if(prev_active == id + 3) {
|
nuclear@4
|
70 sel = imtk_listbox(id + 5, list, sel, x, y + 20);
|
nuclear@4
|
71 }
|
nuclear@4
|
72 return sel;
|
nuclear@4
|
73 }
|
nuclear@13
|
74 */
|