Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 26 Nov 2012
Offline Last Active Jul 02 2014 10:11 PM

Topics I've Started

Gl Bind Texture is taking over my program X(!

30 April 2014 - 09:35 PM

Hello, I am having a VERY strange problem with openGL recently.


To get to the point, I am trying to render objects with textures, and without textures. But for some reason, whenever I render an object with no texture, it ends up appearing black, even though I am using a pixel shader that outputs a red color, for example.

Psoudo code:

Bind Program...
Bind texture...
Bind Vertex Array...
Render textured object, done!

Bind texture(texture_2d, 0) // default texture

Bind Program...
Bind Vertex Array...
Render NON-Textured Object, da fek?? Why is it black!???

It seems like whenever I still use the last texture without setting it to 0, the shader uses one of the colors from the texture to color my non-textured object, even though the shader doesn't accept a texture for input... -.-


Here's a picture of what is happening:



These are what my color shaders look like:

        public string vertexColorShaderText = @"
#version 130

in vec3 in_Position;

out vec3 out_color;

uniform mat4 worldMatrix;
uniform mat4 viewMatrix;
uniform mat4 projectionMatrix;

void main(void)
    gl_Position = worldMatrix * vec4(in_Position, 1.0f);
	gl_Position = viewMatrix * gl_Position;
	gl_Position = projectionMatrix * gl_Position;

        public string pixelColorShaderText = @"
#version 130

out vec4 last_color;

void main(void)
    vec4 derp_color;
    derp_color.r = 1.0;
    derp_color.g = 0.0;
    derp_color.b = 0.0;
    derp_color.a = 1.0;
    last_color = derp_color;

I just don't understand. Is there something I am supposed to be doing here???

c# assigning new int to void*?

29 April 2014 - 08:32 PM

Hello, I am currently developing a level editor, and I am having some problems.


Firstly, I want to create different game objects to use in my level editor and, assign them arbitrary variables loaded from a file. I tried using a void* for this.


However, the variable that was of type int, I tried to assign to the void* did not seem to work, I tried looking up online on how to add a new int to a void*, but found no results :(

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace WindowsFormsApplication1
    class ObjectVariable
        public ObjectVariable(uint a, string b, string c, string d)
            variableType = a;
            variableName = b;

            switch (a)
                //Can't do this :(.
                case 0: variableValue = new int(System.Convert.ToInt32(c));
            variableDescription = c;
        public uint variableType;
        public string variableName;
        public void* variableValue;
        public string variableDescription;

So, How do I assign a new int to a void*?

Removing Large number of objects from vector immediately.

17 March 2014 - 11:54 AM

Hello, I've been experimenting with STD::Vector, And I've been trying to find the most efficient way to delete a large number of items from an Std::Vector, In the fastest way possible.


This Is the program I have been writing:


#include <memory>
#include <vector>

using namespace std;

struct SmallObject1
int a[256];

int main()
char a;
typedef vector<shared_ptr<SmallObject1>> ObjectList;
ObjectList * list1 = new ObjectList();
cout << "Allocate 65536, objects Lol!" << "\n";

for(unsigned int i = 0; i < 65536; i++)
SmallObject1 * smallObject1 = new SmallObject1;
shared_ptr<SmallObject1> a(smallObject1);

cout << "Allocated! Try Again?" << "\n";
/*while(list1.size() != 0)
delete list1;
list1 = new ObjectList;
cout << "Deleted....";

for(unsigned int i = 0; i < 65536; i++)
SmallObject1 * smallObject1 = new SmallObject1;
shared_ptr<SmallObject1> a(smallObject1);

cout << "COMPLETE!!!1!!!";

return 0;


If I were Writing a video game, and I was transitioning to another level, I Would want to remove the objects for Level 1 from the list as Fast As Possible. However, All the methods I've tried seemed to result into waiting a couple of seconds for the objects to be deleted.


I'm thinking of removing all the objects on a separate thread, And allocating the New objects on the main thread, in a Separate list, and then after the objects are removed, then append the list to the main list. But I'm not sure if it will work, and I know next to nothing about Multi-Threading :( .


Anyways, I was wondering if anyone has any alternative solutions to this dillema, as I can't seem to find a faster method.


What counts as "Code Plagiarism"?

23 February 2014 - 02:43 PM

Hello, I have been learning game development and programming in C++ with OpenGL for about a year and a half, and one of the things i've always worried about is whether or not I might end up "plagiarising" while programming. Sure, I haven't released anything yet, and probably won't for YEARS, but i've always been worried about whether or not I could end up "accidentally" plagiarising.


I mean I'm, let me put it this way. My conscience, is pretty much existent, to put it plainley, and I most Certainley do NOT want to create my ultimate "Dream Game", and live my life as a fraud telling everyone that I programmed the game all by myself, even if I plagearized without even knowing it.


like for example, I've decided to VOW to NEVER, EVER, Copy and Paste code. I never do it, unless it is my own, and in my own words. However, could it still be plagiarism regardless?


Like, lets give a silly example:


Lets say i'm using a Graphics API, and I forgot the name of the initialization function, and whether or not it is camel case or not.


I look up on the internet (Stack Overflow), and someone shows in an example that it is:

GEngine * gEngine = new GEngine();
EngineDesc engineDesc = new EngineDesc((*void)0, false, true, true, NULL);

What i will generally do is type the code out into my engine, and change the name to my own, as well as look at the function to see what it does exactly, but is this enough? I know it sounds like a silly question, I mean I might know what the first Line of code means, but what about the second one? I might not even know what the parameters are for, but i'll use the function anyways, and it will make the Graphics Engine work regardless. If I type it in and I don't know what it does (E.G. Don't research the whole function), would that count as plagiarism?


I know it sounds like i'm being REALLY overreactive about this, but I feel like this is really is a pressing issue for many programmers who may also struggle with this (irrational?)fear , and I don't want to fall into the trap of being the "programmer who says he made his own game engine, when he really just plagiarized many other peoples original code".

Fully Flexible Indirect Lighting... Is it even possible?

30 December 2013 - 02:35 PM

Hello, I just came about a very strange problem when researching Ambient lighting and skylight. If you have two different rooms with different indirect lighting, and you have a VERY long object existing in both rooms, how do you apply different ambient lighting to different sides of the object?

I recently did an experiment with Mario Kart 7, when I drove inbetween a cave and an outdoor lit area, and I noticed that the Player only gets illuminated by one of the ambient lights instead of 2. If the Player drives slowly into a cave, the ambient light interpolates Very quickly to the next ambient light, affecting the entire object.

I understand how people solve this problem with static objects, they just bake the ambient light, but how would one fully and dynamically calculate ambient light for objects at runtime?