Jump to content

  • Log In with Google      Sign In   
  • Create Account

invutil

Member Since 20 Mar 2003
Offline Last Active Today, 12:02 PM

Topics I've Started

Getting alpha value off the framebuffer

Yesterday, 04:10 PM

Do I need to create an extra attachment to get alpha values?

   //OpenGL 1.4 way

        glGenTextures(1, &g_rendertex[sample]);
        glBindTexture(GL_TEXTURE_2D, g_rendertex[sample]);
        glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, g_deswidth, g_desheight, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);

        //g_applog<<"gge1 "<<glGetError()<<std::endl;

        glGenTextures(1, &g_renderdepthtex[sample]);
        glBindTexture(GL_TEXTURE_2D, g_renderdepthtex[sample]);
        glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT24, g_deswidth, g_desheight, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_BYTE, 0);
        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);

        //g_applog<<"gge2 "<<glGetError()<<std::endl;
        //glDrawBuffer(GL_NONE); // No color buffer is drawn
        //glReadBuffer(GL_NONE);

        glGenFramebuffers(1, &g_renderfb[sample]);
        glBindFramebuffer(GL_FRAMEBUFFER, g_renderfb[sample]);

        glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, g_rendertex[sample], 0);
        glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, g_renderdepthtex[sample], 0);

        //g_applog<<"gge3 "<<glGetError()<<std::endl;

        GLenum DrawBuffers[2] = {GL_COLOR_ATTACHMENT0, GL_DEPTH_ATTACHMENT_EXT};
        glDrawBuffers(1, DrawBuffers);

        //g_applog<<"gge4 "<<glGetError()<<std::endl;

        if(glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE)
        {
            ErrorMessage("Error", "Couldn't create framebuffer for render.");
            return;
        }
        glBindFramebuffer(GL_FRAMEBUFFER, 0);

I clear the framebuffer with glClear with alpha set to 0.0 and render something on top, but the rendered parts always end up having alpha with exactly 1.0.


	glClearColor(g_transpkey[0],g_transpkey[1],g_transpkey[2],1);
	glClearColor(g_transpkey[0],g_transpkey[1],g_transpkey[2],0);
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
	glEnable(GL_BLEND);

	glReadPixels(0, 0, g_width, g_height, GL_RGBA, GL_UNSIGNED_BYTE, screen.data);

Chess moves

19 December 2014 - 06:05 PM

Could you fit all possible chess moves on a 5TB external hard drive, excluding repeating states and stalemates? And then use that as a lookup table for an unbeatable AI?

RTS pathfinding gridlock, world coordinates vs. path node coordinates

28 November 2014 - 06:14 PM

What happens when you use a finer-grained coordinate system for unit movement and collision detection than what you use for pathing? How do you solve when two units occupy shared nodes but there's a way out for a certain unit? 

 

gridlock.png

 

Do you use the path nodes for collision as well, resulting in a lot less places the unit can be at, or do you shift the path grid to the unit's world position?


Customizing title bar colors Android 3.2+

28 November 2014 - 03:15 PM

I'm customizing the holo theme for my android 4.2.1 phone.
 
I put this image in /res/drawable/
 
 
And in /res/values-v11/styles.xml I put
 
<resources>
    
    <!--
        Base application theme for API 11+. This theme completely replaces
        AppBaseTheme from res/values/styles.xml on API 11+ devices.
    -->
    <style name="AppBaseTheme" parent="android:Theme.Holo.Light">
        <!-- API 11 theme customizations can go here. -->
        
        <item name="android:actionBarStyle">@style/MyActionBar</item>
        
        <item name="android:windowActionBar">false</item>
   <item name="android:windowTitleSize">30dip</item>
   <item name="android:windowTitleBackgroundStyle">@style/AppTheme</item>
    </style>
    
    <!-- ActionBar styles -->
    <style name="MyActionBar"
           parent="@android:style/Widget.Holo.Light.ActionBar">
        <item name="android:background">@drawable/titlebarbg</item>
    </style>
    
</resources>
 
Is this correct? I don't see the title bar color changed to blue. 

Vancouver meetup

01 November 2014 - 05:07 PM

Hey I'm starting a meetup for gamedevs. Burnaby Maddison shopping center off lougheed highway on the second floor across from Winners coffee shop. 604 339 3875 if you need help. Come at 12 this Sunday. Intersection is Buchanan street.

PARTNERS