Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

106 Neutral

About szpaq234

  • Rank

Personal Information

  • Interests
  1. szpaq234

    slimdx drawing a square

    it was 1 am, now it's clear. Thx anyway
  2. I'm trying to render a square in SlimDX. Code: public class Square { public Buffer vertexBuffer; public Square(Vector3 origin, float edge, Device device) { DataStream Vertices; Vertices = new DataStream(12 * 5, true, true); Vertices.Write(new Vector3(1, 1, 0)); Vertices.Write(new Vector3(-1, 1, 0)); Vertices.Write(new Vector3(-1, -1, 0)); Vertices.Write(new Vector3(1, -1, 0)); Vertices.Write(new Vector3(1, 1, 0)); Vertices.Position = 0; vertexBuffer = new Buffer(device, Vertices, 12 * 5, ResourceUsage.Default, BindFlags.VertexBuffer, CpuAccessFlags.None, ResourceOptionFlags.None, 0); Vertices.Close(); } public void Draw(Device device) { device.ImmediateContext.InputAssembler.PrimitiveTopology = PrimitiveTopology.LineStrip; device.ImmediateContext.InputAssembler.SetVertexBuffers(0, new VertexBufferBinding(vertexBuffer, 12, 0)); device.ImmediateContext.Draw(4, 0); } } However, only first four elements of DataStream Vertices are rendered. For square, it corresponds to 3 lines. I tried other PrimitiveTopology like TriangleList, TriangleStrip or PointList, they all behave the same - load only first 4 vertices no matter how big original DataStream is. I remember to create vertexBuffer with the same size as DataStream and tried to make it bigger as well.
  3. szpaq234

    pixel shader 3.0 for sprites

    can someone help me with this ? MJP says that i need vertex shader to make this work. I tried this: uniform extern float4x4 WVPMatrix; float4 VertexShader(float4 pos : POSITION0) : POSITION0 { return mul(pos, WVPMatrix); } but only thing i get is:"syntax error: unexpected integer constant. Once again: i have only sprites in my application (ID3DXSprite)
  4. szpaq234

    pixel shader 3.0 for sprites

    how vs for sprites should look like ? i don't have any vertices in my application
  5. I'm using pixel shader in my game based on sprites and "starter" looks like this: sampler2D textureSampler; float4 MyShader( float2 Tex : TEXCOORD0 ) : COLOR0 { float4 Color; Color = tex2D(textureSampler, Tex); return Color; } technique PostProcess { pass Pass1 { VertexShader = null; PixelShader = compile ps_2_0 MyShader(); } } I want to use pixel shader 3.0 to use VPOS input semantic but whne i use PixelShader = compile ps_3_0 MyShader(); whole screen has uniform color. Can someone tell how ps 3 should look like ?
  6. szpaq234

    [SlimDX] DirectX 10 Tutorials

    websites expired, I love the Internet
  7. szpaq234

    access to member of a child class

    Can you give me some pointers ? My idea was to make all objects in my applications derived from one class. I can't use virtual functions because then i will have override them in all derived classes.
  8. szpaq234

    access to member of a child class

    I guess you meant this: int main() { pSon = new Son(5); std::cout<<static_cast<Son*>(pSon)->GetInt(); return 0; } That one worked. Heh, i did not get the meaning of casting. Maybe i have to go through it again. Thx anyway.
  9. How do I do that ? #include <iostream> class Mother { public: Mother(){} }; class Son : public Mother{ private: int f_iA; public: Son(int _in){f_iA = _in;} int GetInt(){return f_iA;} }; Mother* pSon; int main() { pSon = new Son(5); std::cout<<pSon->GetInt(); //'GetInt' : is not a member of 'Mother' return 0; } }
  10. I figured out how to "z sort" my sprites (ID3DXSprite) so i don't have to worry about which sprites are rendered first. I just change the z value for coordinates. However, i noticed some stupid flaw in this method. Look at the attached image. On the picture on the left, upper fern is rendered later so it covers lower fern, everything is ok. On the right i changed the z coord of the lower fern to make it cover the upper one. At the edges of the fern i can see the ground. Somehow the upper fern is not rendered correctly. Textures are TGA files. Things that i think are relevant: D3DPRESENT_PARAMETERS pp; pp.BackBufferFormat = D3DFMT_A8R8G8B8; pp.EnableAutoDepthStencil=1; pp.AutoDepthStencilFormat = D3DFMT_D16; g_pd3dDevice->Clear( 0, NULL, D3DCLEAR_TARGET|D3DCLEAR_ZBUFFER, 0x0000FF00, 1.0f, 0L ); g_pd3dDevice->BeginScene(); gameRender(); g_pd3dDevice->EndScene(); g_pd3dDevice->Present( NULL, NULL, NULL, NULL ); Thank you.
  • 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!