• Advertisement

neatdev

Member
  • Content count

    26
  • Joined

  • Last visited

Community Reputation

139 Neutral

About neatdev

  • Rank
    Member
  1. AngelScript 2.30.2 is out

    Ok, that was quick. I just remembered that I typed make install after I built the libraries for the old version. Forgot it this time. But now everything works as it should!
  2. AngelScript 2.30.2 is out

    Hi!   I just switched to version 2.30.2 because I wanted to try out some of optimizations. The current version I am using is "2.30.0 WIP" according to angelscript.h.   I am on a Macbook and run "make -f makefile" in "projects/gnuc macosx" to build the library. Then I link the library to my project (through scons). But when running the executable I get a NULL object when calling asCreateScriptEngine(ANGELSCRIPT_VERSION);   If I hardcode and call asCreateScriptEngine(23000) (the old version but the new code) I do not get any null pointer back.   Don't know what I am doing wrong. Have you seen this behaviour before?
  3. It seems like I found the answer myself. I had to get the actor from the NxController object and set some collision group for that actor as well.
  4. Does anyone know how to get a collision report when an actor/shape hits a character controller in PhysX? I am getting collision reported between a character controller and a shape and also between a character and another character. This is done by deriving from NxUserControllerHitReport and implementing onShapeHit() and onControllerHit(). The collisions are reported when I move the character against a ball or a wall, exactly as stated in the documentation. I am also getting collision reported between two actors by deriving from NxUserContactReport and implementing onContactNotify(). But what can I do to get a collision report when the character is standing still and an actor/shape is hitting? The collisions DO work. I just do not get any report back. This is for a hobby FPS project I am creating. My idea was to use an actor/shape for enemy bullets and a character capsule controller for the player.
  5. Does anyone know how to get a collision report when an actor/shape hits a character controller in PhysX? I am getting collision reported between a character controller and a shape and also between a character and another character. This is done by deriving from NxUserControllerHitReport and implementing onShapeHit() and onControllerHit(). The collisions are reported when I move the character against a ball or a wall, exactly as stated in the documentation. I am also getting collision reported between two actors by deriving from NxUserContactReport and implementing onContactNotify(). But what can I do to get a collision report when the character is standing still and an actor/shape is hitting? The collisions DO work. This is for a hobby FPS project I am doing. My idea was to use an actor/shape for enemy bullets and a character capsule controller for the player.
  6. Trying to reduce memory

    Thank you very much for that explanation! Well, then maybe I do not need to focus on reducing allocated memory from an already low level of 5 MB!
  7. I'm working on my hobby, making a small game engine. And together a small game where you just walk around... Most of the stuff is working, I am doing some things to speed it up and reduce memory used. I have used the NeHe tutorial as base to create a window. I work on Windows XP and use the Win32 commands to create a window. The problem I am having is when I start my game (windowed or fullscreen) and do all initializing stuff the game is allocating 87 MB of RAM. But if I minimize the game window it drops down to 1.2 MB!! When restoring the window to its initial state the memory goes up to 5 MB. I really do not know what is going on here. Do any of you have any idea what could be causing the great difference in memory just by minimizing/maximizing the window? I load up a lot of textures, bind them and then delete the texture data memory. I am not doing any fancy stuff when minimizing the window. Just use an ordinary callback function to listen to window messages. The code below shows what happens when a WM_SIZE message arrives: case WM_SIZE: { switch (wParam) { // Was window minimized? case SIZE_MINIMIZED: { window->_visible = false; break; } // Was window maximized? case SIZE_MAXIMIZED: { window->_visible = true; break; } // Was window restored? case SIZE_RESTORED: { window->_visible = true; break; } } break; }
  8. Maybe this application could be of some help: http://sourceforge.net/projects/classbuilder/ This is one of my favourite applications! It is very convenient for creating new classes, methods, member variables and then exporting/saving the source files. It is for C++ though so it might not be useful for you.
  9. OK thanks guys! Now I learned one more thing to remember... /Nils
  10. What is this?? If I change the last lines in the vertex program DynamicLightsV above from these lines: oColor = emissive + ambient + diffuse; oColor.a = 1; to these: oColor = color; //oColor = emissive + ambient + diffuse; //oColor.a = 1; Then it will output the incoming color as expected. If I try to assign the value of for example emissive or a hard coded value such as float4(1, 0, 0, 1) I also get the same error!?! Why does this happen? What am I doing wrong?
  11. No, it is float4. Below are the programs for the lighting effect (global lighting with 0 point lights) It does not matter using float4 for position and normal although I use cgGLSetParameterPointer(cgParamPositionV, 3, GL_FLOAT, 0, pVertices), does it? At the moment I have two other effects ("pass through" and "multiple layers") that work using cgGLSetParameterPointer for colors. void DynamicLightsV(float4 position : POSITION, float4 normal : NORMAL, float4 color : COLOR, uniform float3 camPosition, uniform float4 globalAmbient, uniform float4 globalDiffuse, uniform float3 globalDirection, uniform float4 materialEmissive, uniform float4 materialAmbient, uniform float4 materialDiffuse, uniform float4 materialSpecular, uniform float materialShininess, out float4 oPosition : POSITION, out float4 oPositionOS : TEXCOORD6, out float4 oNormalOS : TEXCOORD7, out float4 oColor : COLOR) { oPosition = mul(glstate.matrix.mvp, position); oPositionOS = position; oNormalOS = normal; oColor = color; // Compute color (emissive, ambient, diffuse and specular) float4 emissive = materialEmissive; float4 ambient = materialAmbient * globalAmbient; float3 L = -globalDirection; float3 N = normalize(normal).xyz; float NdotL = dot(N, L); float4 litResult = lit(NdotL, 0, 0); float diffuseLight = litResult.y; float4 diffuse = materialDiffuse * globalDiffuse * diffuseLight; oColor = emissive + ambient + diffuse; oColor.a = 1; } // Pixel shader void DynamicLightsF(float4 position : TEXCOORD6, float4 normal : TEXCOORD7, float4 color : COLOR, uniform Light lights[2], uniform float3 camPosition, uniform float4 materialDiffuse, uniform float4 materialSpecular, uniform float materialShininess, out float4 oColor : COLOR) { // From object to eye space position = mul(glstate.matrix.modelview[0], position); normal = mul(glstate.matrix.invtrans.modelview[0], normal); float3 P = position.xyz; float3 N = normalize(normal.xyz); // Compute diffuse and specular terms float4 diffuseAndSpecular = 0; oColor = computeFinalColor(color, diffuseAndSpecular); }
  12. Hello, I've been trying out cg programming, I have read 'The Cg Tutorial' and got some small programs up and running. I use vertex arrays. For setting positions and normals I use cgGLSetParameterPointer like this: ... cgParamPositionV = cgGetNamedParameter(cgProgramV, "position"); cgParamNormalV = cgGetNamedParameter(cgProgramV, "normal"); ... cgGLSetParameterPointer(cgParamPositionV, 3, GL_FLOAT, 0, pVertices); cgGLEnableClientState(cgParamPositionV); cgGLSetParameterPointer(cgParamNormalV, 3, GL_FLOAT, 0, pNormals); cgGLEnableClientState(cgParamNormalV); ... This is working correctly, never any problem. But when I want to add vertex colors I get the error message "errstring: CG ERROR : The parameter used is invalid." I do like this: ... cgParamPositionV = cgGetNamedParameter(cgProgramV, "position"); cgParamNormalV = cgGetNamedParameter(cgProgramV, "normal"); cgParamColorV = cgGetNamedParameter(cgProgramV, "color"); ... cgGLSetParameterPointer(cgParamPositionV, 3, GL_FLOAT, 0, pVertices); cgGLEnableClientState(cgParamPositionV); cgGLSetParameterPointer(cgParamNormalV, 3, GL_FLOAT, 0, pNormals); cgGLEnableClientState(cgParamNormalV); cgGLSetParameterPointer(cgParamColorV, 4, GL_FLOAT, 0, pColors); cgGLEnableClientState(cgParamColorV); ... I have checked and double-checked that the parameters are named exactly "position", "normal" and "color" in the vertex program. Have any of you seen this problem before? I know it can be hard for you to find out how to fix this but I am starting to get really annoying about this problem and just have to get it out!! I think the problem might be that the array pColors does not hold the correct values that it should...
  13. I am doing some simple Cg stuff. Mostly it is working but I am having some problems. The source code below is working when I #define USE_OPENGL_ACTIVATION. The textures are appearing and the texcoords are correct. But if I skip the glClientActiveTexture(...) and glActiveTexture(...) calls, although I get correct textures on the meshes, the texcoords does not seem to be used. The meshes are only drawn with one color. As you can see, I am calling cgGLSetTextureParameter(...) and cgGLEnableTextureParameter(...) in correct order. I call the appropiate glEnableClientState(GL_TEXTURE_COORD_ARRAY), glEnableClientState(GL_COLOR_ARRAY) etc in my setup routine. I THINK I have done everything correctly. I have tried to call glEnableClientState(GL_TEXTURE_COORD_ARRAY) when doing cgGLSetTextureParameter(...) and cgGLEnableTextureParameter(...) The thing is, I want to be able to use NVidia's 16 texture units and not only OpenGL's 4 texture units. By using OpenGL activation I am forced to work with only 4 texture units. What am I doing wrong? Am I missing some call to Cg that state NOT to use OpenGL activation? I hope some expert out there can help me :) NGraphics3.cpp ... // Base passes for (int i = 0; i < drawObject->_basePasses.size(); i++) { pass = drawObject->_basePasses[i]; changeBlend(pass->_blendSource, pass->_blendDestination); #ifdef USE_OPENGL_ACTIVATION glClientActiveTexture(GL_TEXTURE0 + i); glActiveTexture(GL_TEXTURE0 + i); #endif if (i == 0) { texParam = cgParametersTexture0[numberOfLights]; } else if (i == 1) { texParam = cgParametersTexture1[numberOfLights]; } setPass(pass, texParam); } ... void NGraphics3D::setPass(shared_ptr<NDrawPass> pass, CGparameter texParam) {//@CODE_2950 glTexCoordPointer(2, GL_FLOAT, 0, pass->_texCoords.get()); glColorPointer(4, GL_FLOAT, 0, pass->_colors.get()); if (pass->_texture != NULL) { cgGLSetTextureParameter(texParam, pass->_texture->_id); cgGLEnableTextureParameter(texParam); } else { cgGLSetTextureParameter(texParam, 0); cgGLEnableTextureParameter(texParam); } if (pass->_repeat) { glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); } else { glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); } pp_lighting_f.cg ... float4 computeFinalColor(float4 color, float4 diffuseAndSpecular, float fogExponent : TEXCOORD5, float3 fogColor, uniform sampler2D tex0, uniform sampler2D tex1, uniform sampler2D lightmap, uniform sampler2D blendmap, float2 texCoord0 : TEXCOORD0, float2 texCoord1 : TEXCOORD1, float2 texCoordLightmap : TEXCOORD2, float2 texCoordBlendmap : TEXCOORD3) { float4 lightColor = color + diffuseAndSpecular; float4 texColor0 = tex2D(tex0, texCoord0); float4 texColor1 = tex2D(tex1, texCoord1); ...
  14. Texture coords in Cg

    Sorry, I did not post this to the correct forum. Can it be moved to Graphics Programming?
  15. Texture coords in Cg

    I am doing some simple Cg stuff. Mostly it is working but I am having some problems. The source code below is working when I #define USE_OPENGL_ACTIVATION. The textures are appearing and the texcoords are correct. But if I skip the glClientActiveTexture(...) and glActiveTexture(...) calls, although I get correct textures on the meshes, the texcoords does not seem to be used. The meshes are only drawn with one color. As you can see, I am calling cgGLSetTextureParameter(...) and cgGLEnableTextureParameter(...) in correct order. I call the appropiate glEnableClientState(GL_TEXTURE_COORD_ARRAY), glEnableClientState(GL_COLOR_ARRAY) etc in my setup routine. I THINK I have done everything correctly. I have tried to call glEnableClientState(GL_TEXTURE_COORD_ARRAY) when doing cgGLSetTextureParameter(...) and cgGLEnableTextureParameter(...) The thing is, I want to be able to use NVidia's 16 texture units and not only OpenGL's 4 texture units. By using OpenGL activation I am forced to work with only 4 texture units. What am I doing wrong? Am I missing some call to Cg that state NOT to use OpenGL activation? I hope some expert out there can help me :) NGraphics3.cpp ... // Base passes for (int i = 0; i < drawObject->_basePasses.size(); i++) { pass = drawObject->_basePasses[i]; changeBlend(pass->_blendSource, pass->_blendDestination); #ifdef USE_OPENGL_ACTIVATION glClientActiveTexture(GL_TEXTURE0 + i); glActiveTexture(GL_TEXTURE0 + i); #endif if (i == 0) { texParam = cgParametersTexture0[numberOfLights]; } else if (i == 1) { texParam = cgParametersTexture1[numberOfLights]; } setPass(pass, texParam); } ... void NGraphics3D::setPass(shared_ptr<NDrawPass> pass, CGparameter texParam) {//@CODE_2950 if (false)//drawObject->_preDraw) { glBindBuffer(GL_ARRAY_BUFFER, pass->_vboIdTexCoords); glTexCoordPointer(2, GL_FLOAT, 0, NULL); glBindBuffer(GL_ARRAY_BUFFER, pass->_vboIdColors); glColorPointer(4, GL_FLOAT, 0, NULL); } else { glTexCoordPointer(2, GL_FLOAT, 0, pass->_texCoords.get()); glColorPointer(4, GL_FLOAT, 0, pass->_colors.get()); } if (pass->_texture != NULL) { cgGLSetTextureParameter(texParam, pass->_texture->_id); cgGLEnableTextureParameter(texParam); } else { cgGLSetTextureParameter(texParam, 0); cgGLEnableTextureParameter(texParam); } if (pass->_repeat) { glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); } else { glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); } pp_lighting_f.cg ... float4 computeFinalColor(float4 color, float4 diffuseAndSpecular, float fogExponent : TEXCOORD5, float3 fogColor, uniform sampler2D tex0, uniform sampler2D tex1, uniform sampler2D lightmap, uniform sampler2D blendmap, float2 texCoord0 : TEXCOORD0, float2 texCoord1 : TEXCOORD1, float2 texCoordLightmap : TEXCOORD2, float2 texCoordBlendmap : TEXCOORD3) { float4 lightColor = color + diffuseAndSpecular; float4 texColor0 = tex2D(tex0, texCoord0); float4 texColor1 = tex2D(tex1, texCoord1); ...
  • Advertisement