Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 28 Oct 2011
Offline Last Active Oct 06 2015 02:23 AM

Topics I've Started

Rendering blurred progress lines

23 December 2014 - 01:12 AM

Hello, guys.

How would you approach the rendering of the lines such as those ones: http://thumb1.shutterstock.com/display_pic_with_logo/1543523/164410208/stock-vector-collection-of-modern-glowing-preloaders-and-progress-loading-bars-164410208.jpg I can hardly imagine that people would do that with small triangles with blur effect.

Can't understand camera behavior

13 July 2013 - 01:17 PM


I'm quite new person in OpenGL graphics. Recently I started to learn OpenGL ES 2.0 technology to be able to make some games on my Android devices. I have a few questions to clear some things up for me.


1. Where can I find comprehensive OpenGL ES 2.0 tutorials, or book for making games on Android by means of Java/Android SDK, not C++/NDK? A lot of resources are dedicated to OpenGL ES 1.0 technology, not 2.0 one. In fact it's very hard to find complete tutorials for 2.0 with good non-contradictory code base.


2. Why there are almost no 2.0 tutorials? Is it any popular? Google says that devices starting from Android 2.2 can use this new version, so if no one uses it, why? At the first glance it gives more flexible way of doing things.


3. I'm a bit confused with the way matrix multiplication system works.


Do I have to use:


Matrix.setIdentityM( mModelMatrix, 0 );
Matrix.multiplyMM( mMVPMatrix, 0, mViewMatrix, 0, mModelMatrix, 0 );
Matrix.multiplyMM( mMVPMatrix, 0, mProjectionMatrix, 0, mMVPMatrix, 0 );

To get simple mMVPMatrix = mModelMatrix * mMviewMatrix * mProjectionMatrix equation done? Can I use this result matrix as uniform variable in shader?

4. Is this the right code to rotate my object around Y axis by some angle 'mAngle':
Matrix.setRotateM( mRotationMatrix, 0, mAngle, 0.0f, -1.0f, 0.0f );
Matrix.setIdentityM( mModelMatrix, 0 );
Matrix.multiplyMM( mModelmatrix, 0, mRotationMatrix, 0, mModelMatrix, 0 );
Matrix.multiplyMM( mMVPMatrix, 0, mViewMatrix, 0, mModelMatrix, 0 );
Matrix.multiplyMM( mMVPMatrix, 0, mProjectionMatrix, 0, mMVPMatrix, 0 );

To me it seems legit, but I get really weird results on my phone when I try to render simple textured box. Top, bottom sides of the box rotate around camera, not the opposite way.


This is my renderer and simple textured cube classes:

http://pastebin.com/Phd2ym3Z - renderer

http://pastebin.com/i9rb3r6v - textured cube


Thanks for your time!

Binding shader resources

12 April 2013 - 10:01 AM

Hello everyone.


Recently I have been lurking in DirectX 11 documentation and found interesting thing: PSSetShaderResources function keeps textures bound to graphics pipeline. So I have made up a common header for every shader program which looks like this:


// Defines:
// Object color type
#define USE_NORMAL_MAP 1
#define USE_SHADOW_MAP 1
#define USE_LIGHT_MAP 1
// Textures:
Texture2D NormalMap : register(t0);
Texture2D ShadowMap : register(t1);
Texture2D DiffuseMap : register(t2);
Texture2D AmbientMap : register(t3);
Texture2D LightMap : register(t4);
// Sampler states:
SamplerState LinearSampler : register(s0);


Now, I'm trying to update textures per primitive draw call. In example, if the object uses different from previous drawn primitive diffuse color map, I call PSSetShaderResources(2, 1 , resources). Where `resources` is an array, containing single element - shader resource view for new diffuse map texture. But when I have implemented this in my engine, it doesn't render texture maps anymore. All of my shader programs are including this common file.
So I'm curious, does DX11 really keep those textures bound to pipeline until I free them? Or do their shader representations actually become undefined if I call PSSetShader() or change render target?

3D models animation

22 March 2013 - 11:31 AM

Hello guys.


It is strange, but I can not find any good tutorials about 3D model animation implementation in DirectX 10-11 and C++. I wonder how does animation data usually being stored in files, should I use dynamic vertex buffers or there are other widely used techinques out there? Could someone provide some indepth information on this subject?

Bitmap font engine problem

20 February 2013 - 09:34 AM



I'm trying to create my own text-rendering engine based on Rastertek's tutorial. The steps I did to make it work:


1. Created my own .png file, containing common ASCII symbols divided by spaces. PNG file had not been compressed.

2. Successfully parsed PNG file so that each symbol has it's own texture coordinates and width/height in pixels. The height is the same for each letter and equals to texture height.

3. Created DDS file from PNG font file.

4. Loaded texture from DDS file.

5. Created squares for each letter according to their width/height in pixels and texture coordinates.

6. Created orthogonal projection matrix to project them on the screen within pixel shader without any changes.


Everything seems well, but the result looks bad:

Attached File  game.png   415.57KB   88 downloads


As you can see, the letters look dirty and unprecise. Thats how DDS file looks in DX texture tool for comparison:

Attached File  font_dds.png   34.61KB   82 downloads