projects
/
dosdemo
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
initial raytracing experiment
[dosdemo]
/
src
/
glut
/
main.c
diff --git
a/src/glut/main.c
b/src/glut/main.c
index
fb663e6
..
a552832
100644
(file)
--- a/
src/glut/main.c
+++ b/
src/glut/main.c
@@
-11,6
+11,7
@@
#include "cfgopt.h"
#include "cgmath/cgmath.h"
#include "util.h"
#include "cfgopt.h"
#include "cgmath/cgmath.h"
#include "util.h"
+#include "cpuid.h"
static void display(void);
static void idle(void);
static void display(void);
static void idle(void);
@@
-73,7
+74,12
@@
static cgm_quat rot = {0, 0, 0, 1};
int main(int argc, char **argv)
{
glutInit(&argc, argv);
int main(int argc, char **argv)
{
glutInit(&argc, argv);
- glutInitWindowSize(800, 600);
+
+ if(glutGet(GLUT_SCREEN_HEIGHT) <= 1024) {
+ glutInitWindowSize(640, 480);
+ } else {
+ glutInitWindowSize(1280, 960);
+ }
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE);
glutCreateWindow("Mindlapse");
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE);
glutCreateWindow("Mindlapse");
@@
-96,6
+102,9
@@
int main(int argc, char **argv)
glEnable(GL_TEXTURE_2D);
glEnable(GL_CULL_FACE);
glEnable(GL_TEXTURE_2D);
glEnable(GL_CULL_FACE);
+ if(read_cpuid(&cpuid) == 0) {
+ print_cpuid(&cpuid);
+ }
if(!set_video_mode(match_video_mode(FB_WIDTH, FB_HEIGHT, FB_BPP), 1)) {
return 1;
if(!set_video_mode(match_video_mode(FB_WIDTH, FB_HEIGHT, FB_BPP), 1)) {
return 1;
@@
-117,14
+126,21
@@
int main(int argc, char **argv)
return 1;
}
time_msec = 0;
return 1;
}
time_msec = 0;
- if(demo_init(argc, argv) == -1) {
+ if(demo_init1(argc, argv) == -1) {
return 1;
}
return 1;
}
- atexit(demo_cleanup);
if(opt.fullscreen) {
set_fullscreen(opt.fullscreen);
if(opt.fullscreen) {
set_fullscreen(opt.fullscreen);
+ reshape(glutGet(GLUT_SCREEN_WIDTH), glutGet(GLUT_SCREEN_HEIGHT));
+ } else {
+ reshape(glutGet(GLUT_WINDOW_WIDTH), glutGet(GLUT_WINDOW_HEIGHT));
+ }
+
+ if(demo_init2() == -1) {
+ return 1;
}
}
+ atexit(demo_cleanup);
reset_timer();
reset_timer();
@@
-137,6
+153,11
@@
void demo_quit(void)
exit(0);
}
exit(0);
}
+void demo_abort(void)
+{
+ abort();
+}
+
struct video_mode *video_modes(void)
{
return vmodes;
struct video_mode *video_modes(void)
{
return vmodes;
@@
-428,14
+449,28
@@
static void map_mouse_pos(int *xp, int *yp)
static void mouse_button(int bn, int st, int x, int y)
{
static void mouse_button(int bn, int st, int x, int y)
{
+ int bit;
+
map_mouse_pos(&x, &y);
mouse_x = x;
mouse_y = y;
map_mouse_pos(&x, &y);
mouse_x = x;
mouse_y = y;
+ switch(bn) {
+ case GLUT_LEFT_BUTTON:
+ bit = 0;
+ break;
+ case GLUT_RIGHT_BUTTON:
+ bit = 1;
+ break;
+ case GLUT_MIDDLE_BUTTON:
+ bit = 2;
+ break;
+ }
+
if(st == GLUT_DOWN) {
if(st == GLUT_DOWN) {
- mouse_bmask |= 1 << bn;
+ mouse_bmask |= 1 << bit;
} else {
} else {
- mouse_bmask &= ~(1 << bn);
+ mouse_bmask &= ~(1 << bit);
}
}
}
}