Sorry for the late reply - this was due a while ago :D
Thanks for the suggestions all
Type: Posts; User: Kernel Sanders
Sorry for the late reply - this was due a while ago :D
Thanks for the suggestions all
Those are integers, so it makes the values in the texture go up in steps. For example, if RED_STEP is 14, 0-13 maps to 0, 14-27 maps to 14, 28-41 maps to 28, etc.
I changed the 3 to GL_RGB, but...
I'm writing a pixel shader for a class, and the final step is to use a 1D texture to map whatever color the fragment would be under phong shading to another color to produce a banding effect. When I...
Wouldn't I just get a short count?
I already wrote the wrappers, I just have to test the things. When read/write return normally everything works, but I have to test how the wrappers behave...
I wrote assembly wrappers for read/write system calls for an embedded lab, and now I need to test how it handles errors. How can I generate errors in read/write calls? Short counts I can do, but I...
Finally found a solution. There needs to be a
_errno
.word errno
block. _errno is then synonymous with the address of the external symbol errno. It worked as described, you just...
Well it's assembly so you don't declare variables as such. We've tried
EXTERN errno
EXTERN errno
extern errno
Google dug all three up. All gave the error
I unfortunately need to work within the confines of the lab. There are errno.h and errno.c which declare and initialize errno, we just have to write read.S, which must set the already declared...
For my embedded systems course we are writing assembly wrappers for syscalls. When in error we need to set the global errno (defined in the class's own files not the normal libc) as expected. How...
As a C programmer doing C++ stuff a few things are still confusing to me. One is scope. Consider the following code
#include <vector>
using std::vector;
class A_Class{
public:
...
I see. Thank you
O1 and O2 do the same thing
Really? The 32x4 signed is the example the gcc manual uses (page 332).
typedef int v4si __attribute__ ((vector_size (16)));
v4si a, b, c;
c = a + b;
I'm trying to get the hand of using SSE instructions through gcc, and I can't get multiplication to work.
Here is my code and my Makefile
simd.c
#include <stdio.h>
#include <stdlib.h>
...
I found the problem, and it was a pretty common one. Apparently the programmer (me) is an idiot. It works fine even without the extern C declaration - there was a standard library that the given...
Not mixing C code with C++ code, using a gcc compiled C library in a g++ compiled C++ program
I'm writing a program for class, and given the task (it's a computer graphics class) C++ is much easier to work with. I have everything ported and compiling in C++, but the instructors gave us a...
sin(2x) = 2*sin(x)*cos(x)
9/16 = cos(x) / (2 * sin(x) * cos(x))
9/8 = 1/sin(x)
sin(x) = 8/9
x = arcsin(8/9)
With few exceptions all valid C code is valid C++ code, so no, there is nothing that C can do that C++ can't. When people call C low level it is in comparison to languages like perl or java or...
Change
for (ii = 0; ii<max_i+1; ++ii)
{
for (jj = 0; jj<max_j+1; ++jj)
to
It won't print anything until it hits eof. Hitting enter just gives it more and more newlines, which it parses before asking for another character
Control-D = eof when inputting via command line
Declare it as a 'double **' instead of a 'double [][]'
The syntax for accessing the elements is identical
I would also suggest returning -1 or something similar if the 'i==j==2' fails instead...
Off topic - can you recommend a good reference for C++'s const keyword? As a C programmer learning C++ const is one of my stumbling blocks
string s("whatever");
char *cs = s.c_str();
Google is your friend :)
Append with the += operator and convert it to a C string char * with the c_str() function
It would depend on the hardware, but a 256 byte array can easily fit into a cache, so I'd have to guess that reading would be faster. I'm not sure what effect the addition of a branch would have...