Jump to content
  • Advertisement

Smit

Member
  • Content Count

    389
  • Joined

  • Last visited

Community Reputation

310 Neutral

About Smit

  • Rank
    Member
  1. Thats why he said 3x3 Grid. [smile] The center quad is the actual stretched part, you can just use a tileable texture or just colors to fill this. The other quads are the corners, top, bottom, left and right of the editbox. The corners would all be the same size and have (for example) a corner texture on them. The top and bottom would stretch to be the same width as the center quad and use a texture that tiles horizontally. The left and right would be the same height as the center quad and have a texture that tiles vertically. Sorry if this is a bit confusing.... just woke up.
  2. Smit

    D3D10 and XP. Again.

    I was expecting that, what's with the side trip through France though?
  3. Smit

    So my PSU exploded...

    Quote:Original post by joanusdmentia Did you check for forks? Seriously though, that's a little on the impressive side of things. The last time I had a PSU die on me it was in a puff of smoke, not an explosion of sparks. It's unlikely anything you did, most (all?) PSUs will cut out if you short anything outside of it. It sounds like some of the 240V circuitry died (perhaps shorted?), you wouldn't get a shower of sparks with 12V. If you're really curious open the thing up and find out which bit is blackest, check if the wires carrying 240V are still soldered to where they should be, and make sure there aren't any forks. Make sure you leave it awhile.... You don't want a 240V shock, they hurt.
  4. Smit

    some 'game world' questions...

    The polycount you use depends on lots of things like target hardware etc. As for the sky, google "sky domes" and "sky boxes".
  5. Quote:Original post by Evil Steve I can't see anything immediately wrong with it, although you have a potential memory leak in CreateVertexBuffer(), if IDirect3DDevice9::CreateVertexBuffer() fails, pVB is never deleted. Fixed that. Quote:Original post by Evil Steve Have you tried using DrawPrimitiveUP() instead, and see if that renders correctly? That will tell you if the problem is with your vertex data / matrices, or with the vertex buffer class itself (the locking and filling or whatever). I'm not sure about what to pass as pVertexStreamZeroData to DrawPrimitiveUP(), is this just my own array of the vertices? Quote:Original post by Evil Steve What is VERTEXTYPE_XYZCOLOUR defined as? Does it use D3DFVF_XYZRHW, or D3DFVF_XYZ? Its D3DFVF_XYZ | D3DFVF_DIFFUSE Quote:Original post by Evil Steve Have you chected the return value of DrawPrimitive to see if it's failing? Its returning D3D_OK. Quote:Original post by Evil Steve Are you using the debug runtimes, and is there any relevant debug output? I forgot about these. This is what I'm getting. 'test.exe': Loaded 'C:\WINDOWS\system32\d3dx9d_30.dll', No symbols loaded. Direct3D9: :====> ENTER: DLLMAIN(00b4d6e0): Process Attach: 00000ccc, tid=00000f50 Direct3D9: :====> EXIT: DLLMAIN(00b4d6e0): Process Attach: 00000ccc Direct3D9: (INFO) :Direct3D9 Debug Runtime selected. D3D9 Helper: Enhanced D3DDebugging disabled; Application was not compiled with D3D_DEBUG_INFO Direct3D9: (INFO) :======================= Hal SWVP device selected Direct3D9: (INFO) :HalDevice Driver Style 9 Direct3D9: :DoneExclusiveMode Direct3D9: (INFO) :Failed to create driver indexbuffer Direct3D9: (INFO) :Using X3D PSGP 'test.exe': Loaded 'C:\WINDOWS\system32\mslbui.dll', No symbols loaded. 'test.exe': Loaded 'C:\WINDOWS\system32\oleaut32.dll', No symbols loaded. Direct3D9: :====> ENTER: DLLMAIN(00b4d6e0): Process Detach 00000ccc, tid=00000f50
  6. I'm having a go at wrapping LPDIRECT3DVERTEXBUFFER9 in my own class after getting it working using just itself. However when testing it (trying to draw a single triangle) I get no output on the window apart from the clear colour. This is probably full of bad practises I know but at the moment I'm just messing around trying to get this to work [smile]. Can anyone see why this doesn't render? Header: [source lang='CPP'] #include "d3d9.h" class VertexBufferDX9 { public: bool AddData( void* pData ); DWORD GetFVF(); void SetFVF( DWORD dwFVF ); void SetPrimitiveCount( int nCount ); int GetPrimitiveCount(); LPDIRECT3DVERTEXBUFFER9 GetDXBuffer(); LPDIRECT3DVERTEXBUFFER9* GetPointerToBuffer(); private: DWORD m_dwFVF; int m_nPrimitiveCount; LPDIRECT3DVERTEXBUFFER9 m_pVertexBuffer; }; CPP: [source lang='CPP'] #include "vertexbuffer_dx9.h" #include "log.h" bool VertexBufferDX9::AddData( void *pData ) { // Pointer to vertices. VOID* pVertices; // Lock the buffer. HRESULT lockResult = m_pVertexBuffer->Lock( 0, 0, (void**)&pVertices, 0 ); if( lockResult != D3D_OK ) { Log->Report( "Could not lock vertex buffer!" ); return false; } // Copy the data into the VB. memcpy( pVertices, pData, sizeof( pData ) ); // Unlock the buffer. HRESULT unlockResult = m_pVertexBuffer->Unlock(); if( unlockResult != D3D_OK ) { Log:->Report( "Could not unlock vertex buffer!" ); return false; } return true; } DWORD VertexBufferDX9::GetFVF() { return m_dwFVF; } void VertexBufferDX9::SetFVF(DWORD dwFVF) { m_dwFVF = dwFVF; } LPDIRECT3DVERTEXBUFFER9* iVertexBufferDX9::GetPointerToBuffer() { return &m_pVertexBuffer; } LPDIRECT3DVERTEXBUFFER9 VertexBufferDX9::GetDXBuffer() { return m_pVertexBuffer; } void VertexBufferDX9::SetPrimitiveCount( int nCount ) { m_nPrimitiveCount = nCount; } int VertexBufferDX9::GetPrimitiveCount() { return m_nPrimitiveCount; } This is how I create the buffer: [source lang='CPP'] VertexBufferDX9* CreateVertexBuffer( int nSize, DWORD dwFVF, void* pData, int nPrimCount ) { VertexBufferDX9* pVB = new VertexBufferDX9(); HRESULT createResult = pDevice->CreateVertexBuffer( nSize, D3DUSAGE_WRITEONLY, dwFVF, D3DPOOL_MANAGED, pVB->GetPointerToBuffer(), NULL ); if( createResult != D3D_OK ) { Log->Report( "Could not create vertex buffer!" ); return NULL; } pVB->SetFVF( dwFVF ); pVB->AddData( pData ); pVB->SetPrimitiveCount( nPrimCount ); return pVB; } Filling it with data: [source lang='CPP'] VERTEXTYPE_XYZCOLOUR testDraw[] = {{-2.0f, 1.0f,10.0f,0xffff0000}, {-3.0f,-1.0f,10.0f,0xff00ff00}, {-1.0f,-1.0f,10.0f,0xff0000ff}}; testVB = CreateVertexBuffer( sizeof(testDraw), FVF_XYZCOLOUR, testDraw, 1 ); Then rendering: [source lang='CPP'] pDevice->Clear(0, NULL, D3DCLEAR_TARGET, D3DCOLOR_XRGB(0, 40, 100), 1.0f, 0); pDevice->BeginScene(); pDevice->SetFVF( testVB ->GetFVF() ); pDevice->SetStreamSource( 0, testVB->GetDXBuffer(), 0, sizeof( VERTEXTYPE_XYZCOLOUR ) ); pDevice->DrawPrimitive( D3DPT_TRIANGLELIST, 0, testVB->GetPrimitiveCount() ); pDevice->EndScene(); pDevice->Present(NULL, NULL, NULL, NULL); Thank you for reading.
  7. Smit

    What the hell opens a .dvd?

    That was it! From http://www.slysoft.com. Thanks!
  8. Awhile ago I noticed my backup dvd (with all of my old code/models/textures etc.) was getting a bit busted so I downloaded the first dvd imaging software that actually worked and made a copy. However I can't remember what the software was... My four year old drive has decided to pack up and I wanted to continue an old project but now I can't open the damn image. Its all imaged in files called backup.dvd, backup.000, backup.001. I tried google looking for the software I used but of course using phrases like ".dvd imaging software" result in a useless list of software thats spammed itself to the top. Anyone here that knows what app to use? [smile] I remember there being a fox or sheep or something on the website I got it from. Thanks!
  9. Smit

    Correct Opengl TexCoords?

    I'm using glu.gluOrtho2D( 0, 320, 0, 240 ); This should give me 0/0 bottom left and 340/240 top right shouldn't it?
  10. Smit

    Correct Opengl TexCoords?

    Ah, thank you. Next problem [smile], I changed the texcoords around instead of the vertices but now the texture is flipped vertically. I know BMPs are stored upside down but I thought that the TextureIO class would flip it the right way around when loading. Changed code: gl.glTexCoord2f( 0.0f, 0.0f ); gl.glVertex3f( 100.0f, 100.0f, 0.0f ); gl.glTexCoord2f( 1.0f, 0.0f ); gl.glVertex3f( 200.0f, 100.0f, 0.0f ); gl.glTexCoord2f( 1.0f, 1.0f ); gl.glVertex3f( 200.0f, 200.0f, 0.0f ); gl.glTexCoord2f( 0.0f, 1.0f ); gl.glVertex3f( 100.0f, 200.0f, 0.0f ); I could fix it by flipping the texcoords as well but that seems kind of hacky.
  11. I'm confused about the correct order of texcoords in OpenGL. This article says that the bottom left is 0.0f/0.0f and the top right is 1.0f/1.0f but my texture is rotated when I draw using those coords. I load it from a BMP using com.sun.opengl.util.texture.TextureIO which works fine, and then draw it like so: gl.glTexCoord2f( 0.0f, 0.0f ); gl.glVertex3f( 100.0f, 100.0f, 0.0f ); gl.glTexCoord2f( 0.0f, 1.0f ); gl.glVertex3f( 200.0f, 100.0f, 0.0f ); gl.glTexCoord2f( 1.0f, 1.0f ); gl.glVertex3f( 200.0f, 200.0f, 0.0f ); gl.glTexCoord2f( 1.0f, 0.0f ); gl.glVertex3f( 100.0f, 200.0f, 0.0f ); The texture looks like: However when I draw I get: Am I doing something stupid? Thanks!
  12. Just the window. No OpenGL drawing at all.
  13. Everything I've read seems to indicate that the methods in Renderer are called auotmatically. I tried the border layout too but I still get a blank window. Could someone try the code above on their machine? Thanks for the help!
  14. I'm trying to use OpenGL in a Java project so I've downloaded installed jogl and the following code compiles fine but it seems OpenGL is never setup. MainWindow which sets up OpenGL. [source lang='Java'] import java.awt.*; import javax.swing.*; import javax.media.opengl.GL; import javax.media.opengl.GLEventListener; import javax.media.opengl.GLAutoDrawable; import javax.media.opengl.GLCanvas; import javax.media.opengl.GLCapabilities; import javax.media.opengl.GLDrawableFactory; public class MainWindow extends JFrame { private Renderer mainRenderer; private GLCanvas mainCanvas; public void createMainWindow( ) { setSize( 500, 500 ); setTitle( "Test" ); setLocation( 20, 200 ); //Display the window. show(); setupOpenGL( ); } public void setupOpenGL( ) { GLCapabilities caps = new GLCapabilities(); caps.setHardwareAccelerated( true ); caps.setDoubleBuffered( true ); mainCanvas = new GLCanvas( caps, null, null, null ); mainRenderer = new Renderer(); mainCanvas.setSize( 320, 240 ); mainCanvas.addGLEventListener( mainRenderer ); Container con = getContentPane(); con.add( mainCanvas ); mainCanvas.display(); } public void update() { mainCanvas.display(); } } Renderer [source lang='Java'] import javax.media.opengl.GL; import javax.media.opengl.GLEventListener; import javax.media.opengl.GLAutoDrawable; import javax.media.opengl.glu.GLU; public class Renderer implements GLEventListener { private static final GLU glu = new GLU(); public void display( GLAutoDrawable glDrawable ) { final GL gl = glDrawable.getGL(); gl.glClear( GL.GL_COLOR_BUFFER_BIT ); gl.glClear( GL.GL_DEPTH_BUFFER_BIT ); gl.glLoadIdentity(); gl.glTranslatef( 0.0f, 0.0f, -5.0f ); gl.glBegin( GL.GL_QUADS ); gl.glColor3f( 1.0f, 0.0f, 0.0f ); gl.glVertex3f( -1.0f, 1.0f, 0.0f ); gl.glVertex3f( -1.0f, -1.0f, 0.0f ); gl.glVertex3f( 1.0f, -1.0f, 0.0f ); gl.glVertex3f( 1.0f, 1.0f, 0.0f ); gl.glEnd(); } public void displayChanged( GLAutoDrawable glDrawable, boolean modeChanged, boolean deviceChanged ) { } public void init( GLAutoDrawable glDrawable ) { final GL gl = glDrawable.getGL(); gl.glShadeModel(GL.GL_SMOOTH); gl.glClearColor(0.0f, 0.0f, 0.0f, 0.0f); gl.glClearDepth(1.0f); gl.glEnable(GL.GL_DEPTH_TEST); gl.glDepthFunc(GL.GL_LEQUAL); gl.glHint(GL.GL_PERSPECTIVE_CORRECTION_HINT, GL.GL_NICEST); } public void reshape( GLAutoDrawable glDrawable, int x, int y, int width, int height ) { final GL gl = glDrawable.getGL(); if(height <= 0) { height = 1; } final float h = (float)width / (float)height; gl.glMatrixMode(GL.GL_PROJECTION); gl.glLoadIdentity(); glu.gluPerspective(50.0f, h, 1.0, 1000.0); gl.glMatrixMode(GL.GL_MODELVIEW); gl.glLoadIdentity(); } } Main Loop [source lang='Java'] while( bQuit == false ) { mainWindow.update(); } It compiles fine and I get a window but I don't get any OpenGL stuff at all. Every gl/java tut/article seems to setup in a completly different way each time and I can't seem to get any of them working. Thanks for looking!
  15. Quote:Original post by noVum What do you mean by "discard" them. I can't just not draw the entire triangle if one of the vertices lies on e.g. (0,0,0) in camera-space. From my understanding you generate new vertices at the edge. Don't quote me on that though :S
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!