Re: XS hacking

[email protected] (Kartik Thakore)
Newsgroups perl.sdl.devel
Message-ID <[email protected]>
Andreas I am not sure why this is not working. If I can see the entire  
code base I can investigate. Maybe it might be time to fork my git  
repo. More over it might be helpful to take a look at pogl (opengl  
perl bindings, opengl on cpan). They do a way better job with bindings  
then we do. I was conltemplating just using their code.

Kartik Thakore

On 4-Sep-09, at 2:05 PM, "Andreas Lund" <[email protected]> wrote:

> Fri, 4 Sep 2009 12:03:11 -0400, Kartik Thakore <[email protected] 
> >
> wrote:
>> That's fine add those constants to opengl/constants.pm
>
> The constants are already there. After some more reading, here's  
> what I'm
> doing at the moment:
>
> # Opengl.xs:
>
> SV *
> glGetString( name )
>  GLenum name
>  CODE:
>    printf("glGetString(%d) = %s\n", (int) name, (char *)  
> glGetString(name));
>    RETVAL = newSVpv((char *) glGetString(name), 0);
>  OUTPUT:
>    RETVAL
>
>
> # sdl-test:
>
> #!/usr/bin/perl
> use SDL;
> use SDL::OpenGL;
>
> print "Simple DirectMedia Layer (SDL) ".$SDL::VERSION."\n";
>
> print "Driver: ".glGetString(GL_RENDERER)."\n"
>  if defined glGetString(GL_RENDERER);
>
> print "Vendor: ".glGetString(GL_VENDOR)."\n"
>  if defined glGetString(GL_VENDOR);
>
> print "OpenGL: ".glGetString(GL_VERSION)."\n"
>  if defined glGetString(GL_VERSION);
>
>
> The output?
>
> Simple DirectMedia Layer (SDL) 2.2.2.11
> glGetString(7937) = (null)
> glGetString(7936) = (null)
> glGetString(7938) = (null)
>
> As you can see, the constants GL_RENDERER, GL_VENDOR and GL_VERSION  
> are
> properly defined, but the C functions do not return what I'm  
> expecting.
>
> According to the OpenGL docs, the prototype is
>  const GLubyte * glGetString(GLenum name);
> What am I missing here? I'm a bit unsure about the meaning of the  
> 'const'
> keyword, could this be the problem?
>
> -
> Andreas Lund ([email protected])
> Tel: +47 90077162
> #include <disclaimer.h>
> "Look at you hacker, panting and sweating as you run through my  
> corridors.
> How can you challenge a perfect immortal machine?" -- SHODAN, System  
> Shock
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.