• Content count

  • Joined

  • Last visited

Community Reputation

126 Neutral

About progman_rus

  • Rank
  1. We found a translater from English to Spanish. But I am not sure about his qualification. He made a small test case for me. Could you check a quality of the translation ?      
  2. I have the vertex structure [CODE]struct Vertex { GLfloat x, y; GLfloat r, g, b, a; GLfloat tu, tv; }; #define VERTEX_ARRAY 0 #define VERTEXCOLOR_ARRAY 1 #define TEXCOORD_ARRAY 2 [/CODE] I use it for draw 2D primitives. test platform - Samsung Galaxy Tab today I lunch app on the Sumsung Galaxy S II I am in shock - there x/y is texture coord and tu/tv is world coordinats. They are reversed!!! this is my shader [CODE] attribute vec4 vPosition; attribute mediump vec4 vColor; attribute mediump vec2 uv; varying mediump vec4 vVertexColor; varying mediump vec2 myTexCoord; void main() { gl_Position = vPosition; vVertexColor = vColor; myTexCoord = uv; } [/CODE] [CODE] precision mediump float; uniform sampler2D sampler2d; varying mediump vec4 vVertexColor; varying mediump vec2 myTexCoord; void main() { gl_FragColor = texture2D( sampler2d, myTexCoord) * vVertexColor ; } [/CODE] this is render function for draw all primitives [CODE] glBindBuffer( GL_ARRAY_BUFFER, vertexBuffer );// Bind the VBO. glBufferSubData( GL_ARRAY_BUFFER, 0, m_CurrentVertexIndex * g_ui32VertexStride, vertices ); glEnableVertexAttribArray( VERTEX_ARRAY ); glVertexAttribPointer( VERTEX_ARRAY, 2, GL_FLOAT, GL_FALSE, g_ui32VertexStride, 0 ); glEnableVertexAttribArray( VERTEXCOLOR_ARRAY ); glVertexAttribPointer( VERTEXCOLOR_ARRAY, 4, GL_FLOAT, GL_FALSE, g_ui32VertexStride, (void*) (2 * sizeof(GLfloat) ) ); glEnableVertexAttribArray( TEXCOORD_ARRAY ); glVertexAttribPointer( TEXCOORD_ARRAY, 2, GL_FLOAT, GL_FALSE, g_ui32VertexStride, (void*) (6 * sizeof(GLfloat) ) ); glBindBuffer( GL_ELEMENT_ARRAY_BUFFER, indexBuffer ); glDrawElements( GL_TRIANGLES, 3 * m_RenderTriangleCount, GL_UNSIGNED_SHORT, (void*)0); [/CODE] How to fix it? How to setup for GL that first is world coord, next is color and next is texture coord?
  3. I decide to check my application for error and memory leaks. I use DevPartner BoundsChecker. But if I am starting my app with error detector then IDirect3DDevice8::CreateDevice failed with D3DERR_NOTAVAILABLE error maybe somebody worked with BoundsChecker and resolved this trouble. Support of BoundsChecker does not answer ( PS MSVC 2005, DX8,
  4. GraphEdit show 80004500 error too but all videoplayers ( MPC, KMPlayer, Windows Media Center ) play mp4 files ok
  5. [quote name='frob' timestamp='1316450922' post='4863406'] In your code snippit you only test against S_OK. There are [url=""]many possible error results, E_FAIL is not listed among them.[/url] Which one is your real error code? [/quote] I have [b]0x80004005 [/b]it is [b]E_FAIL[/b] name from erors table: [quote] S_OK Success. VFW_S_AUDIO_NOT_RENDERED Partial success; the audio was not rendered. VFW_S_DUPLICATE_NAME Success; the Filter Graph Manager modified the filter name to avoid duplication. VFW_S_PARTIAL_RENDER Some of the streams in this movie are in an unsupported format. VFW_S_VIDEO_NOT_RENDERED Partial success; some of the streams in this movie are in an unsupported format. E_ABORT Operation aborted. E_FAIL Failure. E_INVALIDARG Argument is invalid. E_OUTOFMEMORY Insufficient memory. E_POINTER NULL pointer argument. VFW_E_CANNOT_CONNECT No combination of intermediate filters could be found to make the connection. VFW_E_CANNOT_LOAD_SOURCE_FILTER The source filter for this file could not be loaded. VFW_E_CANNOT_RENDER No combination of filters could be found to render the stream. VFW_E_INVALID_FILE_FORMAT The file format is invalid. VFW_E_NOT_FOUND An object or name was not found. VFW_E_UNKNOWN_FILE_TYPE The media type of this file is not recognized. VFW_E_UNSUPPORTED_STREAM Cannot play back the file: the format is not supported. [/quote]
  6. basic code from this [url=""]http://www.gamedev.n...irectshow-r1345[/url] I try to play MP4 movie and failed but AVI and FLV is OK I catch [b]E_FAIL[/b] this code: [b]hr = m_pGraph->RenderFile( fileneme, NULL );[/b] I have all codect and splitter in my system and play this file with Windows Media Player OK [code] bool Client::createAviInterface( HWND hWnd, const wchar_t* fileneme ) { RECT rc; CoInitialize(NULL); HRESULT hr = CoCreateInstance( CLSID_FilterGraph, NULL, CLSCTX_INPROC, IID_IGraphBuilder, (void **)&m_pGraph ); // Create the filter graph manager. if( S_OK != hr || !m_pGraph ) { mGameModule->LogError( "CoCreateInstance CLSID_FilterGraph FAILED" ); return false; } hr = m_pGraph->QueryInterface( IID_IMediaControl, ( void** )&m_pMediaControl ); if( S_OK != hr || !m_pMediaControl ) { mGameModule->LogError( "CoCreateInstance IID_IMediaControl FAILED" ); return false; } hr = m_pGraph->QueryInterface( IID_IVideoWindow, ( void** )&m_pVidWin ); if( S_OK != hr || !m_pVidWin ) { mGameModule->LogError( "CoCreateInstance IID_IVideoWindow FAILED" ); return false; } // Build the graph. hr = m_pGraph->RenderFile( fileneme, NULL ); if( S_OK != hr ) { mGameModule->LogError( "Build the graph %S FAILED", fileneme ); return false; } mGameModule->LogInfo( "Build the graph OK."); hr = m_pGraph->QueryInterface( IID_IMediaSeeking, (void**)&m_pMediaSeeking ); if( S_OK != hr || !m_pMediaSeeking) { mGameModule->LogError( "QueryInterface IID_IMediaSeeking FAILED" ); return false; } hr = m_pGraph->QueryInterface( IID_IMediaEventEx, (void**)&m_pMediaEvents ); if( S_OK != hr || !m_pMediaEvents) { mGameModule->LogError( "QueryInterface IID_IMediaEventEx FAILED" ); return false; } // Have the graph signal event via window callbacks for performance m_pMediaEvents->SetNotifyWindow((OAHWND)hWnd, WM_GRAPHNOTIFY, 0); LONGLONG lDuration = NULL; m_pMediaSeeking->GetDuration( &lDuration ); hr = m_pGraph->QueryInterface( IID_IMediaPosition, ( void** )&m_pMediaPosition ); if( S_OK != hr || !m_pMediaPosition ) { mGameModule->LogError( "QueryInterface IID_IMediaPosition FAILED" ); return false; } //Set the video window. m_pVidWin->put_Owner( ( OAHWND )hWnd ); m_pVidWin->put_WindowStyle( WS_CHILD /*| WS_CLIPSIBLINGS*/ ); m_pVidWin->put_MessageDrain((OAHWND)hWnd); ::GetClientRect( hWnd, &rc ); m_pVidWin->SetWindowPosition( 0, 0, rc.right, rc.bottom ); // Run the graph. m_pMediaControl->Run(); mGameModule->LogInfo( "OK" ); IPin *pPin = NULL; IBasicAudio *audio = NULL; hr = m_pGraph->QueryInterface(IID_IBasicAudio, reinterpret_cast<void **>(&audio)); if (!hr && audio) { float soundVolume = 1.0f; soundVolume = 20 * log10( soundVolume ); hr = audio->put_Volume( static_cast<long>( 100 * soundVolume ) ); mGameModule->LogInfo("Set Volume: "); } else { mGameModule->LogError("QueryInterface IBasicAudio: "); } return true; } [/code]
  7. I would like to do a game that looks like Alien Shooter. It is sprite 2D game - i saw all resources on the disk and videomemory. But it looks perfect. I want same same render engine for me. Now i use isometrics map and render all sprites from cells - this is good but time of the time fps is too small Becose i have a lot of DIP. The reason is - always change texture for render next cell objects. ( i have 8 textures 1024x1024 total and may be more ) for example so: now i want to group some sprites to big object - for example log wall or fence and render this object for one calls ( now it may be 5-25 call for render all wall becouse cells ) if i will render tiles as object i must to do z-sorting for render alpha textures see pic needs correctly sort a fence and two phone box and Red Plane with window ( this is very easy case )
  8. Hi guys. I doing a small RPG game for fun. I did not decided what is the best way for me: use ortho proection and sprites engine or use 3D but setup static camera position and perspective proection for looks like isometric world. and use sprites only too. I have good engile for 2D and I to be able change it for 3D use. If i will use 3D - all objects will as sprites as billborads i think, becouse full 3D modelling is too hard and expensive for me. What do you think what is the best for me 2D or 3D looks like 2D ??
  9. [img][/img][img][/img][img][/img] this three tree from my HDD ( i have about 40 sprites with shadow ) but small size only I do not remember where i got it. second sprite i found with google. I think that first was got from tree pack. I want to find it
  10. In far far 1999 I used this tree in my 2D game. [img][/img][img][/img][img][/img] I forgot how and where i got this sprites. I need this tree again but best resolution. I try to found something looks like this at the internat but failed. I found only this: [img][/img] maybe You know where I can to get or buy tree sprites pack for my game. For 1024x768 game resolution or HD quality
  11. [quote name='Magmatwister' timestamp='1309647905' post='4830480'] Ah, ok, If you don't want anything fancy then I suggest taking a page from a guy that I will link below. If you want to keep it simple then this is probably the way to go, If you have any questions regarding his approach I'm sure he won't mind you asking him. I provided you with two links, depending on the complexity you want. If you want anything more realistic/appealling than that (taking into account that your atmosphere will most likely be very thin compared to his), then you will have to implement considerably harder code, with the added computation cost that comes with that. Hope that helped. [url=""][/url] [url=""]http://petrocket.blo...-treegrass.html[/url] [/quote] looks great I was unable to translate that shader from HLSL to GLSL this is my vertex shader [code]attribute vec4 vPosition; attribute vec4 vColor; attribute vec2 uv; uniform vec3 lightVector;//already normalize uniform vec3 camPos; uniform vec3 lightPos; uniform float SurfaceRadius; uniform float AtmosphereRadius; uniform float StretchAmt; varying vec4 vVertexColor; varying vec2 myTexCoord; varying vec3 oLightDir; varying vec3 oCamToPos; varying vec2 oUV; varying float oAlpha; void main( void ) { gl_Position = gl_ModelViewProjectionMatrix * vPosition; vec3 position =; float radius = length(position); float radius2 = radius * radius; float camHeight = length(; vec3 camToPos = position -; float farDist = length(camToPos); vec3 lightDir = normalize( ); vec3 normal = normalize( position ); vec3 rayDir = camToPos / farDist; float camHeight2 = camHeight * camHeight; float B = 2.0 * dot(, rayDir); float C = camHeight2 - radius2; float det = max(0.0, B*B - 4.0 * C); float nearDist = 0.5 * (-B - sqrt(det)); vec3 nearPos = + ( rayDir * nearDist ); vec3 nearNormal = normalize( nearPos ); // get dot products we need float lc = dot( lightDir, camPos / camHeight ); float ln = dot( lightDir, normal ); float lnn = dot( lightDir, nearNormal ); // get distance to surface horizon float altitude = camHeight - SurfaceRadius; float horizonDist = sqrt((altitude*altitude) + (2.0 * SurfaceRadius * altitude)); float maxDot = horizonDist / camHeight; // get distance to atmosphere horizon - use max(0,...) because we can go into the atmosphere altitude = max( 0.0, camHeight - AtmosphereRadius); horizonDist = sqrt((altitude*altitude) + (2.0 * AtmosphereRadius * altitude)); // without this, the shift between inside and outside atmosphere is jarring float tweakAmount = 0.1; float minDot = max(tweakAmount,horizonDist / camHeight); // scale minDot from 0 to -1 as we enter the atmosphere float minDot2 = ((camHeight - SurfaceRadius) * (1.0 / (AtmosphereRadius - SurfaceRadius))) - (1.0 - tweakAmount); minDot = min(minDot, minDot2); // get dot product of the vertex we're looking out float posDot = dot(camToPos / farDist, / camHeight) - minDot; // calculate the height from surface in range 0..1 float height = posDot * (1.0 / (maxDot - minDot)); // push the horizon back based on artistic taste ln = max( 0.0 ,ln + StretchAmt); lnn = max( 0.0 ,lnn + StretchAmt); // the front color is the sum of the near and far normals float brightness = clamp(ln + (lnn * lc), 0.0, 1.0 ); // use "saturate(lc + 1.0 + StretchAmt)" to make more of the sunset side color be used when behind the planet oUV.x = brightness * clamp(lc + 1.0 + StretchAmt, 0.0, 1.0 ); oUV.y = height; height -= min( 0.0, minDot2 + (ln * minDot2) ); oAlpha = height * brightness; // normalised camera to position ray oCamToPos = -rayDir; oLightDir = normalize( - ); }[/code] and this is pixel [code] uniform sampler2D gTexSampler; varying vec2 oUV; varying float oAlpha; varying vec3 oCamToPos; varying vec3 oLightDir; void main( void ) { const float fExposure = 1.5; float Atmosphere_G = -0.95; float g = Atmosphere_G; float g2 = g * g; // atmosphere color vec4 diffuse = texture2D( gTexSampler, oUV ); vec4 diffuse2 = texture2D( gTexSampler, vec2( min( 0.5, oUV.x ), 1 ) ); float fCos = dot( normalize( ), normalize( oCamToPos ) ); float fCos2 = fCos * fCos; vec4 diffuseColor = diffuse * oAlpha; // sun glow color float fMiePhase = 1.5 * ((1.0 - g2) / (2.0 + g2)) * (1.0 + fCos2) /(1.0 + g2 - 2.0*g*fCos); vec4 mieColor = diffuse2 * fMiePhase * oAlpha; gl_FragColor = 1.0 - exp( -fExposure * ( diffuseColor * (1.0 + oUV.y) + mieColor ) ); }[/code] shader draws trash
  12. [quote name='Magmatwister' timestamp='1309620555' post='4830364'] Could you tell me what you're trying to achieve here? Do you just want Earth with some sort of atmospheric scattering? I'm working on a planet renderer and I can probably point you in the right direction based on what you want to do. [/quote] I try to do space-view to Earth for my game. I want that looks like google earth. Must be very fast and very easy - becouse will port to android and OpenGl ES now i improve as [b]ginkgo[/b] explained. will better: [img][/img] and very easy shader for terminator and shadow [code]void main( void ) { vec4 texel0, texel1, resultColor; float alpha = clamp( 8.0 * max( 0.0, dot( light_dir, normal ) ), 0.0, 1.0 ); texel0 = texture2D( sampler2d, myTexCoord ); texel1 = texture2D( nightTexture, myTexCoord ); resultColor = mix( texel0, texel1, alpha ); gl_FragColor = resultColor; }[/code] will to do glow around Earth looks like google earth.
  13. [quote name='ginkgo' timestamp='1309607157' post='4830307'] You should use lighting to calculate alpha. Just normal lambert lighting should do the trick: [code] light_dir = normalize(light_dir); normal = normalize(normal); float alpha = max(0, dot(light_dir, normal)); [/code] You will need to interpolate the normals for that. [/quote] unfortunatly i have not normal vector in my vertex structire (( i will to do it. i saw google earth - very good. it would be good for my project may be somebody to know where i can to find sources code of google earth and used shaders ?
  14. I try to render Earth view from space. this is first result: [img][/img] Looks like trash. this is nice for me [url=""]http://milchopenchev...mPics/earth.png[/url] ( very large size ) my trouble with shader. I calculated a terminator line incorrectly this is my shader for day/night [code] uniform sampler2D sampler2d;//dayTexture uniform sampler2D nightTexture; uniform float currentTime; varying vec2 myTexCoord; const float twopi = 6.283185307179586476925286766559; void main( void )\ { vec4 texel0, texel1, resultColor;\ float alpha = 4.0 * sin( ( myTexCoord.x + currentTime ) * twopi ); if( alpha >= 1.0 ) alpha = 1.0; texel0 = texture2D( sampler2d, myTexCoord ); resultColor = texel0; if( alpha >= 0.0 ) resultColor = mix( texel0, texture2D( nightTexture, myTexCoord ), alpha ) ; gl_FragColor = resultColor; } [/code] could you help me for decide this trouble and get good result ?
  15. I render sphere at ( 0, 0, -170 ) point. The radius os sphere is 70. and try to calculate screen coordinat of left spere point ( -70, 0, -170 ) with glProject glProject( -m_radius, oY, oZ, modelview, projection, viewport, windowCoordinate); and i get incorrect coordinates windowCoordinate[ 0 ] not equals screen Xpoint from screenshots. differents about 150%. ((( why?