검색결과 리스트
Technical Article에 해당되는 글 282건
- 2003.06.10 삼각형을 그려보자~ 2
- 2003.06.10 DX8 Graphics 초기화를 해보자~ 1
- 2003.06.10 3D는 열라 짱 쉽다!~ 쉬울꺼야~ 쉬울까? ㅡㅡ;;;
- 2003.05.22 Linux RAM Disk Device Driver와 GUI Application 개발
- 2003.05.21 DEFALTE알고리즘 관련
- 2003.05.21 IDS
- 2003.05.11 엽기 어플 개발자 ^^
- 2003.05.09 [OLEDB] 초간단 샘플
- 2003.05.07 Null@Root 신규멤버 모집 문제.....
- 2003.05.01 웹스케너
글
Technical Article/펌 2003. 6. 10. 23:46삼각형을 그려보자~
1. 디바이스 생성하고 나서...
2. FVF(Flexible vertex format- 유동 정점 포맷)를 정의하고~~
// The 3-D vertex format and descriptor
typedef struct {
FLOAT x, y, z; // 3-D coordinates
FLOAT rhw; // rhw
D3DCOLOR Diffuse; // Diffuse color component
} sVertex;
#define VERTEXFVF (D3DFVF_XYZRHW | D3DFVF_DIFFUSE)
// Vertex buffer
IDirect3DVertexBuffer8 *g_pVB = NULL;
3. 버텍스 값을 넣어준다!!!
BYTE *Ptr;
sVertex Verts[4] = {
{ 0.0f, 0.0f, 0.0f, 1.0f, D3DCOLOR_RGBA(255,0,255,100) },
// { 100.0f, 110.0f, 110.0f, 1.0f, D3DCOLOR_RGBA(155,0,155,100) },
{ 150.0f, 300.0f, 0.0f, 1.0f, D3DCOLOR_RGBA(255,0,0,100) },
{ 300.0f, 0.0f, 0.0f, 1.0f, D3DCOLOR_RGBA(0,0,255,100) },
{ 0.0f, 0.0f, 0.0f, 1.0f, D3DCOLOR_RGBA(255,0,255,100) }
};
4. 버텍스 생성해서 락걸고 디바이스에 잡아넣는다!
// Create the vertex buffer and set data
g_pD3DDevice->CreateVertexBuffer(sizeof(sVertex)*4, 0, VERTEXFVF, D3DPOOL_DEFAULT, &g_pVB);
g_pVB->Lock(0,0, (BYTE**)&Ptr, 0);
memcpy(Ptr, Verts, sizeof(Verts));
g_pVB->Unlock();
5. 매 프레임 마다 뿌려준다!
g_pD3DDevice->Clear(0, NULL, D3DCLEAR_TARGET, D3DCOLOR_RGBA(0,0,0,255), 1.0f, 0);
// Begin scene
if(SUCCEEDED(g_pD3DDevice->BeginScene()))
{
// Set the vertex stream and shader
g_pD3DDevice->SetStreamSource(0, g_pVB, sizeof(sVertex));
g_pD3DDevice->SetVertexShader(VERTEXFVF);
g_pD3DDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE);
g_pD3DDevice->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA);
g_pD3DDevice->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA);
6. 밑에 부분 중요!!
D3DPT_TRIANGLESTRIP은 첫번째 폴리곤에는 처음 3개의 점을 사용해서 그담에 이어지는 각각의 폴리곤에는 추가되는 정점 하나만을 사용하여 폴리곤의 스트립을 그리는 옵션~~
흐흐.. 졸라 말이 어렵다...
그냥 삼각형 그릴려면 버텍스 4개로 다음과 같이해주니까 되드라 ㅡㅡ;;
g_pD3DDevice->DrawPrimitive(D3DPT_TRIANGLESTRIP, 0, 2);
// End the scene
g_pD3DDevice->EndScene();
}
// Display the scene
g_pD3DDevice->Present(NULL, NULL, NULL, NULL);
7. 이렇게 해주면 떙^^ 삼각형 나온다~ 으하하하
역시 코딩하고 결과보고 디버깅좀 하고 그래해야 맛이나지..ㅋㅋ
근데...
버텍스를 4개를 썼는데...저렇게 할필요가 있나..
트라이앵글리스트를 쓰면 3개로 끝낼수 있을꺼 같은데...
ㅎㅎ
2. FVF(Flexible vertex format- 유동 정점 포맷)를 정의하고~~
// The 3-D vertex format and descriptor
typedef struct {
FLOAT x, y, z; // 3-D coordinates
FLOAT rhw; // rhw
D3DCOLOR Diffuse; // Diffuse color component
} sVertex;
#define VERTEXFVF (D3DFVF_XYZRHW | D3DFVF_DIFFUSE)
// Vertex buffer
IDirect3DVertexBuffer8 *g_pVB = NULL;
3. 버텍스 값을 넣어준다!!!
BYTE *Ptr;
sVertex Verts[4] = {
{ 0.0f, 0.0f, 0.0f, 1.0f, D3DCOLOR_RGBA(255,0,255,100) },
// { 100.0f, 110.0f, 110.0f, 1.0f, D3DCOLOR_RGBA(155,0,155,100) },
{ 150.0f, 300.0f, 0.0f, 1.0f, D3DCOLOR_RGBA(255,0,0,100) },
{ 300.0f, 0.0f, 0.0f, 1.0f, D3DCOLOR_RGBA(0,0,255,100) },
{ 0.0f, 0.0f, 0.0f, 1.0f, D3DCOLOR_RGBA(255,0,255,100) }
};
4. 버텍스 생성해서 락걸고 디바이스에 잡아넣는다!
// Create the vertex buffer and set data
g_pD3DDevice->CreateVertexBuffer(sizeof(sVertex)*4, 0, VERTEXFVF, D3DPOOL_DEFAULT, &g_pVB);
g_pVB->Lock(0,0, (BYTE**)&Ptr, 0);
memcpy(Ptr, Verts, sizeof(Verts));
g_pVB->Unlock();
5. 매 프레임 마다 뿌려준다!
g_pD3DDevice->Clear(0, NULL, D3DCLEAR_TARGET, D3DCOLOR_RGBA(0,0,0,255), 1.0f, 0);
// Begin scene
if(SUCCEEDED(g_pD3DDevice->BeginScene()))
{
// Set the vertex stream and shader
g_pD3DDevice->SetStreamSource(0, g_pVB, sizeof(sVertex));
g_pD3DDevice->SetVertexShader(VERTEXFVF);
g_pD3DDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE);
g_pD3DDevice->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA);
g_pD3DDevice->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA);
6. 밑에 부분 중요!!
D3DPT_TRIANGLESTRIP은 첫번째 폴리곤에는 처음 3개의 점을 사용해서 그담에 이어지는 각각의 폴리곤에는 추가되는 정점 하나만을 사용하여 폴리곤의 스트립을 그리는 옵션~~
흐흐.. 졸라 말이 어렵다...
그냥 삼각형 그릴려면 버텍스 4개로 다음과 같이해주니까 되드라 ㅡㅡ;;
g_pD3DDevice->DrawPrimitive(D3DPT_TRIANGLESTRIP, 0, 2);
// End the scene
g_pD3DDevice->EndScene();
}
// Display the scene
g_pD3DDevice->Present(NULL, NULL, NULL, NULL);
7. 이렇게 해주면 떙^^ 삼각형 나온다~ 으하하하
역시 코딩하고 결과보고 디버깅좀 하고 그래해야 맛이나지..ㅋㅋ
근데...
버텍스를 4개를 썼는데...저렇게 할필요가 있나..
트라이앵글리스트를 쓰면 3개로 끝낼수 있을꺼 같은데...
ㅎㅎ
![](https://lh3.googleusercontent.com/-hYZb_novCPQ/V5HuGPkGFUI/AAAAAAAAANk/f8zcKkeTBbA1A-W6yuqfk12fs8bd8FeOQCL0B/banner_468_60.png)
트랙백
댓글
보호글
Technical Article/펌 2003. 6. 10. 21:24DX8 Graphics 초기화를 해보자~
보호되어 있는 글입니다.
내용을 보시려면 비밀번호를 입력해주세요.
글
Technical Article/펌 2003. 6. 10. 20:463D는 열라 짱 쉽다!~ 쉬울꺼야~ 쉬울까? ㅡㅡ;;;
침대위에 펴져있는 3D책은 몇달째 같은 페이지...
한다 한다 하면서 질질 끌고있고...ㅋㅋ
항상봐도 새롭다..푸하
이번에 다시 마음을 굳게 먹으면서~~
또 흐지부지 되는걸 미연에 방지하기 위해서 메뉴도 만들었다. ^^v
이전까지는 시작이 너무 거창했다...
아는것도 없으면서 3D MMORPG, FPS를 만들꺼시야 하면서 헛소리만 하고...흐흐흐
이번에는 쉬운거 부터 시작해야겠다.
1. 삼각형을 그려보자~
2. 키우고 쭈루고...
3. 색깔을 발라보자~
4. 알록달록 텍스쳐를 박아보자~
5. 야시시 조명을 뿌려보자~
후후...
대문짝에도 있지만 최종목표는
후울~ 3D MMORPG ㅡㅡ;;; and 리얼리티 만땅 사시미 FPS
한다 한다 하면서 질질 끌고있고...ㅋㅋ
항상봐도 새롭다..푸하
이번에 다시 마음을 굳게 먹으면서~~
또 흐지부지 되는걸 미연에 방지하기 위해서 메뉴도 만들었다. ^^v
이전까지는 시작이 너무 거창했다...
아는것도 없으면서 3D MMORPG, FPS를 만들꺼시야 하면서 헛소리만 하고...흐흐흐
이번에는 쉬운거 부터 시작해야겠다.
1. 삼각형을 그려보자~
2. 키우고 쭈루고...
3. 색깔을 발라보자~
4. 알록달록 텍스쳐를 박아보자~
5. 야시시 조명을 뿌려보자~
후후...
대문짝에도 있지만 최종목표는
후울~ 3D MMORPG ㅡㅡ;;; and 리얼리티 만땅 사시미 FPS
![](https://lh3.googleusercontent.com/-hYZb_novCPQ/V5HuGPkGFUI/AAAAAAAAANk/f8zcKkeTBbA1A-W6yuqfk12fs8bd8FeOQCL0B/banner_468_60.png)
트랙백
댓글
글
Technical Article/펌 2003. 5. 21. 15:21DEFALTE알고리즘 관련
[소개]
대다수의 압축어플리케이션에서 사용하는 무손실(loseless) 압축방식으로 허프만과 슬라이딩윈도우 알고리즘의 혼합형태이다.
http://opensource.franz.com/deflate/
RFC 1950, 1952, 1951-DEFALTE Compressed Data Format Specification version 1.3 참고
[관련자료]
C 소스와 헤더.(zlib이용)
http://www.cs.washington.edu/homes/suciu/XMLTK/xmill/www/XMILL/html/deflate_8h.html
자바 라입
http://home.hanmir.com/~neospace/list/java.util.zip.Deflater_dsc.htm
[학습방법]
1. 허프만 알고리즘에 대한 학습.
(허프만 트리를 구성하기 위해 바이너리 트리에 대한 이해 필요. 이진트리를 왜 써야 하는지 이해하면 디코딩까지 한꺼번에 이해됨)
2. LZ77에 대한 알고리즘 학습
3. 조합된 DEFLATE알고리즘에 대한 이해
대다수의 압축어플리케이션에서 사용하는 무손실(loseless) 압축방식으로 허프만과 슬라이딩윈도우 알고리즘의 혼합형태이다.
http://opensource.franz.com/deflate/
RFC 1950, 1952, 1951-DEFALTE Compressed Data Format Specification version 1.3 참고
[관련자료]
C 소스와 헤더.(zlib이용)
http://www.cs.washington.edu/homes/suciu/XMLTK/xmill/www/XMILL/html/deflate_8h.html
자바 라입
http://home.hanmir.com/~neospace/list/java.util.zip.Deflater_dsc.htm
[학습방법]
1. 허프만 알고리즘에 대한 학습.
(허프만 트리를 구성하기 위해 바이너리 트리에 대한 이해 필요. 이진트리를 왜 써야 하는지 이해하면 디코딩까지 한꺼번에 이해됨)
2. LZ77에 대한 알고리즘 학습
3. 조합된 DEFLATE알고리즘에 대한 이해
![](https://lh3.googleusercontent.com/-hYZb_novCPQ/V5HuGPkGFUI/AAAAAAAAANk/f8zcKkeTBbA1A-W6yuqfk12fs8bd8FeOQCL0B/banner_468_60.png)
트랙백
댓글
글
Technical Article/펌 2003. 5. 21. 00:51IDS
Snort 윈도우 버전이 나왔습니다.
http://www.snort.org/
http://www.datanerds.net/~mike/binaries/snort-1.6-win32-static.zip
위 페이지에 가보시면 윈도우 버전을 다운받을 수 있습니다.
그리고 윈도우 버전의 Snort를 사용하기 위해서는 먼저 아래 사이트에서
winpcap을 다운받아 설치 해야 합니다.
http://netgroup-serv.polito.it/winpcap/install/Default.htm
침입탐지 Rule Database는 06082k.rules, 06082kany.rules 가 최근 건데
윈도우에서 사용하기 위해서는 rule 파일의 내용(Uunix 디렉토리 설정을
윈도우에 맞도록 설정)을 조금 수정하셔야 합니다.
현재 821가지 정도의 침입패턴을 가지고 있군요 ...
rule 파일을 수정한뒤 다음과 같이 실행시키면 로그파일이 "c:\work"
디렉토리 아래에 생성됩니다.
snort -c 06082k.rules -l c:\work
http://www.certcc.or.kr/mail-archive/si-mail/0034.html
http://www.wowhacker.org/~getroot/proj/
http://www.snort.org/
http://www.datanerds.net/~mike/binaries/snort-1.6-win32-static.zip
위 페이지에 가보시면 윈도우 버전을 다운받을 수 있습니다.
그리고 윈도우 버전의 Snort를 사용하기 위해서는 먼저 아래 사이트에서
winpcap을 다운받아 설치 해야 합니다.
http://netgroup-serv.polito.it/winpcap/install/Default.htm
침입탐지 Rule Database는 06082k.rules, 06082kany.rules 가 최근 건데
윈도우에서 사용하기 위해서는 rule 파일의 내용(Uunix 디렉토리 설정을
윈도우에 맞도록 설정)을 조금 수정하셔야 합니다.
현재 821가지 정도의 침입패턴을 가지고 있군요 ...
rule 파일을 수정한뒤 다음과 같이 실행시키면 로그파일이 "c:\work"
디렉토리 아래에 생성됩니다.
snort -c 06082k.rules -l c:\work
http://www.certcc.or.kr/mail-archive/si-mail/0034.html
http://www.wowhacker.org/~getroot/proj/
![](https://lh3.googleusercontent.com/-hYZb_novCPQ/V5HuGPkGFUI/AAAAAAAAANk/f8zcKkeTBbA1A-W6yuqfk12fs8bd8FeOQCL0B/banner_468_60.png)
트랙백
댓글
글
Technical Article/펌 2003. 5. 9. 21:04[OLEDB] 초간단 샘플
http://www.codeguru.com/mfc/comments/8227.shtml
OLE DB Templates - A light and simple Data Access Method
Rating: none
Dick Warg (view profile)
July 3, 1999
I was amazed and delighted to see how simple database access has become thanks to OLE DB. I've been reading the hype and so I went out and found the Microsoft Book on OLE DB. It's a great idea as it's explained there but still rather complex to code. I noticed that Visual C++ 6 has some new templates for Data Consumers so I started looking at the documentation. Wow! Is this simple stuff or what??
Here's a sample, a CONSOLE application at that, using the NWind database that comes with the DASDK. It's only 99 lines of code including comments and it compiles into a 60K executable.
--------------------------------------------------------------------------------
//file: olsamp.cpp
//auth: dick warg
//date: 6/25/99
//func: minimal oledb program
#include <atldbcli.h>
#include <iostream>
using namespace std;
// define a class to hold the data from the table
class myNwCust
{
public:
// data elements
TCHAR m_CustomerID[6];
TCHAR m_CompanyName[41];
TCHAR m_ContactName[31];
TCHAR m_Phone[25];
// column binding -- I only want these 4 fields
BEGIN_COLUMN_MAP(myNwCust)
COLUMN_ENTRY(1, m_CustomerID)
COLUMN_ENTRY(2, m_CompanyName)
COLUMN_ENTRY(3, m_ContactName)
COLUMN_ENTRY(4, m_Phone)
END_COLUMN_MAP()
};
// declare the OLEDB objects
CDataSource ds;
CSession session;
CCommand <CAccessor<myNwCust> > cust;
int main()
{
try{
// fire up COM
HRESULT hr = CoInitialize(0);
if(FAILED(hr))
{
cout << "Can't start COM!? " << endl;
return -1;
}
// connect to the database
hr = ds.Open(_T("MSDASQL"), "OLE_DB_NWind_Jet", "sa", "");
if(FAILED(hr))
{
cout << "Can't open Nwind" << endl;
return -1;
}
// start the session
hr = session.Open(ds);
if(FAILED(hr))
{
cout << "Can't open Nwind SESSION" << endl;
ds.Close();
return -1;
}
// construct the query string
TCHAR mySQL[] = "SELECT CustomerID, CompanyName, ContactName, \
Phone FROM Customers";
// open the dataset
hr = cust.Open(session, mySQL);
if(FAILED(hr))
{
cout << "Can't open Nwind TABLE" << endl;
session.Close();
ds.Close();
return -1;
}
// read all the data
while(cust.MoveNext() == S_OK)
{
cout << cust.m_CustomerID << ", " << cust.m_CompanyName << ", ";
cout << cust.m_ContactName << ", " << cust.m_Phone << endl;
}
cust.Close();
session.Close();
ds.Close();
cout << "That's All Folks" << endl;
return 1;
}
catch(...)
{
cout << "Unknown failure" << endl;
return -1;
}
}
--------------------------------------------------------------------------------
The Microsoft documentation and samples are in the MSDN pages "Visual C++ Documentation \ References \ Microsoft Foundation Class Library and Templates\OLE DB Templates"
OLE DB Templates - A light and simple Data Access Method
Rating: none
Dick Warg (view profile)
July 3, 1999
I was amazed and delighted to see how simple database access has become thanks to OLE DB. I've been reading the hype and so I went out and found the Microsoft Book on OLE DB. It's a great idea as it's explained there but still rather complex to code. I noticed that Visual C++ 6 has some new templates for Data Consumers so I started looking at the documentation. Wow! Is this simple stuff or what??
Here's a sample, a CONSOLE application at that, using the NWind database that comes with the DASDK. It's only 99 lines of code including comments and it compiles into a 60K executable.
--------------------------------------------------------------------------------
//file: olsamp.cpp
//auth: dick warg
//date: 6/25/99
//func: minimal oledb program
#include <atldbcli.h>
#include <iostream>
using namespace std;
// define a class to hold the data from the table
class myNwCust
{
public:
// data elements
TCHAR m_CustomerID[6];
TCHAR m_CompanyName[41];
TCHAR m_ContactName[31];
TCHAR m_Phone[25];
// column binding -- I only want these 4 fields
BEGIN_COLUMN_MAP(myNwCust)
COLUMN_ENTRY(1, m_CustomerID)
COLUMN_ENTRY(2, m_CompanyName)
COLUMN_ENTRY(3, m_ContactName)
COLUMN_ENTRY(4, m_Phone)
END_COLUMN_MAP()
};
// declare the OLEDB objects
CDataSource ds;
CSession session;
CCommand <CAccessor<myNwCust> > cust;
int main()
{
try{
// fire up COM
HRESULT hr = CoInitialize(0);
if(FAILED(hr))
{
cout << "Can't start COM!? " << endl;
return -1;
}
// connect to the database
hr = ds.Open(_T("MSDASQL"), "OLE_DB_NWind_Jet", "sa", "");
if(FAILED(hr))
{
cout << "Can't open Nwind" << endl;
return -1;
}
// start the session
hr = session.Open(ds);
if(FAILED(hr))
{
cout << "Can't open Nwind SESSION" << endl;
ds.Close();
return -1;
}
// construct the query string
TCHAR mySQL[] = "SELECT CustomerID, CompanyName, ContactName, \
Phone FROM Customers";
// open the dataset
hr = cust.Open(session, mySQL);
if(FAILED(hr))
{
cout << "Can't open Nwind TABLE" << endl;
session.Close();
ds.Close();
return -1;
}
// read all the data
while(cust.MoveNext() == S_OK)
{
cout << cust.m_CustomerID << ", " << cust.m_CompanyName << ", ";
cout << cust.m_ContactName << ", " << cust.m_Phone << endl;
}
cust.Close();
session.Close();
ds.Close();
cout << "That's All Folks" << endl;
return 1;
}
catch(...)
{
cout << "Unknown failure" << endl;
return -1;
}
}
--------------------------------------------------------------------------------
The Microsoft documentation and samples are in the MSDN pages "Visual C++ Documentation \ References \ Microsoft Foundation Class Library and Templates\OLE DB Templates"
![](https://lh3.googleusercontent.com/-hYZb_novCPQ/V5HuGPkGFUI/AAAAAAAAANk/f8zcKkeTBbA1A-W6yuqfk12fs8bd8FeOQCL0B/banner_468_60.png)
트랙백
댓글
보호글
Technical Article/펌 2003. 5. 7. 21:58Null@Root 신규멤버 모집 문제.....
보호되어 있는 글입니다.
내용을 보시려면 비밀번호를 입력해주세요.
RECENT COMMENT