Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (541)
Games in Android Showcase (133)
games submitted by our members
Games in WIP (603)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Strange stuff happening with OpenGL  (Read 549 times)
0 Members and 1 Guest are viewing this topic.
Offline trollwarrior1
« Posted 2013-11-14 21:16:09 »

Hi,

so basically what the problem is when I start my level, the first thing that I see are kinda random sprites for no reason. It happens only for a split second.

I tried to make a screenshot, but in that screen shot I couldn't see what I saw seeing on the screen. I thought I failed to make a screenshot, so I recorded everything. It didn't show up on the recording as well.

What might be causing this? I'm using VBO to render this. What might be causing this strange thing? I wanted to make a screenshot or something, but as stated above it doesn't really work like that Cheesy

I don't even know what to ask. Why would stuff be appearing on the screen and not on the Print Screen or recorded video?

EDIT_1:
It seems like tile sprites are being replaced by one of the animation sprites. It happens for 2 game ticks (60/s). I just don't get it. If I was swapping sprites by mistake or something it would show up on the screen i think. This is like an error with opengl or something.

EDIT_2:
I tried recording few more times using different frame rates. I managed to record the problem. My recorder probably wasn't catching the game once it was running at 60 fps. So now this is a problem with my rendering or something. That is a relief Tongue Now I can fix it somehow! Cheesy
This is how it looks like Cheesy

EDIT_3:
The problem occurs when I spawn zombies! Cheesy The problem only lasts one frame.
EDIT_4:
I could just spawn 1 zombie behind the scenes before the game even starts rendering, but that wouldn't really solve the problem. This is just kinda strange.
EDIT_5:
My Zombie class has static SpriteSheet which is just an opengl texture basically. It isn't used anywhere. I think the problem is with texture binding. When I create 1st zombie, static texture get created, therefore binding itself to opengl. I still need to confirm this, but problem is probably with texture binding. My Tile sprite seems to be rendering at the same coordinates but from the other texture.
EDIT_6:
Yeap the problem is with binding. I have this "abstract" kinda class for rendering called screen. When I render a sprite, I try to set current texture to that of sprite. If the texture is already the same, I don't do anything. If it is different, I have a reference to the last spritesheet I set. When I create textures, I don't use screen class to set textures at all, therefore breaking it. In the other words, this is just an error of binding textures properly.
Offline lcass
« Reply #1 - Posted 2013-11-14 22:32:33 »

Hmm are you adding anything to your game that might be drawn say a rogue render call in one of the constructors?
Offline opiop65

JGO Kernel


Medals: 161
Projects: 7
Exp: 4 years


JumpButton Studios


« Reply #2 - Posted 2013-11-15 01:17:18 »

Post some code. This isn't an OpenGL issue obviously, so why wouldn't you include code? This is a personal code issue, and no one can see your code unless you share it.

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Online SHC
« Reply #3 - Posted 2013-11-15 01:48:52 »

It seems to me that you are rendering and logic at the same time with two threads.

Offline trollwarrior1
« Reply #4 - Posted 2013-11-15 06:00:36 »

This is pretty big code. Would be messy if I started posting. + you wouldn't even want to look at it. As I posted in the thread, this happens when I spawn first zombie. Obviously this has to do something with initializing static sprites or something.
Offline trollwarrior1
« Reply #5 - Posted 2013-11-15 06:12:02 »

This line in my texture class fixed everything! Cheesy

1  
if(Screen.currentSpriteSheet != null) Screen.currentSpriteSheet.bind();
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

Mr.CodeIt (10 views)
2014-12-27 04:03:04

TheDudeFromCI (14 views)
2014-12-27 02:14:49

Mr.CodeIt (25 views)
2014-12-23 03:34:11

rwatson462 (56 views)
2014-12-15 09:26:44

Mr.CodeIt (46 views)
2014-12-14 19:50:38

BurntPizza (92 views)
2014-12-09 22:41:13

BurntPizza (113 views)
2014-12-08 04:46:31

JscottyBieshaar (86 views)
2014-12-05 12:39:02

SHC (96 views)
2014-12-03 16:27:13

CopyableCougar4 (102 views)
2014-11-29 21:32:03
Resources for WIP games
by kpars
2014-12-18 10:26:14

Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!