Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 19 Aug 2012
Offline Last Active May 21 2013 03:10 PM

Topics I've Started

glAlphaFunc in gl20 ? or How do I enable alpha in gl20 ?

04 November 2012 - 03:23 PM

Hey guys.

I'm currently coding a little game with the libGdx library and I wanted to have a slight fade in/fade out effect if the screen changes (e.g. from MainMenu into the game).
After some time, I've got the idea, that I draw a black filled rectangle over the whole screen with an increasing alpha value. At the point where the alpha value is 0.0f (so, the whole screen is black) I change the screen to my game, where at this point my alpha value is getting bigger (so it will be transparent more and more).

So I implemented something like this:

// init
Gdx.gl.glEnable( GL10.GL_ALPHA_TEST );
// [...]
// render
Gdx.gl10.glAlphaFunc( GL10.GL_GREATER, 0 );
// render my quad

While having my project setting up with LwjglApplicationConfig.useGL20 = false; it will work very well.
But enabling gl20, it won't start, saying that there is a problem with GL10.GL_ALPHA_TEST
So I searched if gl20 have something like that... but now it's 30 minutes later and I don't have any solution.

Could you help?
What I have to enable in gl20 ( and setting up) to use alpha like in gl10 ?


Problem with width and height of quads

06 September 2012 - 10:56 AM

Hello dudes,

I've got a little problem, but maybe I am only too silly to solve it. unsure.pngbiggrin.png

I've got a window (1280x720) and a perspective from 0.01f till 1000.0f.
So, when I will render a normal quad with the width and height of the whole screen, I don't know where the vertices of the quad must be.
I try with (-1/-1), (-1/1), (1/-1), (1/1) and for each z-Axis coordinate 1 (I'm rendering with trianglestrips!), but then it is way too big! dry.png

So my question is, how I could know the true coordinates of each vertex for rendering a quad which is as big as the screen? wacko.png
Are there any mathematical tricks or something like that? mellow.png

Problems with Vertex-/Pixelshader in DirectX 9 & C++

05 September 2012 - 01:31 PM

Hello dudes.
This is my forst post in this forum, so be patient with me, if it's the wrong section for this. Posted Image

First I must say, that I allready wrote applications and small games in Java and OpenGL and since ~4 months I learn C++ and DirectX9.
Due to the fact, that I wanted to make something different (the last I did, was a small 3D Environment in C++ & OpenGL, but I didn't finished it).
This gave me the idea of making a little 2D Environment with lighting (shadows) and so on.
Also I wanted and fortunately want to learn HLSL. Posted Image
After some time of "googleing" I found this topic here in this forum and there I read a little tutorial about simple shaders in DirectX 9 from "Two Kings".
I managed it to "learn" something about the code and the HLSL, but unfortunately my code doesn't work properly. Posted Image
I make a MessageBox if CreateVertexShader() failed, it doesn't appear.
I make a MessageBox if CreatePixelShader() failed, it appear! And my programm is terminated. Posted Image

So I need your help, because I didn't find much about DirectX 9 Shader on the internet. Posted Image


You can look up my code at github.
If you want me to insert the relevant code here, I will do so. Posted Image

edited my problem description