c

Best way to do alpha blending with OpenGL?

I'm drawing 2D Polygons, actually I'm drawing lots of triangles and using GLUOrtho2D. I noticed that by zooming out I got much better frame rates. I realized I was maxing out the graphics card's fill rate, not drawing too many polygons as I had initially suspected. I think this is because I'm drawing lots of overlapping polygons and usin...

Why is gmtime implemented this way?

I happened across the source for Minix's gmtime function. I was interested in the bit that calculated the year number from days since epoch. Here are the guts of that bit: http://www.raspberryginger.com/jbailey/minix/html/gmtime_8c-source.html http://www.raspberryginger.com/jbailey/minix/html/loc__time_8h-source.html #define EPOCH_YR ...

I can't make this dijkstra code compille can anyone help me? (THE ALGORITHM DESIGN MANUAL)

This Code is a code i built from the algorithm design manual book but i can't make it compile cause i've got little experience with pointers i think that's the main reason i think i can't compile it : And if someone can change a little bit in the djikstra to make it through heap with the current configuration. PLEASE HELP. #include<ios...

Trouble using Doxygen's "documentation at other places" to document macros in multiple headers

I'm working on documenting a large library of code (ANSI C, not C++), and have a platform-specific header for each of my target devices (various embedded devices and Win32). I'd like to document the typedefs and macros those headers need to define, and I thought it'd work just fine after reading the Documentation at other places section...

Android SSL JNI structure?

Hello, I have been looking at Android's javax.net.ssl package, but am still confused as to how it works with the underlying JNI glue in place. From what I see, all of the classes under the javax.net.ssl package (/libcore/x-net/src/main/java/javax/net/ssl) are abstract and do not directly implement functionality. All of the functiona...

Is the C99 preprocessor Turing complete?

After discovering the Boost preprocessor's capabilities I found myself wondering: Is the C99 preprocessor Turing complete? If not, what does it lack to not qualify? ...

How to get Xcode 3.2.3 to correctly include the SpiderMonkey jsapi.h file?

I have created a C Command Line app in Xcode 3.2.3. I have compiled SpiderMonkey from the command line, and have it working, this was for CouchDB 0.11. The js interpreter works, as well as all the files being in /usr/local/spidermonkey/include and /usr/local/spidermonkey/lib. I have added /usr/local/spidermonkey/include to my Header Pat...

Organizing test project and main executable - C & C++

I have the following directory structure. root --src ---tests src contains the source & header files (C files) for the application. When this application is built, it generates an executable. tests directory contains unit test cases (C++ files, using UnitTest++ as testing framework) for the application. In the testing project, I can ...

Problem with realloc() in C. Always hangs but compiles fine...

Hi there, I'm having some trouble with a program that is intended to be a String buffer, specifically this function is intended to reset the buffer with the string cstr. If cstr is null then the content needs to be reset to an empty char '\0'. It always hangs at the second set of realloc where it's resizing buf->contents I have no clue w...

Why does my timer stop ticking?

I'm creating a drawing application that renders OpenGL when it gets a WM_SCROLL or WM_MOUSEMOVE. The thing is that there are a lot of mouse moves and I only need it to render a maximum of 60 frames per second. So I created a bool in my engine class called CanRender. so in my render() proc I do: if(!CanRender) { return; } CanRender = fal...

clearing the contents of a file in c

Hello guys, I would like to know how the contents of a file can be cleared in c. I know it can be done using truncate but I dont find any source clearly describing it. Thanks & Regards, Mousey ...

HDR & Panoramas: where to learn

I have some ideas for software that can create HDR images or panoramas. I'd like to learn how to do these myself, for example how to create algorithms for image alignment, combining parts of images for HDR & tonemapping, etc. (Preferably in C/Obj-C, though the concepts will apply to any language.) Where are the best places to learn about...

Declaring and initializing arrays in C

Is there a way to declare first and then initialize an array in C? So far I have been initializing an array like this: int myArray[SIZE] = {1,2,3,4....}; But I need to do something like this int myArray[SIZE]; myArray = {1,2,3,4....}; ...

address space Library or Process

Hi, I have one basic doubt. I have a process which uses a shared library. If I am allocating some memory in the library then which address space it is. (Library or Process) In my opinion it is the process address space because once the library is attached it is all in process address space. Please correct me if I am wrong. Thanks Arpi...

using ansi-c on windows platform can i get time of system upto milliseconds accuracy?

hello i need to get the millisecond accuracy i take a look on this question but i am working on windows it gives linking errors for POSIX functions is there any solution help required it will be very good if i can get UTC time since 1970 with milliseconds precision, thanx in advance. ...

CreateThread issue in c under window OS

I have the following code which initiate the thread. int iNMHandleThread = 1; HANDLE hNMHandle = 0; hNMHandle = CreateThread( NULL, 0, NMHandle, &iNMHandleThread, 0, NULL); if ( hNMHandle == NULL) ExitProcess(iNMHandleThread); My question is What will happened if I run this code while the thread already in the running state. I want ...

Correct use of Stat on C

Why does this work : char *fd = "myfile.txt"; struct stat buf; stat(fd, &buf); int size = buf.st_size; printf("%d",size); But this does not work: char *fd = "myfile.txt"; struct stat *buf; stat(fd, buf); int size = buf->st_size; printf("%d",size); ...

make file running on Linux - how to ignore case sensitive?

I have a huge project, whole written in C language and I have a single make file that is used to compile it. The project C files contains lots of capitalize problems in it's header files, meaning there are tones of header files that were miss-spelled in lots of C files. The problem is I need to migrate this project to compile on Linux ma...

GdkDrawingArea on GtkImage

How can I impose GdkDrawingArea on the GtkImage for painting on an image, for example? ...

One function for addition/subtraction in "Clock arithmetic"/congruent math?

Hi, I want to "mix" char* data in this form: source = (source + some_primary_number) % 256; --the 256 line is because of I need to keep the range of char. so I can do the "mix" and "un-mix" in 2 functions - the implementation above is for the mixing and this one is for the un-mixing: source = source - some_primary_number; if ( so...