~ubuntu-branches/ubuntu/natty/mesa/natty-proposed

« back to all changes in this revision

Viewing changes to progs/beos/demo.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Robert Hooker, Robert Hooker, Christopher James Halse Rogers
  • Date: 2010-09-14 08:55:40 UTC
  • mfrom: (1.2.28 upstream)
  • Revision ID: james.westby@ubuntu.com-20100914085540-m4fpl0hdjlfd4jgz
Tags: 7.9~git20100909-0ubuntu1
[ Robert Hooker ]
* New upstream git snapshot up to commit 94118fe2d4b1e5 (LP: #631413)
* New features include ATI HD5xxx series support in r600, and a vastly
  improved glsl compiler.
* Remove pre-generated .pc's, use the ones generated at build time
  instead.
* Remove all references to mesa-utils now that its no longer shipped
  with the mesa source.
* Disable the experimental ARB_fragment_shader option by default on
  i915, it exposes incomplete functionality that breaks KDE compositing
  among other things. It can be enabled via driconf still. (LP: #628930).

[ Christopher James Halse Rogers ]
* debian/patches/04_osmesa_version.diff:
  - Refresh for new upstream
* Bugs fixed in this release:
  - Fixes severe rendering corruption in Unity on radeon (LP: #628727,
    LP: #596292, LP: #599741, LP: #630315, LP: #613694, LP: #599741).
  - Also fixes rendering in gnome-shell (LP: #578619).
  - Flickering in OpenGL apps on radeon (LP: #626943, LP: #610541).
  - Provides preliminary support for new intel chips (LP: #601052).
* debian/rules:
  - Update configure flags to match upstream reshuffling.
  - Explicitly remove gallium DRI drivers that we don't want to ship.
* Update debian/gbp.conf for this Maverick-specific packaging
* libegl1-mesa-dri-x11,kms: There are no longer separate kms or x11 drivers
  for EGL, libegl1-mesa-drivers now contains a single driver that provides
  both backends.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
 
2
 
// Simple BeOS GLView demo
3
 
// Written by Brian Paul
4
 
// Changes by Philippe Houdoin
5
 
// This file is in the public domain.
6
 
 
7
 
 
8
 
 
9
 
#include <stdio.h>
10
 
#include <Application.h>
11
 
#include <Window.h>
12
 
#include <GLView.h>
13
 
 
14
 
class MyGL : public BGLView
15
 
{
16
 
public:
17
 
        MyGL(BRect rect, char *name, ulong options);
18
 
 
19
 
        virtual void AttachedToWindow();
20
 
        virtual void Pulse();
21
 
        virtual void FrameResized(float w, float h);
22
 
 
23
 
private:
24
 
        void Render();
25
 
        void Reshape(float w, float h);
26
 
        float mAngle;
27
 
};
28
 
 
29
 
 
30
 
class MyWindow : public BWindow
31
 
{
32
 
public:
33
 
        MyWindow(BRect frame);
34
 
        virtual bool QuitRequested();
35
 
};
36
 
 
37
 
 
38
 
MyWindow::MyWindow(BRect frame)
39
 
   : BWindow(frame, "demo", B_TITLED_WINDOW, B_NOT_ZOOMABLE)
40
 
{
41
 
   // Make OpenGL view and put it in the window
42
 
   BRect r = Bounds();
43
 
   r.InsetBy(5, 5);
44
 
   
45
 
   MyGL *gl = new MyGL(r, "GL", BGL_RGB | BGL_DOUBLE);
46
 
   AddChild(gl);
47
 
   SetPulseRate(1000000 / 30);
48
 
}
49
 
 
50
 
bool MyWindow::QuitRequested()
51
 
{
52
 
   be_app->PostMessage(B_QUIT_REQUESTED);
53
 
   return true;
54
 
}
55
 
 
56
 
 
57
 
 
58
 
MyGL::MyGL(BRect rect, char *name, ulong options)
59
 
   : BGLView(rect, name, B_FOLLOW_ALL_SIDES, B_PULSE_NEEDED, options)
60
 
{
61
 
        mAngle = 0.0;
62
 
}
63
 
 
64
 
 
65
 
void MyGL::AttachedToWindow()
66
 
{
67
 
        BGLView::AttachedToWindow();
68
 
 
69
 
        LockGL();
70
 
        glClearColor(0.7, 0.7, 0, 0);
71
 
        Reshape(Bounds().Width(), Bounds().Height());
72
 
        UnlockGL();
73
 
}
74
 
 
75
 
 
76
 
void MyGL::FrameResized(float w, float h)
77
 
{
78
 
        BGLView::FrameResized(w, h);
79
 
 
80
 
        LockGL();
81
 
        Reshape(w, h);
82
 
        UnlockGL();
83
 
 
84
 
        Render();
85
 
}
86
 
 
87
 
 
88
 
void MyGL::Pulse()
89
 
{
90
 
        mAngle += 1.0;
91
 
        Render();
92
 
}
93
 
 
94
 
 
95
 
void MyGL::Render()
96
 
{
97
 
    LockGL();
98
 
 
99
 
    glClear(GL_COLOR_BUFFER_BIT);
100
 
    
101
 
    glPushMatrix();
102
 
 
103
 
    glRotated(mAngle, 0, 0, 1);
104
 
    glColor3f(0, 0, 1);
105
 
 
106
 
    glBegin(GL_POLYGON);
107
 
    glVertex2f(-1, -1);
108
 
    glVertex2f( 1, -1);
109
 
    glVertex2f( 1,  1);
110
 
    glVertex2f(-1,  1);
111
 
    glEnd();
112
 
 
113
 
        glPopMatrix();
114
 
 
115
 
    SwapBuffers();
116
 
 
117
 
    UnlockGL();
118
 
}
119
 
 
120
 
 
121
 
void MyGL::Reshape(float w, float h)
122
 
{
123
 
        glViewport(0, 0, (int) (w + 1), (int) (h + 1));
124
 
        glMatrixMode(GL_PROJECTION);
125
 
        glLoadIdentity();
126
 
        glFrustum(-1, 1, -1, 1, 10, 30);
127
 
        glMatrixMode(GL_MODELVIEW);
128
 
        glLoadIdentity();
129
 
        glTranslatef(0, 0, -18);
130
 
}
131
 
 
132
 
 
133
 
int main(int argc, char *argv[])
134
 
{
135
 
   BApplication *app = new BApplication("application/demo");
136
 
 
137
 
   // make top-level window
138
 
   MyWindow *win = new MyWindow(BRect(100, 100, 500, 500));
139
 
   win->Show();
140
 
 
141
 
    app->Run();
142
 
 
143
 
   delete app;
144
 
 
145
 
   return 0;
146
 
}