Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Compiling Open Source Projects
Index -> Programming, C -> C Help
Goto page Previous  1, 2
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
mirhagk




PostPosted: Tue Nov 16, 2010 12:57 am   Post subject: RE:Compiling Open Source Projects

okay I added the .lib file to the linker's additional dependencies list... but the above problems still exist.

Edit: There was actually two library files to include, and I forgot I was working with a different project than normal. But now it actually compiled and ran (although since I cut out the code that displays the video and stuff it's not very useful.) Time to test it out a little, then next step, compile all this as a .dll so I can utilize it with C#

Edit2: So now I don't know how to actually create any sort of graphical ouput in C. Here's the function I need to replicate (this uses glut and pthread, both of which are really awkward and dificult to use on windows). Is there some sort of way to just draw a screen with the data sent to this function, it doesnt have to be fancy, doesnt have to be fast, doesnt have to be cross-platform or extendable, I just need to get something working like right now to make sure that the device is working correctly.

void rgbimg(uint8_t *buf, int width, int height)
{
int i;

pthread_mutex_lock(&gl_backbuf_mutex);
memcpy(gl_rgb_back, buf, width*height*3);
pthread_mutex_unlock(&gl_backbuf_mutex);
}
Sponsor
Sponsor
Sponsor
sponsor
TheGuardian001




PostPosted: Tue Nov 16, 2010 2:08 am   Post subject: Re: Compiling Open Source Projects

If I'm correct in assuming that the function is copying the the raw pixel data to opengl's rgb buffer, you can probably just replace it with a glDrawPixels call.

code:

void rgbimg(uint8_t *buf, int width, int height)
{
    glDrawPixels(width, height, GL_RGB, GL_UNSIGNED_BYTE_2_3_3, buf);
}

If you get output, but the colours are incorrect, try changing the 4th parameter to _3_3_2 instead of _2_3_3.

Of course, I could be completely misreading that function (I have no idea how pthread works or what it does,) but I see no reason why the library should be using a memcpy for video output.

As for actually getting yourself a rendering context (assuming you don't already have a window to render to,) I recommend SDL, since it's simple, effective, and best of all has a pre-compiled library, meaning it isn't any hassle to get it running.

Getting yourself an opengl window is as simple as
code:

SDL_Init(SDL_INIT_VIDEO);
SDL_Surface *screen;
screen = SDL_SetVideoMode(800,600,32,SDL_OPENGL)
Display posts from previous:   
   Index -> Programming, C -> C Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 2 of 2  [ 17 Posts ]
Goto page Previous  1, 2
Jump to:   


Style:  
Search: