|
Well, I've gone with this for now: GDI+ Path to PDF[^]
If anyone else has other methods, I'd still like to hear about them 👍
/Jake
|
|
|
|
|
Marked as spam; I see a URL, but not a question.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
I have need to use the Vector2.CatmullRom(...) method in a memory intensive program that currently produces extremely large pictures for testing purposes. I found the ability to do this on the XNA platform. Before adding this reference, I was able to create the pictures I need. Unfortunately, since I now have to compile a 32 bit runtime as that seems to be the only format for the XNA library, I do not have enough memory available to complete the task(s) necessary.
IS there a 64 bit version of this method in this or another library? I need the ability to turn blocky cardinal direction lines into smooth lines with easy slopes (which is why I am using this function).
|
|
|
|
|
Hello,
i am trying to code some graphics for a little game in c++ and winapi / directx9.
I have established a background as a surface. Then i put some sprites on the background.
The problem is, as i call a function that has to center the screen on the active sprite, it doesn't show the background.
Here is the code so far, if you miss an information, please ask and i will answer.
First, the part of main, that is called, when user pushes button (winapi)
<pre>case ID_ZENTRIEREN:
{
for (int x=0;x<4;x++)
if (Spieler[x].Rundenaktiv==true)
{
Spielx=Spieler[x].posx;
Spiely=Spieler[x].posy;
d3ddev->Clear(0,NULL,D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, D3DCOLOR_COLORVALUE(0.0f,0.0f,0.0f,1.0f), 1.0f, 0);
render_frame_center(hDlg1, Worldposx, Worldposy, Bildschirmbreite, Bildschirmhoehe, Spielx, Spiely);
if (Spieler[x].Mobilart==0) {
float Mobilposx, Mobilposy;
Mobilposx=Spieler[x].posx;
Mobilposy=Spieler[x].posy;
render_Schuerfer(oWorldposx, oWorldposy, Mobilposx, Mobilposy);
}
else if (Spieler[x].Mobilart==1) {
float Mobilposx, Mobilposy;
Mobilposx=Spieler[x].posx;
Mobilposy=Spieler[x].posy;
render_Frachter(oWorldposx, oWorldposy, Mobilposx, Mobilposy);
}
else if (Spieler[x].Mobilart==2) {
float Mobilposx, Mobilposy;
Mobilposx=Spieler[x].posx;
Mobilposy=Spieler[x].posy;
render_Flugwaechter(oWorldposx, oWorldposy, Mobilposx, Mobilposy);
}
else if (Spieler[x].Mobilart==3) {
float Mobilposx, Mobilposy;
Mobilposx=Spieler[x].posx;
Mobilposy=Spieler[x].posy;
render_Jaeger(oWorldposx, oWorldposy, Mobilposx, Mobilposy);
}
render_ZeichenaktivesMobil(Spielx, Spiely, oWorldposx, oWorldposy);
render_frame_center(hDlg1, Worldposx, Worldposy, Bildschirmbreite, Bildschirmhoehe, Spielx, Spiely);
d3ddev->Present(NULL,NULL,NULL,NULL);
}
}
break;
As next, the function that should center the background:
<pre>void render_frame_center(HWND hDlg1, float &Worldposx, float &Worldposy, float &Bildschirmbreite, float &Bildschirmhoehe, float &Spielx, float &Spiely)
{
RECT screenRect;
GetClientRect(GetDlgItem(hDlg1, ID_KARTE),&screenRect);
RECT drawRect;
if (Spielx>(screenRect.right-screenRect.left)/2&&
Spielx<1600-(screenRect.right-screenRect.left)/2&&
Spiely>(screenRect.bottom-screenRect.top)/2&&
Spiely<1200-(screenRect.bottom-screenRect.top)/2)
{
drawRect.top=Spiely+(screenRect.top-screenRect.bottom)/2;
drawRect.left=Spielx-(screenRect.right-screenRect.left)/2;
drawRect.right=Spielx+(screenRect.right-screenRect.left)/2;
drawRect.bottom=Spiely+(screenRect.top-screenRect.bottom)/2;
}
else if (Spielx<(screenRect.right-screenRect.left)/2&&
Spielx<1600-(screenRect.right-screenRect.left)/2&&
Spiely>(screenRect.bottom-screenRect.top)/2&&
Spiely<1200-(screenRect.bottom-screenRect.top)/2)
{
drawRect.top=Spiely+(screenRect.top-screenRect.bottom)/2;
drawRect.left=0;
drawRect.right=0+(screenRect.right-screenRect.left);
drawRect.bottom=Spiely+(screenRect.top-screenRect.bottom)/2;
}
else if (Spielx>(screenRect.right-screenRect.left)/2&&
Spielx>1600-(screenRect.right-screenRect.left)/2&&
Spiely>(screenRect.bottom-screenRect.top)/2&&
Spiely<1200-(screenRect.bottom-screenRect.top)/2)
{
drawRect.top=Spiely+(screenRect.top-screenRect.bottom)/2;
drawRect.left=1600-(screenRect.right-screenRect.left);
drawRect.right=1600;
drawRect.bottom=Spiely+(screenRect.top-screenRect.bottom)/2;
}
else if (Spielx>(screenRect.right-screenRect.left)/2&&
Spielx<1600-(screenRect.right-screenRect.left)/2&&
Spiely<(screenRect.bottom-screenRect.top)/2&&
Spiely<1200-(screenRect.bottom-screenRect.top)/2)
{
drawRect.top=0;
drawRect.left=Spielx-(screenRect.right-screenRect.left)/2;
drawRect.right=Spielx+(screenRect.right-screenRect.left)/2;
drawRect.bottom=0+(screenRect.top-screenRect.bottom);
}
else if (Spielx>(screenRect.right-screenRect.left)/2&&
Spielx<1600-(screenRect.right-screenRect.left)/2&&
Spiely>(screenRect.bottom-screenRect.top)/2&&
Spiely>1200-(screenRect.bottom-screenRect.top)/2)
{
drawRect.top=1200-(screenRect.top-screenRect.bottom);
drawRect.left=Spielx-(screenRect.right-screenRect.left)/2;
drawRect.right=Spielx+(screenRect.right-screenRect.left)/2;
drawRect.bottom=1200;
}
else if (Spielx<(screenRect.right-screenRect.left)/2&&
Spielx<1600-(screenRect.right-screenRect.left)/2&&
Spiely<(screenRect.bottom-screenRect.top)/2&&
Spiely<1200-(screenRect.bottom-screenRect.top)/2)
{
drawRect.top=0;
drawRect.left=0;
drawRect.right=0+(screenRect.right-screenRect.left);
drawRect.bottom=0+(screenRect.top-screenRect.bottom);
}
else if (Spielx>(screenRect.right-screenRect.left)/2&&
Spielx>1600-(screenRect.right-screenRect.left)/2&&
Spiely<(screenRect.bottom-screenRect.top)/2&&
Spiely<1200-(screenRect.bottom-screenRect.top)/2)
{
drawRect.top=0;
drawRect.left=1600-(screenRect.right-screenRect.left);
drawRect.right=1600;
drawRect.bottom=0+(screenRect.top-screenRect.bottom);
}
else if (Spielx<(screenRect.right-screenRect.left)/2&&
Spielx<1600-(screenRect.right-screenRect.left)/2&&
Spiely>(screenRect.bottom-screenRect.top)/2&&
Spiely>1200-(screenRect.bottom-screenRect.top)/2)
{
drawRect.top=1200-(screenRect.top-screenRect.bottom);
drawRect.left=0;
drawRect.right=0+(screenRect.right-screenRect.left);
drawRect.bottom=1200;
}
else if (Spielx>(screenRect.right-screenRect.left)/2&&
Spielx>1600-(screenRect.right-screenRect.left)/2&&
Spiely>(screenRect.bottom-screenRect.top)/2&&
Spiely>1200-(screenRect.bottom-screenRect.top)/2)
{
drawRect.top=1200-(screenRect.top-screenRect.bottom);
drawRect.left=1600-(screenRect.right-screenRect.left);
drawRect.right=1600;
drawRect.bottom=1200;
}
d3ddev->BeginScene();
d3ddev->GetBackBuffer(0,0,D3DBACKBUFFER_TYPE_MONO, &backbuffer);
d3ddev->StretchRect(Hintergrund, &drawRect, backbuffer, NULL, D3DTEXF_NONE);
d3ddev->EndScene();
}
Here is the init for directx
<pre>void initD3D(HWND hDlg1, HWND hwndRaumkarte, float &Bildschirmbreite, float &Bildschirmhoehe)
{
HRESULT hresult;
d3d=Direct3DCreate9(D3D_SDK_VERSION);
D3DDISPLAYMODE d3ddm;
d3d->GetAdapterDisplayMode( D3DADAPTER_DEFAULT, &d3ddm );
D3DPRESENT_PARAMETERS d3dpp;
ZeroMemory(&d3dpp, sizeof(d3dpp));
d3dpp.Windowed=TRUE;
d3dpp.SwapEffect=D3DSWAPEFFECT_DISCARD;
d3dpp.hDeviceWindow=hwndRaumkarte;
d3dpp.BackBufferFormat = d3ddm.Format;
d3dpp.EnableAutoDepthStencil = TRUE;
d3dpp.AutoDepthStencilFormat = D3DFMT_D16;
d3dpp.PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE;
d3dpp.BackBufferCount=1;
d3dpp.BackBufferFormat=D3DFMT_X8R8G8B8;
d3dpp.BackBufferWidth=800;
d3dpp.BackBufferHeight=600;
d3d->CreateDevice(D3DADAPTER_DEFAULT,
D3DDEVTYPE_HAL,
hwndRaumkarte,
D3DCREATE_SOFTWARE_VERTEXPROCESSING,
&d3dpp,
&d3ddev);
d3ddev->CreateVertexBuffer( 4*sizeof(Vertex), D3DUSAGE_WRITEONLY,
D3DFVF_CUSTOMVERTEX, D3DPOOL_DEFAULT,
&g_pVertexBuffer, NULL );
void *pVertices = NULL;
g_pVertexBuffer->Lock( 0, sizeof(g_quadVertices), (void**)&pVertices, 0 );
memcpy( pVertices, g_quadVertices, sizeof(g_quadVertices) );
g_pVertexBuffer->Unlock();
D3DXMatrixPerspectiveFovLH( &Spritematrix, D3DXToRadian( Kamerawinkel ),
800 / 600, 0.00f, 100.0f );
d3ddev->SetTransform( D3DTS_PROJECTION, &Spritematrix );
d3ddev->SetSamplerState(0, D3DSAMP_MINFILTER, D3DTEXF_LINEAR);
d3ddev->SetSamplerState(0, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR);
d3ddev->SetSamplerState(0, D3DSAMP_MIPFILTER, D3DTEXF_LINEAR);
d3ddev->SetRenderState(D3DRS_LIGHTING, FALSE);
d3ddev->SetTransform(D3DTS_WORLD, &Spritematrix);
d3ddev->SetTextureStageState( 0, D3DTSS_TEXTURETRANSFORMFLAGS,
D3DTTFF_DISABLE );
d3ddev->Clear(0,NULL, D3DCLEAR_TARGET, D3DCOLOR_XRGB(0,0,0),1.0f,0);
d3ddev->GetBackBuffer(0,0,D3DBACKBUFFER_TYPE_MONO, &backbuffer);
hresult= d3ddev->CreateOffscreenPlainSurface(1600,1200,D3DFMT_X8R8G8B8,D3DPOOL_DEFAULT, &Hintergrund, NULL);
if (hresult !=D3D_OK)
return;
}
Further information:
the surface has 800/600, but will be presented as 1600/1200.
int Spielx, Spielx==coordinates of the ship/ sprite
It would be great if someone helps me, because i didn't find a hint in my books or in web.
|
|
|
|
|
Hi,
anyone knows free html5 templates websites?
any suggestion?
|
|
|
|
|
|
Is it possible to fragment opengl memory so it can't load a large texture despite there being "enough" memory OR does opengl use a management scheme to prevent this?
|
|
|
|
|
Hi,
I'm trying to make a small ASCII block graphics adventure game on Windows using the console terminal, and I am looking for example resources and tutorials on how to make a console window screen wrapper. I mean to change the resolution by changing the fontsize, and then just display simple graphics with ascii block character.
Any free tutorials, examples and resources will be greatly appreciated.
thanks in advance!
|
|
|
|
|
Member 13242145 wrote: Any free tutorials, examples and resources will be ... ... found by Google searching.
|
|
|
|
|
I am writing a fairly simple editor for managing video subtitle information(*). I do not touch the video itself, but use an external player (such as MPC-HC) to video in any of umpteen different formats.
It would be very nice if my editor could obtain the playing time for the video file, to bracket the timing of the subtitles. Some video editors write that into the NTFS attributes, but only sometimes, and only for some formats. I guess some formats provide it in metadata within the file, but again: only for some formats. And I do not want to spend weeks chasing duration info in this format, that format, and the third format...
Do you know of any library that can extract metadata info of this sort from "all" different video file formats? It certainly would not hurt if I could also extract e.g. fps value, video resolution etc.
I would need either source code or something that can be called from dotNet/C# - I am prepared to translate from e.g. plain C to C#. Obviously, I can pick up the source code for MPC-HC and extract that 0.1% of it that I need, but I am hoping for something requiring less work, less need to understand the structure of half a million code lines (or however large MPC source code is).
(*) regarding my desire to reinvent the subtitle editor wheel: I never found any editor suitable for handling multiple subtitle formats, and multiple languages, with the capability to generate a "concrete" subtitle file for lines spoken in specific language, subtitles in a specific languate. Also, I never saw good mechanisms for creating timestamped subtitles from scratch in an efficient manner.
|
|
|
|
|
MediaInfo is a opensource library that extracts information from most media files, there is a DLL and an an exe, you cold look at the exe source to see how to interact with the DLL.
|
|
|
|
|
Thanks a lot! This looks exactly like the kind of library I was looking for.
|
|
|
|
|
I have a set of SPRs and MAPs files in my harddisk, which I have uploaded all of them to OneDrive in the shared folder. You can download some of them or all of them from the following link:
There is the link
LoadImage fails to open these files directly, even though I change their extension to bmp, because they are not in the format of bmp, but I know for sure that these are image files and they are convertible to bmp files. In other words, there is a way or algorithm to convert all these files to bmp files, so LoadImage succeeds and BitBlt renders the images to my window. But the problem is that I don't know how to convert these files to bmp files. When I invoke CreateBitmap function, to create new 32 bit BGRA bitmap, open them by invoking the CreateFile function, reading all their bytes to an array of bytes, also called "buffer", by invoking ReadFile function, then CloseHandle, then SetBitmapBits or SetDIBits, and finally BitBlt (after CreateCompatibleDC and SelectObject), I see unclear image on my window. Later I figured out that these images are 8 bit color, in the SPR files, the first byte is the width of the image, and the second byte is the height of the image, and the rest of the bytes are the pixels of the image, each byte for each pixel. MAP files are always 320x200 pixels image, so all their bytes are the pixels of the MAP image itself, the same as in the SPR files. When I read one byte, I set all channels of the bitmap to this byte. Then BitBlt renders the bitmap and I can see the image clearly, but it is grayscaled. But I want to see it colorful. When I use 2 bits for Blue, 3 bits for Green and 3 bits for Red, I see the image in the wrong colors. I know how it suppose to look like in DOSBox. I need help about how to convert and correct the colors, rather than shape. Shape is fine. I want to convert the SPR and MAP images to 32 bit BGRA colorful and not grayscaled bitmap. That's my purpose.
modified 4-May-17 16:09pm.
|
|
|
|
|
You cannot just read the files and expect the system to figure out what the content is. You need to reformat the data into proper bitmap structures before you can display them. See BITMAP structure (Windows)[^] .
|
|
|
|
|
According to SPR files | Creatures Wiki | Fandom powered by Wikia[^] the colour values are palette indexes:
Quote: The actual image data is simply color indexes arranged into horizontal scanlines. The mappings between color indices and 256 RGB colors is given in the PALETTE.DTA[^] file; Multiply the red, green and blue results returned by 4 to gain the full colour range. If you don't have the palette file you can try to use the default palette provided in the link.
So you have to load the SPR file into memory, create a bitmap of the same size, and set the bitmap pixels to the RGB values retrieved from the colour table using the colour index from the SPR pixels.
|
|
|
|
|
Strange. The game doesn't come with it's own palette file .DTA, and I have tried the default one, but the images are still in the wrong colors.
|
|
|
|
|
I'm sorry that I can't help further because I don't know about your game. You can try to search the web for more information about the used colour tables and where they are stored.
|
|
|
|
|
I Urgently require source code for computer graphics mini project on rotation of a leaf in c language and in opengl.
|
|
|
|
|
Then you need to get writing. No one here is going to do your work for you.
|
|
|
|
|
I urgently require you to start working.
We do not write code on request.
Patrice
“Everything should be made as simple as possible, but no simpler.” Albert Einstein
|
|
|
|
|
I need help to Point me in the right direction.
At work they have asked me to create a program to read scanning data and then create a timber log in 3D based on the scanned data. And they need it in Direct X , not Open Gl or in WPF or something like that.
I have been searching and there pleanty of diffrent approaches with frameworks such as Unity and so on.
How would you approach this ?
|
|
|
|
|
I would start this by gathering all the requirements and breaking them down. For instance, what format does the scanning data come in as (is it an obj file for instance)? Do you have to do this yourself or are you getting it from another source? It's always a mistake to think about what coding techniques you need if you don't have an idea about what it is you're being asked to build.
This space for rent
|
|
|
|
|
I have Everything well documented and i have a working solution to get scanner data. I get a list with the Diameters for every 2 cm of the log.
But my problems is how to approach the 3D.
Since they want me to do it in DirectX and not Open GL and they want me to select one of the frameworks out there such as Unity or any other.
The problem is that i have no clue what package to select ? Unity ?
|
|
|
|
|
Hi,
i properly have coded a bitmap to be drawn in a control child of a dialogue in WINAPI.
Now i want to fit the bitmap, that has to be bigger than the window size, in specific coordinates, lateron i want to make controls that move the picture in the window.
My problem is i really don't know where i can set the variables who arrange the picture.
Here's the code (only the main, the headers are not neccessary):
#if defined(UNICODE) && !defined(_UNICODE)
#define _UNICODE
#elif defined(_UNICODE) && !defined(UNICODE)
#define UNICODE
#endif
#include <tchar.h>
#include <windows.h>
#include <windowsx.h>
#include <d3d9.h>
#include <d3dx9.h>
#include "Resource.h"
#pragma comment (lib, "d3d9.lib")
LRESULT CALLBACK WindowProcedure (HWND, UINT, WPARAM, LPARAM);
BOOL CALLBACK Raumaktionproc (HWND, UINT, WPARAM, LPARAM);
TCHAR szClassName[ ] = _T("CodeBlocksWindowsApp");
LPDIRECT3D9 d3d;
LPDIRECT3DDEVICE9 d3ddev;
LPDIRECT3DVERTEXBUFFER9 g_pVertexBuffer = NULL;
LPDIRECT3DTEXTURE9 g_pTexture = NULL;
#define D3DFVF_CUSTOMVERTEX ( D3DFVF_XYZ | D3DFVF_TEX1 )
struct Vertex
{
float x, y, z;
float tu, tv;
};
Vertex g_quadVertices[] =
{
{-1.0f, 1.0f, 0.0f, 0.0f,0.0f },
{ 1.0f, 1.0f, 0.0f, 1.0f,0.0f },
{-1.0f,-1.0f, 0.0f, 0.0f,1.0f },
{ 1.0f,-1.0f, 0.0f, 1.0f,1.0f }
};
static HWND hwndRaumkarte;
void initD3D(HWND hwndRaumkarte);
void render_frame(void);
void cleanD3D(void);
void loadTexture(void);
#define ID_StartDialog 1
int WINAPI WinMain (HINSTANCE hThisInstance,
HINSTANCE hPrevInstance,
LPSTR lpszArgument,
int nCmdShow)
{
HWND hwnd;
MSG messages;
WNDCLASSEX wincl;
memset(&messages,0,sizeof(messages));
wincl.hInstance = hThisInstance;
wincl.lpszClassName = szClassName;
wincl.lpfnWndProc = WindowProcedure;
wincl.style = CS_DBLCLKS;
wincl.cbSize = sizeof (WNDCLASSEX);
wincl.hIcon = LoadIcon (NULL, IDI_APPLICATION);
wincl.hIconSm = LoadIcon (NULL, IDI_APPLICATION);
wincl.hCursor = LoadCursor (NULL, IDC_ARROW);
wincl.lpszMenuName = NULL;
wincl.cbClsExtra = 0;
wincl.cbWndExtra = 0;
wincl.hbrBackground = (HBRUSH) COLOR_BACKGROUND;
if (!RegisterClassEx (&wincl))
return 0;
hwnd = CreateWindowEx (
0,
szClassName,
_T("Code::Blocks Template Windows App"),
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT,
CW_USEDEFAULT,
800,
600,
HWND_DESKTOP,
NULL,
hThisInstance,
NULL
);
ShowWindow (hwnd, nCmdShow);
while (GetMessage (&messages, NULL, 0, 0))
{
TranslateMessage(&messages);
DispatchMessage(&messages);
}
return messages.wParam;
}
LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
static HINSTANCE hInstance;
switch (message)
{
case WM_CREATE:
{
CreateWindow(TEXT("button"),"Karte anzeigen",WS_CHILD|WS_VISIBLE,
20, 20, 200, 40, hwnd, (HMENU) ID_StartDialog, NULL,NULL);
}
break;
case WM_COMMAND:
switch (LOWORD(wParam))
{
case ID_StartDialog:
{
DialogBox(hInstance, MAKEINTRESOURCE(IDD_DIALOG1),hwnd, Raumaktionproc);
InvalidateRect(hwnd,NULL, TRUE);
}
}
break;
case WM_DESTROY:
PostQuitMessage (0);
break;
default:
return DefWindowProc (hwnd, message, wParam, lParam);
}
return 0;
}
BOOL CALLBACK Raumaktionproc(HWND hDlg1, UINT message, WPARAM wParam, LPARAM lParam)
{
PAINTSTRUCT ps;
HDC hdc;
RECT rect;
hdc=GetDC(hDlg1);
hwndRaumkarte=GetDlgItem(hDlg1, ID_RAUMKARTE);
switch (message)
{
case WM_INITDIALOG:
{
ShowWindow(GetDlgItem(hDlg1, IDD_DIALOG1), TRUE);
ShowWindow(GetDlgItem(hDlg1, ID_OK),TRUE);
ShowWindow(GetDlgItem(hDlg1, ID_RAUMKARTE),TRUE);
ShowWindow(GetDlgItem(hDlg1, ID_VERTSCROLL),TRUE);
ShowWindow(GetDlgItem(hDlg1, ID_HORSCROLL),TRUE);
ShowWindow(GetDlgItem(hDlg1, ID_BASIS),TRUE);
ShowWindow(GetDlgItem(hDlg1, ID_FEUER),TRUE);
ShowWindow(GetDlgItem(hDlg1, ID_GEGNERAUSWAHL),TRUE);
ShowWindow(GetDlgItem(hDlg1, ID_KOM),TRUE);
ShowWindow(GetDlgItem(hDlg1, ID_FEUERBEENDEN),TRUE);
ShowWindow(GetDlgItem(hDlg1, ID_FEUERFLUCHT),TRUE);
ShowWindow(GetDlgItem(hDlg1, ID_LABWERFEN),TRUE);
ShowWindow(GetDlgItem(hDlg1, ID_LTAUSCHEN),TRUE);
ShowWindow(GetDlgItem(hDlg1, ID_MOBILINFO),TRUE);
ShowWindow(GetDlgItem(hDlg1, ID_NMOBIL),TRUE);
ShowWindow(GetDlgItem(hDlg1, ID_PLANET),TRUE);
ShowWindow(GetDlgItem(hDlg1, ID_SCAN),TRUE);
ShowWindow(GetDlgItem(hDlg1, ID_VMOBIL),TRUE);
ShowWindow(GetDlgItem(hDlg1, ID_ZIELAUSWAHLLISTE),TRUE);
EnableWindow(GetDlgItem(hDlg1, ID_GEGNERAUSWAHL),FALSE);
EnableWindow(GetDlgItem(hDlg1, ID_FEUERBEENDEN),FALSE);
EnableWindow(GetDlgItem(hDlg1, ID_FEUERFLUCHT),FALSE);
initD3D(hwndRaumkarte);
InvalidateRect(hDlg1, NULL, TRUE);
return FALSE;
};
case WM_PAINT:
{
render_frame();
}
break;
case WM_COMMAND:
switch (LOWORD (wParam))
{
case ID_OK:
{
MessageBox(hDlg1, TEXT ("Runde im All beendet"), "EXO 1.2", MB_ICONEXCLAMATION|MB_OK);
cleanD3D();
EndDialog(hDlg1,0);
return TRUE;
}
break;
}
break;
}
return FALSE;
}
void loadTexture()
{
D3DXCreateTextureFromFile( d3ddev, "Raumkarte.bmp", &g_pTexture );
d3ddev->SetSamplerState(0, D3DSAMP_MINFILTER, D3DTEXF_LINEAR);
d3ddev->SetSamplerState(0, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR);
}
void initD3D(HWND hwndRaumkarte)
{
d3d=Direct3DCreate9(D3D_SDK_VERSION);
D3DDISPLAYMODE d3ddm;
d3d->GetAdapterDisplayMode( D3DADAPTER_DEFAULT, &d3ddm );
D3DPRESENT_PARAMETERS d3dpp;
ZeroMemory(&d3dpp, sizeof(d3dpp));
d3dpp.Windowed=TRUE;
d3dpp.SwapEffect=D3DSWAPEFFECT_DISCARD;
d3dpp.hDeviceWindow=hwndRaumkarte;
d3dpp.BackBufferFormat = d3ddm.Format;
d3dpp.EnableAutoDepthStencil = TRUE;
d3dpp.AutoDepthStencilFormat = D3DFMT_D16;
d3dpp.PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE;
d3d->CreateDevice(D3DADAPTER_DEFAULT,
D3DDEVTYPE_HAL,
hwndRaumkarte,
D3DCREATE_SOFTWARE_VERTEXPROCESSING,
&d3dpp,
&d3ddev);
loadTexture();
d3ddev->CreateVertexBuffer( 4*sizeof(Vertex), D3DUSAGE_WRITEONLY,
D3DFVF_CUSTOMVERTEX, D3DPOOL_DEFAULT,
&g_pVertexBuffer, NULL );
void *pVertices = NULL;
g_pVertexBuffer->Lock( 0, sizeof(g_quadVertices), (void**)&pVertices, 0 );
memcpy( pVertices, g_quadVertices, sizeof(g_quadVertices) );
g_pVertexBuffer->Unlock();
D3DXMATRIX matProj;
D3DXMatrixPerspectiveFovLH( &matProj, D3DXToRadian( 45.0f ),
1920.0f / 1080.0f, 0.1f, 100.0f );
d3ddev->SetTransform( D3DTS_PROJECTION, &matProj );
d3ddev->SetRenderState(D3DRS_LIGHTING, FALSE);
}
void render_frame(void)
{
d3ddev->Clear(0,NULL,D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, D3DCOLOR_COLORVALUE(0.0f,0.0f,0.0f,1.0f), 1.0f, 0);
D3DXMATRIX matWorld;
D3DXMatrixTranslation( &matWorld, 0.5f, 0.5f, 1.0f );
d3ddev->SetTransform( D3DTS_WORLD, &matWorld );
d3ddev->BeginScene();
d3ddev->SetTexture( 0, g_pTexture );
d3ddev->SetStreamSource( 0, g_pVertexBuffer, 0, sizeof(Vertex) );
d3ddev->SetFVF( D3DFVF_CUSTOMVERTEX );
d3ddev->DrawPrimitive( D3DPT_TRIANGLESTRIP, 0, 2 );
d3ddev->EndScene();
d3ddev->Present(NULL,NULL,NULL,NULL);
}
void cleanD3D(void)
{
if( g_pTexture != NULL )
g_pTexture->Release();
if( g_pVertexBuffer != NULL )
g_pVertexBuffer->Release();
d3ddev->Release();
d3d->Release();
}
For now i need someone to tell me where i have to change the attributes to render the picture in different pixel- parts.
I am a newbie, i got two books, but none can really bring light to this question.
Where do i have to start? With the vertices? With the matrix? Or is it in the parts
of D3DXMatrixTranslation or D3DXMatrixPerspectiveFovLH?
Please help, thx,
Chris
|
|
|
|
|
Is it possible to get a sense of depth and 3D space (X,Y,Z planes) from an image or video? Is there an API that can handle this sort of processing? Perhaps with several images or source videos you could possibly determine 3D space and boundaries of an area in a series of photos or videos. I know they have photogrammetry software that can compile 3D objects based on a series of photos taken from different angles. I am wondering if this can be done to map out a terrain in an image or video (or series of them).
|
|
|
|
|