• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.

Mockarutan

Members
  • Content count

    35
  • Joined

  • Last visited

Community Reputation

122 Neutral

About Mockarutan

  • Rank
    Member
  1. I have a problem with a projection matrix that does not work, I'm developing the code to Android. The thing is that it has worked before, when i wrote it in native code ©, but now when i have converted the code to java (in the GDX lib) it does not work and cant see the problem. But if a render it without the project matrix used, it works and the "screenspace" becomes -1.0 -> 1.0 in both x and y, and that's what i dont want... So below i have the code related to the matrix stuff, (if you need all the code, i can give you that too, but o don't think is necessary), and just so you know, I'm able to locate all the attributes correctly. [code] //================startup code================ private final String gVertexShader = "attribute vec4 vPosition; \n"+ "attribute vec2 vTexCoord; \n"+ "varying vec2 v_texCoord; \n"+ "uniform mat4 m_projectionMat; \n"+ "void main() { \n"+ " vec4 position = vec4(vPosition.x, vPosition.y, -1., 1.);\n"+ " gl_Position = vPosition * m_projectionMat; \n"+ " v_texCoord = vTexCoord; \n"+ "} \n"; //............ private final short indecisData [] = { 0, 1, 2, 0, 2, 3, 4, 5, 6, 4, 6, 7 }; private final float staticQuadData[] = { -10.0f, -10.0f, // Position 0 -10.0f, 10.0f,// Position 1 10.0f, 10.0f, // Position 2 10.0f, -10.0f, // Position 3 }; private final float projMatrixData[] = {2.0f/mSpaceW, 0.0f, 0.0f, 0.0f, 0.0f, 2.0f/(mSpaceW / mScnR), 0.0f, 0.0f, 0.0f, 0.0f, -2.0f, -1.0f, 0.0f, 0.0f, 0.0f, 1.0f }; //......... ByteBuffer vbb = ByteBuffer.allocateDirect(64); vbb.order(ByteOrder.nativeOrder()); mProjMatrix = vbb.asFloatBuffer(); mProjMatrix.put(projMatrixData); //......... // ==================The render function======================== Gdx.gl.glClear(Gdx.gl20.GL_COLOR_BUFFER_BIT); checkGlError("glClear"); Gdx.gl20.glUseProgram(gProgram); checkGlError("glUseProgram"); Gdx.gl20.glBlendFunc(Gdx.gl20.GL_SRC_ALPHA, Gdx.gl20.GL_ONE_MINUS_SRC_ALPHA); Gdx.gl20.glUniformMatrix4fv(mS1ProjMatrixHandle, 1, false, mProjMatrix); Gdx.gl20.glBindBuffer(Gdx.gl20.GL_ARRAY_BUFFER, mQuadVBO); checkGlError("glBindBuffer"); Gdx.gl20.glEnableVertexAttribArray(mS1PosHandle); checkGlError("glEnableVertexAttribArray"); Gdx.gl20.glVertexAttribPointer(mS1PosHandle, 2, Gdx.gl20.GL_FLOAT, false, 0, 0); checkGlError("glVertexAttribPointer"); Gdx.gl20.glDrawElements(Gdx.gl20.GL_TRIANGLES, 6, Gdx.gl20.GL_UNSIGNED_SHORT, tempShortBuf); checkGlError("glDrawArrays"); [/code] Thanks in advance! EDIT: I just solved it, I had to put the position of the floatbuffer that holds the matrix to 0.
  2. [quote name='V-man' timestamp='1299269106' post='4781855'] [quote name='Mockarutan' timestamp='1299267556' post='4781846'] I can't figure out how to do normal alpha testing in openGL ES 2.0 on the android platform. I have tried to setup the blending factors exactly like in ES 1.1 where i get it to work, but in 2.0 it doesn't do a difference. I know that ES 2.0 is completely shader based and you are suppose to achieve many blending effects in the shader, but from what i have understood you can only to fully transparent stuff with the "discard" syntax in the shader. (unless you use multi texturing and blend the two textures together with some formula, but thats not blending with the render target.). So what am i missing here? Thanx for any help! //Tobias [/quote] Isn't there glEnable(GL_BLEND) and glBlendFunc in OpenGL ES? [/quote] It works.... I'm embarrassed xD I guess i misunderstood a text a reed in an openGL ES 2.0 book: [quote] Alpha test and LogicOp are no longer part of the per-fragment operations stage. These two stages exist in OpenGL 2.0 and OpenGL ES 1.x. The alpha test stage is no longer needed because the fragment shader can discard fragments and therefore the alpha test can be performed in the fragment shader. In addition, LogicOp is removed as it is very infrequently used by applications and the OpenGL ES working group did not get requests from independent software vendors (ISVs) to support this feature in OpenGL ES 2.0. [/quote] Thanx!
  3. I can't figure out how to do normal alpha testing in openGL ES 2.0 on the android platform. I have tried to setup the blending factors exactly like in ES 1.1 where i get it to work, but in 2.0 it doesn't do a difference. I know that ES 2.0 is completely shader based and you are suppose to achieve many blending effects in the shader, but from what i have understood you can only to fully transparent stuff with the "discard" syntax in the shader. (unless you use multi texturing and blend the two textures together with some formula, but thats not blending with the render target.). So what am i missing here? Thanx for any help! //Tobias
  4. [size="2"]So I'm currently researching how to optimize my graphics code on the android platform, running on a Legend. I'm right now trying to[font="Arial, Helvetica, sans-serif"] determine which of the two techniques are the faster for drawing sprites that is changing in position and texture coordinates almost every frame. Using a VBO and calling glBufferData to copy new data to the VRAM every frame, or just filling in a FloatBuffer and setting the vertex pointer to that buffer every frame. In my benchmarks i didn't notice any big change in frame rate. Is there even a difference? I mean in the end everything comes down to the transfer between the RAM and VRAM. Right?[/font] [font="Arial, Helvetica, sans-serif"] [/font] [font="Arial, Helvetica, sans-serif"]So which one should i go with?[/font] [font="Arial, Helvetica, sans-serif"] [/font] [font="Arial, Helvetica, sans-serif"]//Tobias [/font][/size]
  5. [quote name='V-man' timestamp='1296504832' post='4767636'] The things that could effect color is texture and lighting. So disable texturing and lighting. [/quote] Did not work, thanks for the tip though... Edit: I cracked it! It was the texturing Thanks!
  6. I have tried everything now. The closest i get is to draw the points black at the correct position, but they should be red. [code] //------------sets up the color array----------------- ByteBuffer cbb = ByteBuffer.allocateDirect((int)MAXQUADS * 4 * 4); cbb.order(ByteOrder.nativeOrder()); mColorArray = cbb.asFloatBuffer(); float[] temp = {0.0f, 0.0f, 0.0f, 1.0f}; for(int i = 0; i < MAXQUADS; i++) mColorArray.put(temp); //-------------render func-------------------------- gl.glClearColor(mR, mG, mB, 1.0f); gl.glClear(GL10.GL_COLOR_BUFFER_BIT); mVertexBuffer.position(0); int error; gl11.glDisableClientState(GL10.GL_TEXTURE_COORD_ARRAY); gl11.glEnable(GL11.GL_POINT_SMOOTH); gl11.glBindBuffer(GL11.GL_ARRAY_BUFFER, vertexBufferIndex2); gl11.glVertexPointer(3, GL11.GL_FLOAT, 0, 0); error = gl11.glGetError(); if(error == GL11.GL_INVALID_ENUM) Log.i(TAG, "Invalid enum1"); else if(error == GL11.GL_INVALID_VALUE) Log.i(TAG, "Invalid value1"); else if(error == GL11.GL_INVALID_OPERATION) Log.i(TAG, "Invalid operation1"); gl11.glEnableClientState(GL10.GL_COLOR_ARRAY); gl11.glBindBuffer(GL11.GL_ARRAY_BUFFER, 0); gl11.glColorPointer(4, GL10.GL_FLOAT, 0, mColorArray); error = gl11.glGetError(); if(error == GL11.GL_INVALID_ENUM) Log.i(TAG, "Invalid enum2"); else if(error == GL11.GL_INVALID_VALUE) Log.i(TAG, "Invalid value2"); else if(error == GL11.GL_INVALID_OPERATION) Log.i(TAG, "Invalid operation2"); error = gl11.glGetError(); if(error == GL11.GL_INVALID_ENUM) Log.i(TAG, "Invalid enum3"); else if(error == GL11.GL_INVALID_VALUE) Log.i(TAG, "Invalid value3"); else if(error == GL11.GL_INVALID_OPERATION) Log.i(TAG, "Invalid operation3"); gl.glPushMatrix(); gl.glTranslatef(5, 1.0f * 5, 0f); gl11.glDrawArrays(GL11.GL_POINTS, 0, 4); gl.glPopMatrix(); error = gl11.glGetError(); if(error == GL11.GL_INVALID_ENUM) Log.i(TAG, "Invalid enum4"); else if(error == GL11.GL_INVALID_VALUE) Log.i(TAG, "Invalid value4"); else if(error == GL11.GL_INVALID_OPERATION) Log.i(TAG, "Invalid operation4"); gl.glDisableClientState(GL10.GL_COLOR_ARRAY); gl.glEnableClientState(GL10.GL_TEXTURE_COORD_ARRAY); [/code] I'm very greatful for any help. Been stuck on this crap for 2 days now
  7. Can somebody show me code that works for drawing points? Even if it doesn't use VBO's...
  8. [quote name='karwosts' timestamp='1296420569' post='4767154'] Can you narrow down which line gives you the error? [/quote] gl11.glBindBuffer(GL11.GL_ARRAY_BUFFER, vertexBufferIndex2); gl11.glVertexPointer(3, GL11.GL_FLOAT, 0, 0); error = gl11.glGetError(); This gives me invalid operation.. but my enum problem has disappeared...
  9. I have i problem with opengl ES on android. I am trying to draw some simple points from a VBO with and a color array that a guess is a VBO too in a way? The thing is that this doesn't work at all... I know that the VBO (vertexBufferIndex2) is correct, because i normaly use it to draw quads, but i'm not so sure about the color array... so can you see any problem with this code? I'm testing it on a legend btw... [code] //-------------setup stuff in another funtion----------- ByteBuffer cbb = ByteBuffer.allocateDirect((int)MAXQUADS * 4 * 3); cbb.order(ByteOrder.nativeOrder()); mColorArray = cbb.asFloatBuffer(); float[] temp = {1.0f, 0.0f, 0.0f}; for(int i = 0; i < MAXQUADS; i++) mColorArray.put(temp); mColorArray.position(0); gl11.glGenBuffers(1, buffer, 0); colorArrayIndex = buffer[0]; gl11.glBindBuffer(GL11.GL_ARRAY_BUFFER, colorArrayIndex); gl11.glBufferData(GL11.GL_ARRAY_BUFFER, (int) (MAXQUADS * 4 * 3), mColorArray, GL11.GL_STATIC_DRAW); //-----------end of setup func---------- //-----------the following code is inside the draw func in openGL-------------- gl11.glEnableClientState(GL10.GL_COLOR_ARRAY); gl11.glDisableClientState(GL10.GL_TEXTURE_COORD_ARRAY); gl11.glBindBuffer(GL11.GL_ARRAY_BUFFER, vertexBufferIndex2); gl11.glVertexPointer(3, GL11.GL_FLOAT, 0, 0); gl11.glBindBuffer(GL11.GL_ARRAY_BUFFER, colorArrayIndex); gl11.glColorPointer(3, GL11.GL_FLOAT, 0, 0); gl.glPushMatrix(); gl.glTranslatef(temp, 1.0f * (float)i, 0f); gl11.glDrawArrays(GL11.GL_POINTS, 0, 4); int error = gl11.glGetError(); if(error == GL11.GL_INVALID_ENUM) Log.i(TAG, "Invalid enum"); else if(error == GL11.GL_INVALID_VALUE) Log.i(TAG, "Invalid value"); else if(error == GL11.GL_INVALID_OPERATION) Log.i(TAG, "Invalid operation"); gl.glPopMatrix(); //--------------- [/code] The glGetError gives me Invalis enum and invalid operation...
  10. I do not have an option named "x64" there and i have never seen that before.
  11. Quote:Original post by mind in a box Quote:I have set it to x64, my computer is 64 bits... Maybe this is the problem! Which version of Visual studio do you use? You can't compile you application under the x64 profile in the express editions. And if you use a pro version, your project configuration needs to be x64, too. I've got a x64 CPU, too, but because of my Express edition I can't compile anything for x64. Does it work with the x86 libs? I have a licensed version of VS 2008 PRO, where do i config it to a 64 bits project?
  12. Quote:Original post by Evil Steve 1. Did you set the libraries directory to the x86 or x64 directory, and not just "lib"? (The older SDKs just had 32-bit libs inside the "lib" directory, newer ones have subdirectories) I have set it to x64, my computer is 64 bits... Quote:Original post by Evil Steve 2. Does it work if you copy the .lib file to the same directory as your project or solution? If so, that means that visual studio probably can't find the .libs (Annoyingly, it silently fails instead of giving a warning / error if it can't find a lib). Yes i have, i'm VERY confused about this! I don't know what to do more... [Edited by - Mockarutan on May 10, 2010 1:40:12 PM]
  13. Hi, i was just about to compile a DX9 project after I had reinstalled window7. I'm not a beginner (reading gameprogremming in school) but a got a problem that i just can't understand... When i try to comple the DX9 proj. visual studio complains about Unresolved external symbols, all of them are D3DX calls. Look at the code that includes the libs, it's correct because it have been working before: #include "d3d9.h" #include "d3dx9.h" #ifdef _DEBUG # pragma comment(lib, "d3dx9d.lib") #else # pragma comment(lib, "d3dx9.lib") #endif #pragma comment(lib, "d3d9.lib") Error: Error 1 error LNK2019: unresolved external symbol _Direct3DCreate9@4 referenced in function "public: bool __thiscall GraphicsImp::initGraphics(int,int,bool,bool,float,bool)" (?initGraphics@GraphicsImp@@QAE_NHH_N0M0@Z) Graphics.obj Error 2 error LNK2019: unresolved external symbol _D3DXCreateEffectFromFileA@32 referenced in function "public: bool __thiscall GraphicsImp::initShader(void)" (?initShader@GraphicsImp@@QAE_NXZ) Graphics.obj Error 3 error LNK2019: unresolved external symbol _D3DXMatrixMultiply@12 referenced in function "public: struct D3DXMATRIX __thiscall D3DXMATRIX::operator*(struct D3DXMATRIX const &)const " (??DD3DXMATRIX@@QBE?AU0@ABU0@@Z) Graphics.obj Error 4 error LNK2019: unresolved external symbol _D3DXMatrixLookAtLH@16 referenced in function "private: void __thiscall GraphicsImp::configCamera(void)" (?configCamera@GraphicsImp@@AAEXXZ) Graphics.obj Error 5 error LNK2001: unresolved external symbol _D3DXMatrixLookAtLH@16 Camera.obj Error 6 error LNK2019: unresolved external symbol _D3DXMatrixPerspectiveFovLH@20 referenced in function "private: void __thiscall GraphicsImp::configProjection(void)" (?configProjection@GraphicsImp@@AAEXXZ) Graphics.obj Error 7 error LNK2019: unresolved external symbol _D3DXMatrixTranslation@16 referenced in function "private: void __thiscall GraphicsImp::configStdPresentValues(void)" (?configStdPresentValues@GraphicsImp@@AAEXXZ) Graphics.obj Error 8 error LNK2019: unresolved external symbol _D3DXMatrixScaling@16 referenced in function "private: void __thiscall GraphicsImp::configStdPresentValues(void)" (?configStdPresentValues@GraphicsImp@@AAEXXZ) Graphics.obj Error 9 error LNK2019: unresolved external symbol _D3DXMatrixRotationY@8 referenced in function "private: void __thiscall GraphicsImp::configStdPresentValues(void)" (?configStdPresentValues@GraphicsImp@@AAEXXZ) Graphics.obj Error 10 error LNK2019: unresolved external symbol _D3DXMatrixRotationX@8 referenced in function "private: void __thiscall GraphicsImp::configStdPresentValues(void)" (?configStdPresentValues@GraphicsImp@@AAEXXZ) Graphics.obj Error 11 error LNK2019: unresolved external symbol _D3DXCreateFontA@48 referenced in function "private: void __thiscall GraphicsImp::configFpsCounter(void)" (?configFpsCounter@GraphicsImp@@AAEXXZ) Graphics.obj Error 12 error LNK2019: unresolved external symbol _D3DXMatrixRotationZ@8 referenced in function "public: void __thiscall GraphicsImp::renderObjects(class std::list<class Entity *,class std::allocator< class Entity *> >)" (?renderObjects@GraphicsImp@@QAEXV?$list@PAVEntity@@V?$allocator@PAVEntity@@@std@@@std@@@Z) Graphics.obj Error 13 error LNK2019: unresolved external symbol _D3DXCreateTextureFromFileA@12 referenced in function "public: bool __thiscall GraphicsImp::setBackground(class std::basic_string< char,struct std::char_traits<char>,class std::allocator<char> >)" (?setBackground@GraphicsImp@@QAE_NV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) Graphics.obj Error 14 error LNK2019: unresolved external symbol _D3DXVec2Normalize@8 referenced in function "public: void __thiscall Entity::tractor(class Entity *)" (?tractor@Entity@@QAEXPAV1@@Z) Entity.obj Error 15 error LNK2001: unresolved external symbol _D3DXVec2Normalize@8 Ship.obj Error 16 fatal error LNK1120: 13 unresolved externals I know that this problem is caused be the linker, when it can't link a function call to it's defenition. But I got all the DX9 lib files included in VC++ Direcories, i even placed the required lib files inside the proj. folder... What have a missed? Thanks in advanced!
  14. Thanks for the tip about VMR9, it seems like exactly what i need. However, while implementing this i've run into a major problem. I've done all the steps necessary(99% sure anyway), the only thing i haven't done is create an array of surfaces, instead in the GetSurface() function i simply provide the backbuffer through Direct3DDevice->getRenderTarget(). Now basicly what happens when i start this is that i get an annoying window asking me if i want to use ffdshow or not, if no, video gets rendered in separate window, if yes, i get a grey window with nothing rendered. After some debugging i found that it's because PresentImage() is never called by VMR. I don't have the faintest idea why? Here's the relevant codes: Allocator class: #include "Allocator.h" #include "Graphics.h" Allocator::Allocator(Graphics* gDevice) { mGraphics = gDevice; mRefCount = 1; } Allocator::~Allocator() { mSurfAllocNotify->Release(); mSurfAllocNotify = NULL; } HRESULT STDMETHODCALLTYPE Allocator::InitializeDevice(DWORD_PTR dwUserID, VMR9AllocationInfo *lpAllocInfo, DWORD *lpNumBuffers) { return S_OK; } HRESULT STDMETHODCALLTYPE Allocator::TerminateDevice(DWORD_PTR dwID) { return S_OK; } HRESULT STDMETHODCALLTYPE Allocator::GetSurface(DWORD_PTR dwUserID, DWORD SurfaceIndex, DWORD SurfaceFlags, IDirect3DSurface9 **surface) { if( surface == NULL ) return E_POINTER; if(mGraphics->getRenderTarget(0, surface)) return S_OK; else return E_FAIL; } HRESULT STDMETHODCALLTYPE Allocator::AdviseNotify(IVMRSurfaceAllocatorNotify9 *pIVMRSurfAllocNotify) { if( pIVMRSurfAllocNotify == NULL) return E_POINTER; else mSurfAllocNotify = pIVMRSurfAllocNotify; return mSurfAllocNotify->SetD3DDevice(mGraphics->getDevice(), mGraphics->getDirect3D()->GetAdapterMonitor(D3DADAPTER_DEFAULT )); } HRESULT STDMETHODCALLTYPE Allocator::StartPresenting(DWORD_PTR dwUserID) { return S_OK; } HRESULT STDMETHODCALLTYPE Allocator::StopPresenting(DWORD_PTR dwUserID) { return S_OK; } HRESULT STDMETHODCALLTYPE Allocator::PresentImage(DWORD_PTR dwUserID, VMR9PresentationInfo *presInfo) { mGraphics->beginRender(true); mGraphics->renderGUI(); mGraphics->endRender(); return S_OK; } HRESULT STDMETHODCALLTYPE Allocator::QueryInterface(REFIID riid, void** ppvObject) { HRESULT hr = E_NOINTERFACE; if(ppvObject == NULL) hr = E_POINTER; else if(riid == IID_IVMRSurfaceAllocator9) { *ppvObject = static_cast<IVMRSurfaceAllocator9*>( this ); AddRef(); hr = S_OK; } else if(riid == IID_IVMRImagePresenter9) { *ppvObject = static_cast<IVMRImagePresenter9*>( this ); AddRef(); hr = S_OK; } else if(riid == IID_IUnknown) { *ppvObject = static_cast<IUnknown*>(static_cast<IVMRSurfaceAllocator9*>( this ) ); AddRef(); hr = S_OK; } return hr; } ULONG STDMETHODCALLTYPE Allocator::AddRef() { return InterlockedIncrement(&mRefCount); } ULONG STDMETHODCALLTYPE Allocator::Release() { ULONG ret = InterlockedDecrement(&mRefCount); if( ret == 0 ) delete this; return ret; } Class implementing the filter graph: #include "VideoPlayer.h" VideoPlayer::VideoPlayer(Graphics* gDevice) { mSurfAlloc = new Allocator(gDevice); mGraph = NULL; mMediaControl = NULL; mMediaEvent = NULL; mFilter = NULL; mIsPlaying = false; } VideoPlayer::~VideoPlayer() { mGraph ->Release(); mMediaControl ->Release(); mMediaEvent ->Release(); mFilter ->Release(); mGraph = NULL; mMediaControl = NULL; mMediaEvent = NULL; mFilter = NULL; CoUninitialize(); } bool VideoPlayer::init() { IVMRFilterConfig9* filterConfig = NULL; IVMRSurfaceAllocatorNotify9* surfAllocNotify = NULL; HRESULT hr = CoInitialize(NULL); if(SUCCEEDED(hr)) hr = CoCreateInstance(CLSID_FilterGraph, NULL, CLSCTX_INPROC_SERVER, IID_IGraphBuilder, (void**)&mGraph); else { MessageBox(0, L"CoCreateInstance FilterGraph Failed", L"Videoplayer error", MB_OK | MB_ICONERROR); return false; } if(SUCCEEDED(hr)) hr = CoCreateInstance(CLSID_VideoMixingRenderer9, NULL, CLSCTX_INPROC_SERVER, IID_IBaseFilter, (void**)&mFilter); else { MessageBox(0, L"CoCreateInstance VMR9 Failed", L"Videoplayer error", MB_OK | MB_ICONERROR); return false; } if(SUCCEEDED(hr)) hr = mFilter->QueryInterface(IID_IVMRFilterConfig9, reinterpret_cast<void**>(&filterConfig)); else { MessageBox(0, L"QueryInterface FilterConfig9 Failed", L"Videoplayer error", MB_OK | MB_ICONERROR); return false; } if(SUCCEEDED(hr)) hr = filterConfig->SetRenderingMode( VMRMode_Renderless ); else { MessageBox(0, L"SetRenderingMode failed", L"Videoplayer error", MB_OK | MB_ICONERROR); return false; } if(SUCCEEDED(hr)) hr = mFilter->QueryInterface(IID_IVMRSurfaceAllocatorNotify9, reinterpret_cast<void**>(&surfAllocNotify)); else { MessageBox(0, L"QueryInterface SurfaceAllocNotify Failed", L"Videoplayer error", MB_OK | MB_ICONERROR); return false; } if(SUCCEEDED(hr)) hr = surfAllocNotify->AdviseSurfaceAllocator(0, mSurfAlloc); else { MessageBox(0, L"CoCreateInstance FilterGraph Failed", L"Videoplayer error", MB_OK | MB_ICONERROR); return false; } if(SUCCEEDED(hr)) hr = mSurfAlloc->AdviseNotify(surfAllocNotify); else { MessageBox(0, L"CoCreateInstance FilterGraph Failed", L"Videoplayer error", MB_OK | MB_ICONERROR); return false; } if(SUCCEEDED(hr)) hr = mGraph->AddFilter(mFilter, L"Video Mixing Renderer 9"); else { MessageBox(0, L"AddFilter Failed", L"Videoplayer error", MB_OK | MB_ICONERROR); return false; } if(SUCCEEDED(hr)) hr = mGraph->QueryInterface(IID_IMediaControl, reinterpret_cast<void**>(&mMediaControl)); else { MessageBox(0, L"QueryInterface MediaControl", L"Videoplayer error", MB_OK | MB_ICONERROR); return false; } if(SUCCEEDED(hr)) hr = mGraph->QueryInterface(IID_IMediaEvent, reinterpret_cast<void**>(&mMediaEvent)); else { MessageBox(0, L"QueryInterface MediaEvent", L"Videoplayer error", MB_OK | MB_ICONERROR); return false; } return true; } bool VideoPlayer::playFile(LPWSTR filename) { HRESULT hr; hr = mGraph->RenderFile(filename, NULL); if(SUCCEEDED(hr)) hr = mMediaControl->Run(); else { MessageBox(0, L"RenderFile Failed", L"Videoplayer error", MB_OK | MB_ICONERROR); return false; } if(FAILED(hr)) return false; mIsPlaying = true; return true; } bool VideoPlayer::isPlaying() { HRESULT hr = S_OK; LONG evCode, lparam1, lparam2; while(SUCCEEDED(hr)) hr = mMediaEvent->GetEvent(&evCode, &lparam1, &lparam2, 0); mMediaEvent->FreeEventParams(evCode, lparam1, lparam2); if(evCode == EC_COMPLETE || evCode == EC_USERABORT) stop(); return mIsPlaying; } void VideoPlayer::stop() { FILTER_STATE fs; mMediaControl->GetState(5, (OAFilterState*)&fs); if(fs == State_Running) { mMediaControl->Pause(); mMediaControl->StopWhenReady(); mIsPlaying = false; } } Any help would be much appreciated.
  15. I'm looking for a good way to play video files in my game, in full screen. I have my own graphics engine and so, but i have no good idea how to play video in fullscreen. I have looked a lot in the internet but i only find outdated info. It seems almoast impossible to play video with DX9.0 in fullscreen. I have kind of successfully managed to play an avi file using DirectShow and EVR and it works great in windowed mode(i can even play it in fullscreen if graphics engine is set to windowed mode), however, if i put both graphics engine AND video to play in fullscreen, nothing gets rendered. Or should i use anything else that will work parallel with my graphics engine? Btw, i read that "true" fullscreen is no longer used by most applications and that you instead fake it by resizing the window to screen size. I tried this but encountered the problem because there's a maximum size you can resize window to(screen size) and that's a few pixels to small(borders of the window is a little visible on the sides). Anyway to fix this? //Tobias