'Programming'에 해당되는 글 1773건

  1. 2015.07.20 glColor*
  2. 2015.07.20 우분투에서 openGL 시작하기
  3. 2015.07.19 lisp 키 입력
  4. 2015.07.14 void형 포인터 ++
  5. 2015.07.07 가변인자를 다시 넘겨주기 2
  6. 2015.06.24 std::endl
  7. 2015.06.18 printf 가변인자의 비밀?
  8. 2015.06.13 fasm / nasm / masm
  9. 2015.06.11 어셈블리 관련
  10. 2015.05.19 gcc 컴파일러 -D 옵션
Programming/openGL2015. 7. 20. 22:03

glColor의 경우 클램프되어 있는 변수는 아니나

내부적으로 clamp 되어 사용이 된다.


void glColor3f( GLfloat red, GLfloat green, GLfloat blue )


Neither floating-point nor signed integer values are clamped to the range [0,1] before the current color is updated. However, color components are clamped to this range before they are interpolated or written into a color buffer.

[링크 : http://linux.die.net/man/3/glcolor3f]



void glClearColor( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha )

[링크 : http://linux.die.net/man/3/glclearcolor]

Posted by 구차니
Programming/openGL2015. 7. 20. 21:48

예전에 컴파일 하는법이랑 다 적은거 같은데..

다 어디로 갔지? ㅠㅠ


$ sudo apt-get install freeglut3-dev

$ gcc -lglut -lm -lGL -lGLU test.c


[링크 : http://ubuntuforums.org/showthread.php?t=345177]


2011/09/07 - [Linux/Ubuntu] - ubuntu 에서 openGL 프로그래밍하기

2012/06/02 - [Programming/openGL] - openGL gcc에서 컴파일 하기


'Programming > openGL' 카테고리의 다른 글

openGL super bible 3rd ed - 점선면 관련  (0) 2015.07.21
glColor*  (0) 2015.07.20
GL2PS : an OpenGL to PostScript printing library  (0) 2014.03.06
openGL state variables  (0) 2013.12.12
openGL에서 AVI 동영상 재생하기  (0) 2013.04.09
Posted by 구차니
Programming/lisp2015. 7. 19. 22:36

(read)



.. 먼가 허무하네? -_-a


[링크 : http://www.tutorialspoint.com/lisp/lisp_input_output.htm]

'Programming > lisp' 카테고리의 다른 글

lisp 예제  (0) 2014.04.05
lisp 반복문 dolist, dotimes, do  (0) 2013.01.30
lisp cond  (0) 2013.01.28
lisp when/unless macro  (2) 2013.01.28
lisp 명령어 if progn  (0) 2013.01.28
Posted by 구차니
Programming/C Win32 MFC2015. 7. 14. 16:07



$ gcc -v

Using built-in specs.

COLLECT_GCC=gcc

COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.6/lto-wrapper

Target: x86_64-linux-gnu

Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro 4.6.3-1ubuntu5' --with-bugurl=file:///usr/share/doc/gcc-4.6/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.6 --enable-shared --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.6 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --enable-plugin --enable-objc-gc --disable-werror --with-arch-32=i686 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu

Thread model: posix

gcc version 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5) 


$ vi void.c

#include <stdio.h>


void main()

{

        void *fp;

        int a = 0;

        fp = &a;


        printf("sizeof(void) %d\n",sizeof(void));

        printf("fp %8X\n",fp);

        fp++;

        printf("fp %8X\n",fp);

} 

(남자니까) 경고따윈 무시한다!

$ gcc void.c

void.c: In function ‘main’:

void.c:9:2: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long unsigned int’ [-Wformat]

void.c:10:2: warning: format ‘%X’ expects argument of type ‘unsigned int’, but argument 2 has type ‘void *’ [-Wformat]

void.c:12:2: warning: format ‘%X’ expects argument of type ‘unsigned int’, but argument 2 has type ‘void *’ [-Wformat]


어? 연산이 되네? ㄷㄷㄷ 일단은 byte로 간주..

어? 게다가.. 왜 void의 sizeof가 1?

$ ./a.out
sizeof(void) 1
fp E9F5689C
fp E9F5689D


+

6.23 Arithmetic on void- and Function-Pointers


In GNU C, addition and subtraction operations are supported on pointers to void and on pointers to functions. This is done by treating the size of a void or of a function as 1.


A consequence of this is that sizeof is also allowed on void and on function types, and returns 1.


The option -Wpointer-arith requests a warning if these extensions are used.


[링크 : https://gcc.gnu.org/onlinedocs/gcc/Pointer-Arith.html]


+

Compiler Error CS0242

The operation in question is undefined on void pointers

Incrementing a void pointer is not allowed. For more information, see Unsafe Code and Pointers (C# Programming Guide).

[링크 : https://msdn.microsoft.com/en-us/library/dhyat531(v=vs.90).aspx] 


'Programming > C Win32 MFC' 카테고리의 다른 글

rand()와 RAND_MAX  (0) 2015.10.05
Cppcheck  (0) 2015.09.30
가변인자를 다시 넘겨주기  (2) 2015.07.07
printf 가변인자의 비밀?  (0) 2015.06.18
gcc 컴파일러 -D 옵션  (0) 2015.05.19
Posted by 구차니
Programming/C Win32 MFC2015. 7. 7. 13:45

현실적으로 불가능 -_-

다만 vsprintf 는 인자를 받으므로 인자를 이용해서 다시 문자열을 생성하는 식으로 쓸 수는 있음


[링크 : http://stackoverflow.com/questions/2060578/is-it-possible-to-write-a-varargs-function-that-sends-it-argument-list-to-anothe]


#include <stdio.h>

int printf(const char *format, ...);

int fprintf(FILE *stream, const char *format, ...);

int sprintf(char *str, const char *format, ...);

int snprintf(char *str, size_t size, const char *format, ...);


#include <stdarg.h>

int vprintf(const char *format, va_list ap);

int vfprintf(FILE *stream, const char *format, va_list ap);

int vsprintf(char *str, const char *format, va_list ap);

int vsnprintf(char *str, size_t size, const char *format, va_list ap);


[링크 : http://linux.die.net/man/3/vsprintf] 


'Programming > C Win32 MFC' 카테고리의 다른 글

Cppcheck  (0) 2015.09.30
void형 포인터 ++  (0) 2015.07.14
printf 가변인자의 비밀?  (0) 2015.06.18
gcc 컴파일러 -D 옵션  (0) 2015.05.19
setjmp, longjmp  (0) 2015.05.19
Posted by 구차니
Programming/C++ STL2015. 6. 24. 19:03

'\n' + fflush(stdout) 이라고 하면 되려나?


[링크 : http://www.cplusplus.com/reference/ostream/endl/]

[링크 : http://stackoverflow.com/questions/213907/c-stdendl-vs-n]

'Programming > C++ STL' 카테고리의 다른 글

cpp const  (0) 2016.06.22
const 멤버 변수 초기화(member variable initializer)  (0) 2016.06.22
c++ 현변환 연산자(cast operator in c++)  (0) 2015.01.26
functor / 펑터  (0) 2014.04.16
cpp static 변수 및 메소드  (0) 2014.03.18
Posted by 구차니
Programming/C Win32 MFC2015. 6. 18. 15:03

느낌적인 느낌으로는 가변인자는 가장 큰 변수형인 void 형을 취할테니..

printf 함수에서 %f를 double로 처리하면서 float에서는 오류가 발생하는 느낌?


아무튼.. 먼가 미묘한 작동을 하네..


[링크 : http://stackoverflow.com/questions/7295066/using-printf-to-print-out-floating-values]

[링크 : http://todayhumor.com/?programmer_11386]

'Programming > C Win32 MFC' 카테고리의 다른 글

void형 포인터 ++  (0) 2015.07.14
가변인자를 다시 넘겨주기  (2) 2015.07.07
gcc 컴파일러 -D 옵션  (0) 2015.05.19
setjmp, longjmp  (0) 2015.05.19
inline 함수..  (0) 2015.05.12
Posted by 구차니

Microsoft Macro ASseMbler

masm (16/32bit) / ml64 (64bit)

[링크 : https://en.wikipedia.org/wiki/Microsoft_Macro_Assembler]

[링크 : https://msdn.microsoft.com/en-us/library/afzk3475.aspx]


nasm

Netwide Assembler

[링크 : http://www.nasm.us/]

[링크 : https://en.wikipedia.org/wiki/Netwide_Assembler]


fasm

[링크 : http://flatassembler.net/]

[링크 : https://en.wikipedia.org/wiki/FASM]




[링크 : http://blog.naver.com/asmpro/220205244661]


'Programming > Assembly(어셈블리)' 카테고리의 다른 글

.text .data .code .bss ...  (0) 2016.02.19
어셈블리 관련  (0) 2015.06.11
ia32 어셈블리 언어  (0) 2013.12.12
.DATA? 지시어  (0) 2011.07.31
x86 register  (2) 2011.07.17
Posted by 구차니

다시 한번 도전!!! 해봐야지 ㅠㅠ


[링크 : http://todayhumor.com/?programmer_5407]

[링크 : http://stackoverflow.com/questions/8304914/difference-between-dword-ptr-and-dword-ptres]

[링크 : http://en.wikipedia.org/wiki/LOADALL]

[링크 : http://bbolmin.tistory.com/82]

'Programming > Assembly(어셈블리)' 카테고리의 다른 글

.text .data .code .bss ...  (0) 2016.02.19
fasm / nasm / masm  (0) 2015.06.13
ia32 어셈블리 언어  (0) 2013.12.12
.DATA? 지시어  (0) 2011.07.31
x86 register  (2) 2011.07.17
Posted by 구차니
Programming/C Win32 MFC2015. 5. 19. 14:35

배치빌드 하거나 할 경우 유용하게 쓰이는 옵션


-D name

Predefine name as a macro, with definition 1. 


-D name=definition

The contents of definition are tokenized and processed as if they appeared during translation phase three in a ‘#define’ directive. In particular, the definition will be truncated by embedded newline characters.

If you are invoking the preprocessor from a shell or shell-like program you may need to use the shell's quoting syntax to protect characters such as spaces that have a meaning in the shell syntax.


If you wish to define a function-like macro on the command line, write its argument list with surrounding parentheses before the equals sign (if any). Parentheses are meaningful to most shells, so you will need to quote the option. With sh and csh, -D'name(args...)=definition' works.


-D and -U options are processed in the order they are given on the command line. All -imacros file and -include file options are processed after all -D and -U options. 


-U name

Cancel any previous definition of name, either built in or provided with a -D option. 


-undef

Do not predefine any system-specific or GCC-specific macros. The standard predefined macros remain defined. 


[링크 : https://gcc.gnu.org/onlinedocs/gcc/Preprocessor-Options.html] 


+

Visual studio에서는 /D로 적용된다.

[링크 : https://msdn.microsoft.com/ko-kr/library/teas0593.aspx]

'Programming > C Win32 MFC' 카테고리의 다른 글

가변인자를 다시 넘겨주기  (2) 2015.07.07
printf 가변인자의 비밀?  (0) 2015.06.18
setjmp, longjmp  (0) 2015.05.19
inline 함수..  (0) 2015.05.12
혼돈의 카오스 - 교차참조 헤더  (0) 2015.05.11
Posted by 구차니