곰탱이네

wonbear.egloos.com

포토로그 마이가든


W 위젯

메모장



OpenGL application crash at glGenVertexArrays Game Engine Development

OpenGL 4.0 사용하려고 glGenVertexArrays 함수로 VAO 핸들을 만들려고 하는데
알 수 없는 크래시가 발생하는 경우 GLEW 초기화 함수 호출 전에 다음과 같이
glewExperimental을 GL_TRUE로 설정하면 된다.

glewExperimental = GL_TRUE;
GLenum err = glewInit();


 

Maximize keyboard shortcut on Mac OS X Mac OS X

  1. Execute System Preferences... in Apple Menu.
  2. Choose Keyboard dialog, and choose Keyboard Shortcuts tab.
  3. Click the Application Shortcuts in the sidebar of the dialog.
  4. Click Add('+') button.
  5. In the Pop up, make sure that 'All Applications' is selected for Application
  6. and type "Zoom" for Menu Title
  7. and Input shortcut you want to set for Maximize feature.
  8. That's it!


Ruby 실행시 no such file to load - openssl 발생 IT

오랜만에 Ruby로 뭐 좀 해보려고 했는데
no such file to load - openssl 이라고 에러가 나오면서 Exception이 계속해서 발생한다.

좀 찾아보니 Ruby 소스에 있는 openssl을 컴파일 해서 실행시켜 줘야 정상적으로 실행이 된다.

Ubuntu Linux에서 한다고 가정하고
Ruby와 Rubygems가 다 설치되어 있는 상태에서 설치되어 있는 Ruby 소스 코드를
http://www.ruby-lang.org에서 다운로드 받는다.

소스 압축을 해제한 후에
ext/openssl 디렉토리로 이동하고

ruby extconf.rb
make
make install

하면 openssl Exception을 처리할 수 있다. -0-

=========
추가 내용
=========

실제로 openssl로 Network 통신을 하다보면 에러가 net/http 에러가 발생하는 경우가 있는데, 이럴 때는 libopenssl-ruby1.8 과 같이 Ruby 버전에 맞는 라이브러리를 설치해 주면 해결된다.


TCP/IP 구현 #1. IP 구현 WonbearOS

예전부터 만들고 있던 OS에 이제 만들어 볼 만한건 거의 해봐서 TCP/IP를 구현해 보기로 했다.
TCP/IP Protocol 문서를 보고 구현해 봤는데

리눅스에서 minicom을 통해서 OS 메시지를 받고, ping을 날려보니 잘 된다!!! ^^/

이제 TCP 구현한 다음에, TCP를 이용한 애플리케이션을 하나 만들어서 실행해 봐야 겠다. 예를 들면 게임서버?!?!



Open Terminal in Mac OS X Finder Mac OS X

I was always wondering if there is Windows 7's "Open Command Window Here" like command on Mac OS X. I've finally found similar command :)

As of Mac OS X 10.7 Lion, You can open terminal in Finder by doing this.

System Preferencs > Keyboard > Keyboard Shorcuts > Services

Now you can right click on folder you want to open in Terminal, and click "New Terminal Tab At Folder" or "New Terminal at Folder" menu.


Game Engine Development #5 - Lightmap Generation & Packing #1 Game Engine Development

박스랑 이것 저것 배치한 후에 라이트 맵을 생성해 봤다. 라이팅은 기본 Lambert 조명 모델을 적용했고, 거리에 따라서 조금씩 감쇠가 되도록 해봤다. 각 face 별로 라이트 맵 생성 후에 Packing 해서 텍스처는 별도로 저장시켰다.

조명 모델을 수정해서 여러가지로 테스트 해 봐야겠다.

라이트을 만들어서 적용한 박스


라이트 맵 팩킹된 텍스처


Game Engine Development #4 - Publishing to Adobe SWF format #1 Game Engine Development

한동안 집에서 LOL에 빠져서 딴 일을 못하고 있었는데, 정신 차리고 기존에 하다가 말았던 엔진에 플래시 파일로 엑스포트 하는 기능을 추가해 보았다.

원래 플래시는 하드웨어 가속 기능이 없어서 기존에 플래시에서 하고 있던 3D는 모두 CPU를 이용한 것이였는데(그래서 실행하면 CPU가 100%), Stage3D가 개발되면서 플래시에서도 하드웨어 가속 기능을 사용할 수 있게 되었다. 그래서...

Wonbear3DEngine에 Stage3D 기능 지원을 추가해 봤다. 맥스에서 Box를 하나 만들고, 웹에서 구한 텍스처로 맵핑한 다음에
엑스포트 해 본 것이다. 워낙 심플해서;;;

기존에 윈도우와 맥용 Standalone까지 해 놨었는데, 이제 Web에서 플래시로 실행되니 바로 리눅스건 윈도우건 맥이건 어디에서든 실행될 수 있게 됐다 ^^

이제 남은 건 iOS와 Android의 지원!! iOS는 그나마 OpenGL ES용 렌더러 만들어 주면 되는데; Android는 Wrapper를 만들어서 지원하려고 하니 눈 앞이 깜깜하다;

이제 좀 만 더 하면 Unity3D 엔진 만큼 멀티플랫폼 지원되는거다!! 그 다음엔 Editor를 Unity3D 만큼 만들어 봐야 겠다 ㅎ

아래 플래시를 제대로 보려면 Flash Player 11이 설치되어 있어야 한다.



4. C++ 0x. static_assert C++

보통 런타임에 필요한 기준을 만족시키기 위해서 assert를 사용하곤 했는데, static_assert를 이용하면 컴파일 타임에 assert를 체크할 수 있다.

기존에 따로 만들어서 사용하거나 다른 라이브러리에 있는 컴파일 타임 assert를 이용하는 사람들도 있었을 텐데,
이제 C++에 포함되었으니 유용하게 사용될 것 같다.





#include "stdafx.h"



int _tmain(int argc, _TCHAR* argv[])

{

    static_assert(1 == 2, "1 is not equal to 2");



    return 0;

}






위 코드에서 static_assert(1 == 2, "1 is not equal to 2"); 로 사용하고 있는데, 1과 2가 같은지 확인하는 assert이다. 같지 않을 경우 다음과 같은 컴파일 에러가 발생하게 된다.

error C2338: 1 is not equal to 2

Sample Source : static_assert.zip

3. C++ 0x. nullptr C++

보통 #define NULL 0 으로 정의해서 사용하던 NULL이 nullptr라는 키워드가 되었다.





#include "stdafx.h"



#include <iostream>



int _tmain(int argc, _TCHAR* argv[])

{

    void* pNullPtr = nullptr;

    if (pNullPtr == nullptr)

    {

        std::cout << "pNullPtr is nullptr" << std::endl;

    }



    return 0;

}






이제 NULL 대신에 nullptr 키워드를 이용해서 체크를 할 수 있다.

Sample Source : nullptr.zip

2. C++ 0x. Decltype C++

Decltype 키워드는 다음과 같이 타입을 정의하는데 사용된다.





    int var1;

    decltype(var1) var2;



    decltype(TestFunction()) floatVar1;

    decltype(floatVar1) floatVar2;






위의 같이 decltype(var1) var2;로 하면 var2 변수는 var1과 같은 타입으로 선언되게 된다. decltype은 auto 키워드와 같이 사용해서 auto로 선언된 변수의 타입을 이용하는데 사용될 수 있다.

또 decltype(TestFunction())





#include "stdafx.h"



#include <iostream>

#include <vector>

#include <string>



float TestFunction()

{

    return 1.0f;

}



int _tmain(int argc, _TCHAR* argv[])

{

    int var1;

    decltype(var1) var2;



    decltype(TestFunction()) floatVar1;

    decltype(floatVar1) floatVar2;



    std::vector<std::string> Strings;



    Strings.push_back("asdfasdf");

    Strings.push_back("stock");



    for (decltype(Strings.begin()) iter = Strings.begin(); iter != Strings.end(); ++iter)

    {

        std::cout << *iter << std::endl;

    }



    return 0;

}






Sample Source : Decltype.zip

1 2 3 4 5 6



wonbear's adsense 120x600