Jump to content
  • Advertisement

adambiser

Member
  • Content Count

    6
  • Joined

  • Last visited

Community Reputation

111 Neutral

About adambiser

  • Rank
    Newbie

Personal Information

Social

  • Twitter
    fascimania
  • Github
    https://github.com/adambiser

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Hello all, I have teamed up with TheGameCreators for them to trial a Python version of AppGameKit in the form of a PYD file that makes AppGameKit commands available to Python 3.6 and greater. Currently this PYD is compiled only for use with the Windows x86 version of Python. It is a free, unlimited version of their commercial product, but it does show the AppGameKit logo for a few seconds on game startup and AppGameKit is mentioned in the window title when in windowed mode. The PYD works with PyInstaller for easy distribution. If you haven't heard of AppGameKit, I would recommend looking over their website. They also have documentation online and an active community forum. I should point out that method names have been changed to follow PEP 8 naming conventions, so they will be similar but different from the online help. I also had to make a few changes mentioned on the project's itch.io page. There is also a PYI file there that can be used with PyCharm for easier access to the same information. As mentioned, this is a trial for them, but if there's a positive response they will extend the project and include a way of compiling an executable without the intro logo and window title text as well as support other OS. Please take a look and feel free to ask me any questions about it here or on the project's community forum on itch.io. AppGameKit for Python project page at itch.io: https://fascimania.itch.io/appgamekit-for-python Original announcement url: https://www.thegamecreators.com/post/announcing-appgamekit-for-python
  2. I saw the geometry shader as something that would make a simple tile-based game very easy. Every tile on the atlas had something in it, even if just grid lines at the border.   Things I've noticed: Hard-coding the geometry shader to always choose the same tile still glitches. When I change the fragment shader to use a solid color instead of the texture, every tile will be that color and there will be no glitching. Hard-coding the fragment shader to use the same texture coordinates everywhere (using a spot that always has color), it still glitches. If I move texture coordinate calculation into the vertex shader (removing it from the geometry shader), the glitching reduces, but is still there. If I get rid of the geometry shader and instead calculate all the vertex and texture coordinates in my code and send them via buffer that to the shader (after making adjustments to handle the new data in the shader also), things work as expected. I chose to do the last one for now, but left things so that I can switch over to try out new ideas to fix the geometry shader problem as I think of them.   If I figure out the cause, I will be sure to post here.  However, I think this can probably just be chalked up as a bad video card or bad drivers and I haven't found drivers to fix it yet.  The problematic system is not one on which I play games often or use graphics-intensive software (obviously, given the age), so I don't know if this glitching occurs in other programs or not.
  3. I tried passing in integer data, but could not get that to work either because of my card/drivers or because of something I overlooked in the code.   I'm wondering if the geometry shader support in this card is just really bad.  If I glBufferData my data right after loading it and then remove the glBufferData call from my render loop, I get the glitching back even with small sizes.  But if I do a glBufferData right before glDrawArrays. the glitching stops.  I'll have to try things out without a geometry shader when I get the chance to see if that's really the issue.   It's really pointing toward a bad card / driver, but I've not noticed these issues before.
  4. My guess is a driver problem as well, but this is my first attempt at using geometry shaders and getting away from immediate mode, so I thought it could easily be something I've overlooked.   Since it was quicker to change the shader code so it only uses floats, I did that first and the flickering still persists.  I will try passing integer data only soon.   The only work around I've found is to do this: for (int y = 0; y < 14; y++) { GL11.glDrawArrays(GL11.GL_POINTS, y * TILES_WIDE, 16); } Since 16 is the width of the viewport in tiles.  (Hard coded numbers just for demonstration.)  The glitch doesn't become noticeable until I change the count from 16 to 20, which would mean 4 tiles off the right side of the viewport.   I'll have to dig around and see about finding some older drivers for this card, too.
  5. EDIT: Unless I figure something else out, I'm chalking this up to a bad card or drivers.  Using only vertex and fragment shaders works fine, but the presence of a geometry shader makes the card glitch.   Hello, I'm new to the forums and hope that I have the right place. I've searched, but didn't find a topic that seemed to be about the problem I'm having.  I'm using Java and LWJGL, which uses OpenGL, and I get a strange flickering or repositioning problem with one of the video cards on which I've tested.   My game uses the NES resolution of 256x224, and I'm using a tile atlas texture that is 256x256 pixels and contains textures that are 16x16 pixels.  I'm passing a vertex buffer containing map tile codes and their map coordinates to my shaders.  The geometry shader then emits a 4 vertex triangle strip to make a quad from the given point and calculates the UV texture coordinates based on the map tile passed it.   I have tested my code on two systems, both Win 7x64.  The problem occurs only on one machine, which has an NVIDIA Quadro NVS 295, and it has this problem using both 311.35 and 340.66 drivers.  The system that works has an NVIDIA GeForce 9400 GT with 311.06.   It's hard for me to describe the problem, so I've attached an image of what it should look like (screen-good.png) and a shot of the flickering when it occurs (screen-bad.png).  This flicker only happens for a frame and it's not always the same spot on the screen.  I'm not changing any values and I've tried to strip things down to the most basic code in an attempt to track down the problem.  As the screenshot shows, it's sometimes drawing the wrong tiles in the wrong place and not drawing certain areas.  My "map" is 100 tiles by 14 tiles, so it is drawing outside the viewport/screen.   As a side note, which may or may not be important, if I use "FragColor = vec4(1.0, 1.0, 1.0, 1.0);" as my fragment shader, the screen will be white as expected and no flickering will occur.   My render code:                 GL11.glClear(GL11.GL_COLOR_BUFFER_BIT); // Start the shader GL20.glUseProgram(this.shader.getProgramID()); GL20.glUniformMatrix4(this.shader.projectionMatrixLocation, false, DisplayHelper.screenProjectionMatrix); GL20.glUniform1i(this.shader.textureSamplerLocation, 0); // Set up the texture. GL13.glActiveTexture(GL13.GL_TEXTURE0); GL11.glBindTexture(GL11.GL_TEXTURE_2D, this.texture.textureID); // Set up the data buffer. GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, this.bufferHandle); GL15.glBufferData(GL15.GL_ARRAY_BUFFER, this.buffer, GL15.GL_STATIC_DRAW); // Set up the vertex attrib pointers. GL20.glEnableVertexAttribArray(0); GL20.glEnableVertexAttribArray(1); GL20.glVertexAttribPointer(0, 1, GL11.GL_FLOAT, false, TILE_CODE_STRIDE, TILE_CODE_OFFSET); GL20.glVertexAttribPointer(1, 2, GL11.GL_FLOAT, false, POSITION_STRIDE, POSITION_OFFSET); // Draw. GL11.glDrawArrays(GL11.GL_POINTS, 0, TILES_ON_SCREEN); // Clean up. GL20.glDisableVertexAttribArray(0); GL20.glDisableVertexAttribArray(1); GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, 0); GL11.glBindTexture(GL11.GL_TEXTURE_2D, 0); GL20.glUseProgram(0); My shader code. I have them all in one file and separate them by name using anything above the first name (#version 330 core) in all three. #version 330 core >> vertex << layout(location = 0) attribute in float TileCode; layout(location = 1) attribute in vec2 VertexPosition; const float TILE_DRAW_SIZE = 16.0; out int tile; void main() { tile = int(TileCode); gl_Position = vec4(VertexPosition, 0.0, 1.0); } >> geometry << layout(points) in; layout(triangle_strip, max_vertices=4) out; const int TILES_PER_TEXTURE_ROW = 16; const float TILE_DRAW_SIZE = 16.0; const float TEXTURE_SIZE = 256.0; uniform mat4 projectionMatrix; in int tile[]; out vec2 texCoord; void main() { int code = tile[0]; if (code == 0) { return; } // Set up the tile bound points. vec4 topLeft = gl_in[0].gl_Position; topLeft.x = topLeft.x * TILE_DRAW_SIZE; topLeft.y = topLeft.y * TILE_DRAW_SIZE; vec4 bottomRight = topLeft; bottomRight.x += TILE_DRAW_SIZE; bottomRight.y += TILE_DRAW_SIZE; // Calculate tile texture coordinates. int cx = code % TILES_PER_TEXTURE_ROW; int cy = code / TILES_PER_TEXTURE_ROW; float tx = (float(cx) * TILE_DRAW_SIZE) / TEXTURE_SIZE; float ty = (float(cy) * TILE_DRAW_SIZE) / TEXTURE_SIZE; float tx2 = (float(cx + 1) * TILE_DRAW_SIZE) / TEXTURE_SIZE; float ty2 = (float(cy + 1) * TILE_DRAW_SIZE) / TEXTURE_SIZE; // Top left. gl_Position = projectionMatrix * vec4(topLeft.x, topLeft.y, 0.0, 1.0); texCoord = vec2(tx, ty); EmitVertex(); // Top right. gl_Position = projectionMatrix * vec4(bottomRight.x, topLeft.y, 0.0, 1.0); texCoord = vec2(tx2, ty); EmitVertex(); // Bottom left. gl_Position = projectionMatrix * vec4(topLeft.x, bottomRight.y, 0.0, 1.0); texCoord = vec2(tx, ty2); EmitVertex(); // Bottom right. gl_Position = projectionMatrix * vec4(bottomRight.x, bottomRight.y, 0.0, 1.0); texCoord = vec2(tx2, ty2); EmitVertex(); EndPrimitive(); } >> fragment << layout(location = 0) out vec4 FragColor; uniform sampler2D Texture0; in vec2 texCoord; void main() { // FragColor = vec4(1.0, 1.0, 1.0, 1.0); FragColor = texture2D(Texture0, texCoord); } Am I missing something that might be causing things to fail on one card, but not the other? If I need to post more code, let me know.  I posted what I thought would be most relavent.   Thanks for any help!
  6. adambiser

    AppGameKit for Python

    Album for AppGameKit for Python
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!