On Sun, Sep 27, 2009 at 2:39 AM, Christian Schmid <csch...@rapidshare.com>wrote: > >> Hi. >> >> Thank you for your valuable hints. On the one hand I want to use VBOs >> (which makes me force using POGL as you said) but on the other hand I >> want to continue using SDL for all the nice things it provides >> (furthermore it seems glut is a bit broken and no competition to SDL). >> So I am now trying to combine both worlds. Maybe I am doing something >> stupid wrong, but it seems there is some buffer problems when not using >> SDL::OpenGL. At least I don't see any window when I say "opengl => 1" >> and I see a black window when I say "opengl => 0". >> > Can you give me a bug report or some code so I can look into this?
> >> I really appreciate your help in this matter. For your coincidence, I >> set up a really short code and attached it, so you can immediately see >> whats wrong. Basically its just some cubes spinning around. Feel free to >> comment right into the code if you want. >> >> >> >> #!/usr/bin/perl >> >> use strict; >> use warnings; >> use OpenGL qw(:all); >> > use SDL; #this is needed from now on. > use SDL::App; >> use SDL::Event; >> >> my ($SDLAPP, $WIDTH, $HEIGHT, $SDLEVENT); >> >> $| = 1; >> $WIDTH = 1024; >> $HEIGHT = 768; >> $SDLAPP = SDL::App->new(-title => "Test shit", -width => $WIDTH, -height >> => $HEIGHT, -gl => 1, > > -init => SDL_INIT_VIDEO); #init only the video > $SDLEVENT = SDL::Event->new; >> >> SDL::ShowCursor(0); >> glEnable(GL_DEPTH_TEST); >> glMatrixMode(GL_PROJECTION); >> glLoadIdentity; >> gluPerspective(60, $WIDTH / $HEIGHT, 1, 1000); >> glTranslatef(0, 0, -20); >> >> >> >> while (1) { >> &handlepolls; >> glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); >> glRotatef(.1, 1, 1, 1); >> &drawscene; >> $SDLAPP->sync; >> } >> >> >> >> sub drawscene { >> my ($color, $x, $y, $z); >> >> for (-2 .. 2) { >> glPushMatrix; >> glTranslatef($_ * 3, 0, 0); >> glColor3f(1, 0, 0); >> &draw_cube; >> glPopMatrix; >> } >> >> return ""; >> } >> >> >> >> sub draw_cube { >> my (@indices, @vertices, $face, $vertex, $index, $coords); >> >> @indices = qw(4 5 6 7 1 2 6 5 0 1 5 4 >> 0 3 2 1 0 4 7 3 2 3 7 6); >> @vertices = ([-1, -1, -1], [ 1, -1, -1], >> [ 1, 1, -1], [-1, 1, -1], >> [-1, -1, 1], [ 1, -1, 1], >> [ 1, 1, 1], [-1, 1, 1]); >> >> glBegin(GL_QUADS); >> >> foreach $face (0..5) { >> foreach $vertex (0..3) { >> $index = $indices[4 * $face + $vertex]; >> $coords = $vertices[$index]; >> glVertex3f(@$coords); >> } >> } >> >> glEnd; >> >> return ""; >> } >> >> >> >> >> sub handlepolls { >> my ($type, $key); >> >> $SDLEVENT->pump; >> > # for comparing $type use the SDL_KEYDOWN and stuff provided form use SDL; > while ($SDLEVENT->poll) { >> $type = $SDLEVENT->type(); >> $key = ($type == 2 or $type == 3) ? $SDLEVENT->key_name : ""; >> >> if ($type == 4) { printf("You moved the mouse! x=%s y=%s xrel=%s >> yrel=%s\n", $SDLEVENT->motion_x, $SDLEVENT->motion_y, >> $SDLEVENT->motion_xrel, $SDLEVENT->motion_yrel) } >> elsif ($type == 2) { print "You are pressing $key\n" } >> elsif ($type == 3) { print "You released $key\n" } >> elsif ($type == 12) { exit } >> else { print "TYPE $type UNKNOWN!\n" } >> >> if ($type == 2) { >> if ($key eq "q" or $key eq "escape") { exit } >> } >> } >> >> return ""; >> } >> >> >> Kartik Thakore schrieb: >> > >> > On 26-Sep-09, at 4:06 AM, Christian Schmid <csch...@rapidshare.com> >> > wrote: >> > >> >> Hi Kartik, >> >> >> >> Thank you for your reply. I am new to OpenGL programming. I used to >> >> write everything in Perl. No matter if its a network stack or a fully >> >> blown web-custimizable FTP server. Now I am trying to code blast-away >> >> 3d-applications... in Perl. Some people say this is crazy, but I am >> sure >> >> as soon as I have created an amazing framework, it will work as well as >> >> C-applications do. >> > It should! >> >> >> >> >> >> That said, I tried figuring out what I can do in Perl without using >> Perl >> >> too much for the "loads and loads of stupid vertex work". I also rely >> on >> >> caching as good as I can, especially on models with 1 Mio Polygons, I >> >> need the VBOs. Unfortunately it seems the VBOs are only part of OpenGL >> >> 1.5 or higher, and since its not implemented in Perl-SDL, I suppose >> >> Perl-SDL does not support 1.5 yet? >> > I don't think so I would recommend looking in to Perl OpenGL. The >> > module is opengl on cpan. >> >> >> >> >> >> Sure, I could just try to implement it myself in Perl-SDL. But I think >> >> this is not the very best solution and (since I don't know anything >> >> about Perl-SDLs interna, nor libsdl) this would take a very long time I >> >> suppose. >> > If your concern is only opengl then the module I mentioned above, >> > POGL, is your best bet. >> >> >> >> >> >> So to bring it to the point: What OpenGL version is supported (at least >> >> glGenBuffers does not work). When will OpenGl 3.1 be supported? ;) Most >> >> stunning effects are only possible with the latest revision I suppose. >> > POGL has more features then SDL Perl's implementation. We are actually >> > considering to move our base to theirs. >> >> >> >> >> >> Do people widely use OpenGL with Perl-SDL? >> >> >> > I haven't seen extensive use so far. I could be wrong as I have only >> > started maintaining a month ago. >> >> What would it take for you to implement the newest OpenGL technology in >> >> Perl-SDL? >> > Help to migrate to POGL. Also a latest system which can handle the >> > latest video card would help. >> >> >> >> >> >> Do you accept motivation-pushing donations in case its much work? >> > Give a shout out to POGL devs. I am more interested in making SDL Perl >> > work well with their OpenGL. >> >> >> >> >> >> Are you still highly interested in spending time in Perl-SDL? >> >> >> > Yup :). If you are interested in SDL too besides just OpenGL, would >> > you consider setting up bounties that you would pay for and the core >> > devs of SDL would check? >> > >> > I have wanted to sell some games and pump money in the form of >> > bounties into SDL Perl, but I have been busy coding internals. >> >> What is your current occupation if I may ask? >> > I am an intern/student. That's all I am saying :p >> >> >> >> >> >> - Christian >> >> >> >> >> >> Kartik Thakore schrieb: >> >>> Hi Christian, >> >>> >> >>> Kartik Thakore >> >>> >> >>> On 26-Sep-09, at 2:39 AM, Christian Schmid <csch...@rapidshare.com> >> >>> wrote: >> >>> >> >>>> Hello. >> >>>> >> >>>> As far as I have found out, you are the main maintainer of >> >>>> perl-sdl. Is >> >>>> this correct? >> >>> Yes this is correct. >> >>>> >> >>>> >> >>>> I have some questions about OpenGL V1.5 and later implementations in >> >>>> Perl-SDL, the future about Perl-SDL and possible donations to the >> >>>> respective hard working programmers, who have made it possible to >> >>>> produce high-performance OpenGL applications within Perl. >> >>>> I am looking >> >>>> forward for your reply. >> >>>> >> >>> What are your questions I would be glad to answer them? >> >>>> Best regards, >> >>>> Christian Schmid >> >>>> >> >>> Regards >> >>> >> > >> > >> > >