Archived

This topic is now archived and is closed to further replies.

VanKurt

CG in 2D ??

Recommended Posts

Hi there! After having used CG some ages ago I forgot almost everything about it :-( What I want to do is the simplest thing possible: NOTHING! ;-) What I mean is that I need a vertex-shader-program that just passes the data through. But the difficult part is that I only know how to do that in 3D: // Convert vertex position to float4 float4 v = float4( IN.position.x, IN.position.y, IN.position.z, 1.0f ); // Multiply position with modelview matrix OUT.position = mul( modelViewProj, v ); But this time I''m working on a little 2D game where I want to use CG for some cool effects. So I''m drawing everything as quads with orthographic projection (OpenGL). Like this: glTranslatef( ObjectPosX, ObjectPosY, 0 ); glRotatef( ObjectAngle, 0,0,1 ); DrawQuad(-200,200,-200,200); glRotatef( ObjectAngle, 0,0,1 ); glTranslatef( -ObjectPosX, -ObjectPosY, 0 ); So how do the fragment and vertex structures look like? And how is the position-data translated in the vertex shader? Thanks for you help!!!!!!!!!!!!!!!!!!!!!!! :-D

Share this post


Link to post
Share on other sites
Should be exactly the same in terms of transformations. Remember both a perspective and orthographic projection just alter the projection matrix to perform the projection you want.

Share this post


Link to post
Share on other sites