@WinSysCompany sagte in In einen, mittels Pointer, relativen, addressierten, Speicher schreiben:
jip hast recht, hab jetzt ´nen
*(address + ( ImageMemory[tex].width * y * 4 ) + ( x * 4 )) = c1;
d´raus gemacht
Mhm. Und das ist mit deinen zwei for-schleifen (wenn ich mir * 4 jeweils vegdenke) genau dasselbe in unleserlich wie mein eine for-schleife oben.
@yahendrik sagte in In einen, mittels Pointer, relativen, addressierten, Speicher schreiben:
Und das ist eben undefiniert.
Rechtsshift auf signed Typen ist implementation-defined wenn ich nicht irre.
Bitwise shift operators (§6.5.7/5):
The result of E1 >> E2 is E1 right-shifted E2 bit positions. If E1 has an unsigned type or if E1 has a signed type and a nonnegative value, the value of the result is the integral part of the quotient of E1 / 2E2 . If E1 has a signed type and a negative value, the resulting value is implementation-defined.
Schlimmer für Linkshifts:
Bitwise shift operators (§6.5.7/4):
The result of E1 << E2 is E1 left-shifted E2 bit positions; vacated bits are filled with zeros. If E1 has an unsigned type, the value of the result is E1 x 2E2 , reduced modulo one more than the maximum value representable in the result type. If E1 has a signed type and nonnegative value, and E1 x 2E2 is representable in the result type, then that is the resulting value; otherwise, the behavior is undefined.
@WinSysCompany sagte in In einen, mittels Pointer, relativen, addressierten, Speicher schreiben:
[...] daher ist mir die Interpretierung (Vorzeichenlos oder nicht ) egal, da ich auf die Komponenten (R, G, B und Alpha) ehr immer durch Binäroperationen ( wie "<<" ">>" "|" oder "&" ) zugreife
Ist eben nicht egal.
@WinSysCompany sagte in In einen, mittels Pointer, relativen, addressierten, Speicher schreiben:
for ( int y = 0; y < size/2; y++) {
for ( int x = 0; x < size/2 ; x++) {
/* ... */
}
}
Willst Du eigentlich nur den linken oberen Quadranten füllen (und die anderen Pixel haben unbestimmte Werte) oder die gesamte "Textur"?