Advertisement Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

214 Neutral

About programmer_tom

  • Rank
  1. programmer_tom

    Trouble transforming vertices in simple shader.

    Argh it wasn't any of those things :(   Any other ideas?
  2. Hey all,   Having some trouble with what should be a simple thing to do... I've successfully compiled and linked very simple vertex and fragment shaders. Having trouble seeing my red triangle though.   This stuff all goes fine:   GLint ProgramObject = glCreateProgram(); glAttachShader ( ProgramObject, VertexShaderObject );  glAttachShader ( ProgramObject, PixelShaderObject ); glLinkProgram ( ProgramObject ); glUseProgram ( ProgramObject );     VBO creation:   GLuint vbo; glGenBuffers ( 1, &vbo ); glBindBuffer ( GL_ARRAY_BUFFER, vbo );      GLfloat pos[] = { -0.5, -0.5, 0.5,                            0.5, -0.5, 0.5,                            0.0,  0.5, 0.5 };                                       glBufferData, GL_ARRAY_BUFFER, sizeof(pos), &pos[0], GL_STATIC_DRAW;     // Something is wrong here i am guessing...   int nPositionID = glGetAttribLocation ( ProgramObject, "s_vPosition" ); glEnableVertexAttribArray ( nPositionID ); glVertexAttribPointer ( nPositionID, 3, GL_FLOAT, FALSE, 0, 0 );                /*    glBegin(GL_TRIANGLES);    glVertexAttrib3f ( nPositionID, -0.5, -0.5, 0.0 );  // If i do this, i see my red triangle (correct fragment color).    glVertexAttrib3f ( nPositionID,  0.5, -0.5, 0.0 );  // Makes me believe context is ok.    glVertexAttrib3f ( nPositionID,  0.0,  0.5, 0.0 );    glEnd();    */     glDrawArrays ( GL_TRIANGLES, 0, 3 );      SwapBuffers ( m_DeviceContext );     vertex shader looks like this:   #version 130\n in vec4 s_vPosition; void main() { gl_Position = vec4 ( s_vPosition.x, s_vPosition.y, s_vPosition.z, 1.0 ); }     Any ideas?
  3. programmer_tom

    Quick Question on shadow mapping and terrains

    Basically, if the terrain is to receive shadows, you need to first render the shadow casters (objects other than terrain) into a shadow map in a first pass.   Then, when you want to render the terrain, you apply shadows to the terrain in the pixel shader, using the shadow map that the casters rendered into.
  4. don't you have to set the width and height no matter if you're windowed or fullscreen?   d3dpp.BackBufferWidth = Width; d3dpp.BackBufferHeight = Height;   You're setting the client area here when you change the presenatation params.   Also, those window styles can be a royal pain in the ass to get right when going from fullscreen to windoed and vice versa.
  5. Hey all I'm a bit new to IOS development. Having a bit of trouble with implementing Airplay for iPad. By default, if you turn it on, the 2nd monitor mirrors the device output. But, we want to customize the output to the second screen. Has anyone done this before? Looking for the basics here on how to go about it. Do I want more than one view controller? Do I switch "screens" to render then switch back? A bit lost.
  6. programmer_tom

    Socket Issue

    hey thanks for the reply ya TCP is fine here. after looking at it more, looks like when I'm calling recv(), i'm blindly assuming there's one message there. when i crank msgs fast from the server, that's not the case. gonna look at building a smarter read(). -tom
  7. programmer_tom

    Socket Issue

    Hey All I'm pretty new to socket programming in c++, but i've managed to get a client/server thing going pretty well after a few days. Everything is all hooked up and I'm sending packets both ways fine in general. As a test, I tried sending 100 messages at once using send() and recv(), and it looks like I'm getting about half of them to the other side. What's the story with ACKing or whatever I need to do to be able to spam messages and guarantee their arrival? -tom
  8. Hey all, Looking for some advice on approaches to coding a platformer in 3D. I have a full rendering engine and use PhysX well...just looking to hear what other people say works, does not work etc. before I start. Any help is appreciated!
  9. Are your vertices in 2D or 3D? It looks like 3D. How are your vertices already transformed? Typically, you have vertices of a model in local space. To get them to screen space, it a matrix multiply for each local vertex by the concatenated world*view*projection matrix. where world is the object's world transform. do you mean your vertices are already in world space? if so, matrix multiply by the view*projection matrix. If by pre-transformed you mean 2D, there's other stuff you have to do.
  10. programmer_tom

    instance technique using dx9

    My heroic efforts were to avoid making many DrawPrimitive() calls on things with only a few vertices for performance reasons. The meshes I instanced only had one subset. Your needs may be different here. If your shader has a problem compiling you have bigger problems than efficiency. If you don't have any tech written to reload the shader automatically, binary search it and find what's stopping if from compiling. If you want, I can take a quick look at it if you send the code to
  11. programmer_tom

    instance technique using dx9

    LPD3DXMESH sucks and will be a problem for you as long as you use it, but when I used to use it, here's how I instanced. I needed to render many small meshes and wanted to minimize Draw() calls, so i built a super mesh by going though the vertices/indices of the mesh, and duplicating it into a single vertex and index buffer. When you do this, you need to index the sub meshes somehow, as each one will have a different transformation matrix. Then write a simple shader that uses the index to transform the verts (pass down an array of transformation matrices, one for each submesh). I'm sure there are other ways to do this but this is how I did it. Of course, the clipping becomes annoying and you will have other semi-illogical things to deal with because the instances are part of a bigger mesh now.
  12. programmer_tom

    Jumping Physics I got. Keypresses I dont...

    First of all, you need to consider elapsed time here. velocity-= .0003; will yield different results under different frame rates. The way I handle simple jumping is essentially like this: 1.) detect user has pushed the jump key. 2.) if ( not already jumping ) jump velocity.y = jump initial velocity. in the Animate() portion of this object: if ( jump velocity.y > 0 ) jump velocity.y = max ( jump velocity.y - elapsed Time * gravity, 0 ) are you having trouble detecting key presses? where's that code?
  13. if( FAILED( d3d9VertexBuffer->Lock( 0, 0, ( void** )&pIndices, D3DLOCK_DISCARD ) ) ) you realize you are getting a pointer to the vertex buffer back in pIndices here right? You probably mean to do this if( FAILED( d3d9VertexBuffer->Lock( 0, 0, ( void** )&pVertices, D3DLOCK_DISCARD ) ) )
  14. programmer_tom

    Blend Modes - Writing Alpha to a texture

    can you visualize the texture you've written the collision info to? texture a 2d quad with it...what's it look like? here's something that got me a while ago; not sure if it's related but when writing to textures, make sure you enable alpha. CGameObject::SetRenderState ( D3DRS_COLORWRITEENABLE, D3DCOLORWRITEENABLE_RED | D3DCOLORWRITEENABLE_GREEN | D3DCOLORWRITEENABLE_BLUE | D3DCOLORWRITEENABLE_ALPHA ); the default is rgb, no alpha i think.
  15. programmer_tom

    Textured Quads Particle System

    You're going to need each quad to be made of 6 vertices, because the system is going to need to be drawn as a triangle list. If I were you, I wouldn't update the list in real time at all...let the shader move the points around it. Build the vertices with information that is velocity etc, then just pass down delta time, an origin etc. to the shader once for each system.
  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. 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!