<ul><li><a href="#EXAMPLE">EXAMPLE</a></li>
</ul>
</li>
-<li><a href="#SEE_ALSO">SEE ALSO</a>
+<li><a href="#SEE_ALSO">SEE ALSO</a></li>
+<li><a href="#AUTHORS">AUTHORS</a>
</li>
</ul><hr />
<!-- INDEX END -->
use SDL::Event;
use OpenGL qw(:all);
- my ($SDLAPP, $WIDTH, $HEIGHT, $SDLEVENT);
+</pre>
+<p>You can use OpenGL as needed here.</p>
+<pre> my ($SDLAPP, $WIDTH, $HEIGHT, $SDLEVENT);
$| = 1;
$WIDTH = 1024;
$HEIGHT = 768;
- $SDLAPP = SDLx::App->new(-title => "Opengl App", -width => $WIDTH, -height => $HEIGHT, -gl => 1);
+ $SDLAPP = SDLx::App->new(title => "Opengl App", width => $WIDTH, height => $HEIGHT, gl => 1);
$SDLEVENT = SDL::Event->new;
-
-
-
- glEnable(GL_DEPTH_TEST);
+</pre>
+<p>SDLx::App can start an OpenGL application with the parameter gl => 1.</p>
+<pre> glEnable(GL_DEPTH_TEST);
glMatrixMode(GL_PROJECTION);
glLoadIdentity;
gluPerspective(60, $WIDTH / $HEIGHT, 1, 1000);
glTranslatef(0, 0, -20);
-
-
-
- while (1) {
+</pre>
+<p>Above we enable GL and set the correct prespective</p>
+<pre> while (1) {
&handlepolls;
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glRotatef(.1, 1, 1, 1);
$SDLAPP->sync;
}
-
-
-
-
-
-
- sub drawscene {
+</pre>
+<p>For SDLx::App sync handles the GL buffer clean.</p>
+<pre> sub drawscene {
my ($color, $x, $y, $z);
for (-2 .. 2) {
-
-
-
-
-
-
-
-
-
sub draw_cube {
my (@indices, @vertices, $face, $vertex, $index, $coords);
return "";
}
-
-
-
-
-
-
-
-
-
- sub handlepolls {
+</pre>
+<p>Below we can use SDL::Events as normal:</p>
+<pre> sub handlepolls {
my ($type, $key);
SDL::Events::pump_events();
</div>
<h1 id="SEE_ALSO">SEE ALSO</h1><p><a href="#TOP" class="toplink">Top</a></p>
<div id="SEE_ALSO_CONTENT">
-<p><a href="http://search.cpan.org/perldoc?perl">perl</a> <a href="http://search.cpan.org/perldoc?SDLx::App">SDLx::App</a> <a href="http://search.cpan.org/perldoc?OpenGL">OpenGL</a></p>
+<p><a href="http://search.cpan.org/perldoc?perl">perl</a> <a href="SDLx-App.html">SDLx::App</a> <a href="http://search.cpan.org/perldoc?OpenGL">OpenGL</a> </p>
+
+</div>
+<h1 id="AUTHORS">AUTHORS</h1><p><a href="#TOP" class="toplink">Top</a></p>
+<div id="AUTHORS_CONTENT">
+<p>See <a href="/SDL.html#AUTHORS">/SDL.html#AUTHORS</a>.</p>
+
+
+
+
</div>
</div>
\ No newline at end of file