Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

231 Neutral

About syskrank

  • Rank

Personal Information

  • Role
  • Interests
  1. syskrank

    SDL2 vector graphics image loader

    Yeah, I know, I've just been lazy hitting 'up' and changing 1s to 2s in gcc command =) Glad everything worked.
  2. syskrank

    SDL2 vector graphics image loader

    Well this is the answer for your problem with compiling examples.       Go to http://www.glfw.org/, download source package.   Then go to console and type the following: unzip glfw-3.1.1.zip cd glfw-3.1.1/ mkdir curbuild && cd curbuild cmake -G "Unix Makefiles" -DBUILD_SHARED_LIBS=ON ../ make -j3 sudo make install this will place your glfw headers and .so files in appropriate folders under the /usr/local ( you don't have to manually move anything ).   Then some part of magic takes effect. It happened so, that nanosvg has some kind of unhealthy build system inside ( premake4 + pre-made makefiles + damaged ( ??? ) Makefile generated from premake4 ). To build example do the following.   Download nanosvg as .zip from the official github page. In your console:   unzip nanosvg-master.zip cd nanosvg-master/example cp ../src/nanosvg* . gcc -O2 example1.c -L/usr/local/lib -lGL -lglfw -lm -Wl,-rpath=/usr/local/lib -o example1 gcc -O2 example2.c -L/usr/local/lib -lGL -lglfw -lm -Wl,-rpath=/usr/local/lib -o example2 After performing these actions I was able to launch both examples. Good luck to you, and if you need any further explanations ( i.e. makefiles, command line invocations ) feel free to ask.   P.S. I don't know if GLEW is really needed here, cause I have one installed in /usr/local, but it seems that GLFW and nanosvg have no dependencies on GLEW, and I was able to compile, link and run without linking against libGLEW.so.   btw, my current system is Linux Mint 17. Linux host 3.13.0-24-generic #47-Ubuntu SMP Fri May 2 23:30:00 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux gcc (Ubuntu 4.8.2-19ubuntu1) 4.8.2 I have Debian 8 x64 at home, if you need, I can test this there too.  
  3. syskrank

    SDL2 vector graphics image loader

    I'm trying to build examples and getting the same errors. I'll report my progress as I'll solve something.
  4. syskrank

    SDL2 vector graphics image loader

    Hi there. This topic contains a good bit of information about your question. In shorts: you must obtain some kind of parser/rasterizer library ( such as nanosvg ), integrate it into your project, then use it to load & rasterize SVG image & then pass the results as a pixel data to your SDL_Surface. Then you are free to go with the creation of SDL_Texture or whatever. Neither SDL1.2 nor SDL2 have direct support for SVG.   P.S. SVG format is a way far from being dead.
  5. syskrank

    LibGDX Box2D libraries

    Wow, didn't know that, thanks.
  6. That's called a 'scientific mindset", I suppose. The natural curiosity is the greatest thing ever. But you *really* need the way to control it, because, yup, you'll end up with a lot of knowledge but without any real significant results, just ready for the next "let-me-know-that-and-that-too" dive.
  7. syskrank

    LibGDX Box2D libraries

    As far as I can remember gdx-setup adds armeabi .so for getting ARM support ( mobile devices ), and x86 for PC support. And the .jar files you've mentioned are just java/jni wrappers on the top of the cross-compiled ( in case of ARM ) libraries. So you need to add .so (dll) file for x86 to support PC. By the way, why not use gdx-setup? P.S. You may consider using gradle for managing dependencies for you. See this libgdx wiki page for details.
  8. syskrank

    OpenGL Shadow Mapping in Opengl

    Hi there. Try to use ortho camera for dir light, maybe? Your depth  shader is a bit overdo, I guess. To write the depth it is sufficient to have something like that in your vertex shader: #version 330 core layout ( location = 0 ) in vec3 vertexPos; uniform mat4 depthMVP; void main() { gl_Position = depthMVP * vec4( vertexPos, 1.0 ); } Where depthMVP is : camera projection matrix * camera view matrix * camera model matrix And then you'll have to put an empty fragment shader to finish your depth rendering.   So basically you bind your FBO, render your objects to the depth buffer, unbind it, then bind your main FB, bind your shadowmap from prev. stage as a 2D texture and sample distance from it. Correct me, if I'm wrong.   Also, is your u_lightPosition uniform in camera frag shader is in the same space as your vertex position? (which is in fact MVP matrix multiplied by vec4( a_vertexPos, 1.0 ) ) ? You sending that uniform as light.combined. What matrix do you have there?   P.S. agleed is absolutely right about the 'length()' stuff. You want the coords there, to sample from the shadowmap.
  9. syskrank

    Implementing a Meta System in C++

    Hi, Artem.   Liked your lib.  I've created a sane Makefile and Code::Blocks project for it ( to build shared libs ). Because for me your premake scripts didn't work at all ( using premake from Linux Mint 17 repos ) + IMHO whole premake thing just sucks a little ( taking in account that you have not as much files in your src/ dir - why use build system generator at all ? ).   Would you be so kind to include something like that?   Anyways - great job and neat article. My fork with Makefiles and Code::Blocks project is available at bitbucket.  This should work with Linux/Windows, however, one will not be able to build test benchmark and will be forced to use premake.
  10. Allright, after some digging and experiments here the complex solution:   To avoid gaps between objects or graphics entities in a libGDX application one should:   1. ensure to use floats everywhere - even for storing target screen resolution, to avoid unwanted casts and following precision loss; OpenGL is using floats for positioning, so should you;   2. use power-of-two textures: those with side sizes aliquot to 2^x - 32x32, 16x64, 128x256 and so on; doing so will satisfy the minimization of memory usage on GPU and will help to avoid texture coordinates distortions due to float-int casts, that may or may not happen whithin the rendering process ( whatch for your shaders and datatypes );   3. use POT textures even if documentation says that you can do the opposite; POTs are great;   4. try to use NEAREST filtering for loaded textures and texture atlases; this would protect you from wrong 'pixel mix', when OpenGL will try to average your color-filled pixels with transparent ones; however, for me that showed no significant results;   5. hit your artist ensure that all of your full-frame graphics elements have no transparent or half-transparent pixels at the edges - sith happens, you now   6.  use tight alignment and/or scale your objects just a little bit, so that they will overlay each other.   _____ Hope that would help someone. Cheers.
  11. Hey, everyone. I've got a problem with using libgdx. I've packed all my images into POT atlas texture with 1024x1024 dimensions and loading it with the NEAREST filtering for mag and min.   From there I'm creating TextureRegions with NPOT-sizes ( which is OK, according to official libgdx wiki and OpenGL logics ) with sizes like 17x5, 69x69 and so on.   The actual problem is that when I move some graphical objects ( or tiles, if you will ), sometimes I see gaps between them, where no gaps should appear at all. Furthermore, the size of the gap differs through the time - it's seems to be frame-dependent or something.   I'm using standart libgdx' Screen class render( float delta ) method to organize my main cycle which is giving me 60FPS everytime. VirtualVM profiler says I'm doing pretty good with CPU and RAM - 10-20% on one core and 25Mb of RAM is used. So there's no possible lag, I suppose.   I really need help, because this thing is driving me crazy
  12. syskrank

    OpenGL uniforms optimized-out

    Hi, Stainless. What do you mean by sanity check? I've tried playing with shader 'version' string with no luck.   Edit: I mentioned that my Java Shader object detects only the first element of the uniform array:  'useBoneWeight[0]' and 'boneTransform[0]' are located; So, theoretically, I can use OpenGL's glUniform*() capabilities to send a whole array of data to the shader. I will try that somehow.       I'm developing on two machines with Linux Mint 16 and Linux Debian 7 resp. First system has Intel HD4000 and NV GF740M cards ( tried both ) and the last one has NV GT630. I'm using libgdx 1.2.0. Android emulator produces same results.
  13. syskrank

    OpenGL uniforms optimized-out

    Ok, here it is. I'm building on top of libgdx' ShaderProgram : import com.badlogic.gdx.Gdx; import com.badlogic.gdx.graphics.glutils.ShaderProgram; import com.badlogic.gdx.math.Matrix4; import com.badlogic.gdx.math.Vector2; import com.badlogic.gdx.math.Vector3; import com.badlogic.gdx.utils.Disposable; import java.util.Map; import java.util.HashMap; public class Shader implements Disposable {     public ShaderProgram program;     public Map<String, Integer> uniforms;     public final static String SHADER_TAG = Shader.class.getSimpleName();     public static final int SHADER_OK = 0;     public static final int SHADER_ERROR = 1;     public Shader( String vertexShader, String fragmentShader ) {         ShaderProgram.pedantic = false;         program = new ShaderProgram( Gdx.files.internal( vertexShader ), Gdx.files.internal( fragmentShader ) );         if ( program.isCompiled() ) {             Gdx.app.log( SHADER_TAG, "Shader compiled." );         } else {             Gdx.app.log( SHADER_TAG, "Shader compilation failed: " + program.getLog() );         }         uniforms = new HashMap<String, Integer>();     }     public void bind() {         program.begin();     }     public void unbind() {         program.end();     }     public int addUniform( String name ) {         int location = program.getUniformLocation( name );         if ( -1 == location ) {             Gdx.app.log( SHADER_TAG, "Failed to get uniform's '" + name + "' location." );             return SHADER_ERROR;         } else {             uniforms.put( name, location );         }         return SHADER_OK;     }     public int setUniformInt( String name, int value ) {         Integer location = uniforms.get( name );         if ( null == location ) {             Gdx.app.log( SHADER_TAG, "Integer uniform '" + name + "' doesn't exists." );             return SHADER_ERROR;         } else {             program.setUniformi( location.intValue(), value );         }         return SHADER_OK;     }     public int setUniformFloat( String name, float value ) {         Integer location = uniforms.get( name );         if ( null == location ) {             Gdx.app.log( SHADER_TAG, "Float uniform '" + name + "' doesn't exists." );             return SHADER_ERROR;         } else {             program.setUniformf( location.intValue(), value );         }         return SHADER_OK;     }     public int setUniformVec2( String name, Vector2 value ) {         Integer location = uniforms.get( name );         if ( null == location ) {             Gdx.app.log( SHADER_TAG, "Vector2 uniform '" + name + "' doesn't exists." );             return SHADER_ERROR;         } else {             program.setUniformf( location.intValue(), value );         }         return SHADER_OK;     }     public int setUniformVec3( String name, Vector3 value ) {         Integer location = uniforms.get( name );         if ( null == location ) {             Gdx.app.log( SHADER_TAG, "Vector3 uniform '" + name + "' doesn't exists." );             return SHADER_ERROR;         } else {             program.setUniformf( location.intValue(), value );         }         return SHADER_OK;     }     public int setUniformMat4( String name, Matrix4 value ) {         Integer location = uniforms.get( name );         if ( null == location ) {             Gdx.app.log( SHADER_TAG, "Matrix4 uniform '" + name + "' doesn't exists." );             return SHADER_ERROR;         } else {             program.setUniformMatrix( location.intValue(), value );         }         return SHADER_OK;     }     @Override     public void dispose() {         program.dispose();     } } ShaderProgram, in it's turn, has the following code inside:     private void fetchUniforms () {         params.clear();         Gdx.gl20.glGetProgramiv(program, GL20.GL_ACTIVE_UNIFORMS, params);         int numUniforms = params.get(0);         uniformNames = new String[numUniforms];         for (int i = 0; i < numUniforms; i++) {             params.clear();             params.put(0, 1);             type.clear();             String name = Gdx.gl20.glGetActiveUniform(program, i, params, type);             int location = Gdx.gl20.glGetUniformLocation(program, name);             uniforms.put(name, location);             uniformTypes.put(name, type.get(0));             uniformSizes.put(name, params.get(0));             uniformNames[i] = name;         }     } So, yeah, basically, I'm fetching uniforms not directly from shader, but from libgdx' object, which kind of sucks.
  14. Hi. I'm facing the problem that GLSL optimizer eliminates my uniforms, that are actually used. Here's my vertex shader: #version 120 #ifdef GL_ES precision mediump float #endif attribute vec3 a_position; attribute vec3 a_normal; attribute vec2 a_texCoord0; attribute vec2 a_boneWeight0; attribute vec2 a_boneWeight1; attribute vec2 a_boneWeight2; attribute vec2 a_boneWeight3; attribute vec2 a_boneWeight4; attribute vec2 a_boneWeight5; attribute vec2 a_boneWeight6; attribute vec2 a_boneWeight7; // uniforms uniform mat4 MVP; uniform mat4 shadowMVP; uniform int useBoneWeight[8]; // use numbered bone or not uniform mat4 boneTransform[8]; uniform int useSkinning;   //// outputs #ifdef GL_ES     varying medium vec3 normal;     varying medium vec3 worldPos;     varying medium vec2 textureCoord;     varying medium vec4 shadowCoord; #else     varying vec3 normal;     varying vec3 worldPos;     varying vec2 textureCoord;     varying vec4 shadowCoord; #endif void main() {     shadowCoord = shadowMVP * vec4( a_position, 1.0f );     textureCoord = a_texCoord0;     mat4 skinning = mat4( 0.0 );     if ( 1 == useSkinning )  {         skinning += ( ( a_boneWeight0.y ) * boneTransform[ int( a_boneWeight0.x ) ] * useBoneWeight[ 0 ] );         skinning += ( ( a_boneWeight1.y ) * boneTransform[ int( a_boneWeight1.x ) ] * useBoneWeight[ 1 ] );         skinning += ( ( a_boneWeight2.y ) * boneTransform[ int( a_boneWeight2.x ) ] * useBoneWeight[ 2 ] );         skinning += ( a_boneWeight3.y ) * boneTransform[ int( a_boneWeight3.x ) ] * useBoneWeight[ 3 ];         skinning += ( a_boneWeight4.y ) * boneTransform[ int( a_boneWeight4.x ) ] * useBoneWeight[ 4 ];         skinning += ( a_boneWeight5.y ) * boneTransform[ int( a_boneWeight5.x ) ] * useBoneWeight[ 5 ];         skinning += ( a_boneWeight6.y ) * boneTransform[ int( a_boneWeight6.x ) ] * useBoneWeight[ 6 ];         skinning += ( a_boneWeight7.y ) * boneTransform[ int( a_boneWeight7.x ) ] * useBoneWeight[ 7 ];         gl_Position = MVP * skinning * vec4( a_position, 1.0f );         normal = ( MVP * skinning * vec4( a_normal, 0.0f ) ).xyz;         worldPos = ( MVP * skinning * vec4( a_position, 1.0f ) ).xyz;     } else {         gl_Position = MVP * vec4( a_position, 1.0f );         normal = ( MVP * vec4( a_normal, 0.0f ) ).xyz;         worldPos = ( MVP * vec4( a_position, 1.0f ) ).xyz;     } } Uniforms 'useBoneWeights' and 'boneTransform' are erased during optimization. I've tried to get their location with glGetUniformLocation() querying them by array name and array indexed elements. All other parts of the shader are working fine.   I'm using Java and libgdx1.2.0 ( thus - opengl es 2.0 ) and my semi-custom shader system ( incapsulated libgdx' Shader class to give it more 'native' C/C++ interface ).
  15. So, I've managed to find a solution to this wrong FBX model orientation problem. It's completely a hack, but there's no better solution since fbx-conv, or Blender exported have bugs inside their code. The solution is: create own Transform class, incorporate it inside GameEntity class and every time you update graphics component's transform, set it's orientation with constant delta offset rotation around X axis by -90 degrees. Will see in future how this affects skeletons and animations but it SHOULD be Ok.
  • 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!