🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

SOIL

Started by
23 comments, last by JTippetts 4 years, 10 months ago

can I please get some help on my texturing problem, I  have also googled my  problem but with no success.

Advertisement

here is my updated code I don't why it does not work, it looks like it should work.


#include <freeglut.h>
#include <iostream>
#include<SOIL.h>

using namespace std;

GLuint textureBrick; 

GLuint loadTex(const char* texname)                                    
{
	/* load an image file directly as a new OpenGL texture */
	GLuint texture = SOIL_load_OGL_texture
	(
		texname,
		SOIL_LOAD_AUTO,
		SOIL_CREATE_NEW_ID,
		SOIL_FLAG_INVERT_Y
	);
	return texture;
}

void init()
{
	textureBrick = loadTex("C:\\Users\\Owner\\Desktop\\img.bmp");
}

void renderScene(void)
{
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
	glPushMatrix();
	glBindTexture(GL_TEXTURE_2D, textureBrick);
	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR_MIPMAP_LINEAR);
	glBegin(GL_QUADS);
	glTexCoord2i(1, 1);
	glVertex2i(10, 10);
	glTexCoord2i(1, 0);
	glVertex2i(10, -10);
	glTexCoord2i(0, 0);
	glVertex2i(-10, -10);
	glTexCoord2i(0, 1);
	glVertex2i(-10, 10);
	glEnd();
	glPopMatrix();
	glutSwapBuffers();
}

void ChangeSize(GLsizei w, GLsizei h)
{
	GLfloat aspectRatio;
	if (h == 0)
		h = 1;
	glViewport(0, 0, w, h);
	glMatrixMode(GL_PROJECTION);
	glLoadIdentity();
	aspectRatio = (GLfloat)w / (GLfloat)h;
	if (w <= h)
		glOrtho(-100.0, 100.0, -100.0 / aspectRatio, 100.0 / aspectRatio, 1.0, -1.0);
	else
		glOrtho(-100.0*aspectRatio, 100.0*aspectRatio, -100.0, 100.0, 1.0, -1.0);
	glMatrixMode(GL_MODELVIEW);
	glLoadIdentity();
}


int main(int argc, char **argv)
{
	glutInit(&argc, argv);
	glutInitDisplayMode(GLUT_DEPTH | GLUT_DOUBLE | GLUT_RGBA);
	glutInitWindowPosition(400, 300);
	glutInitWindowSize(800, 600);
	glutCreateWindow("Combat");
	glutDisplayFunc(renderScene);
	glutReshapeFunc(ChangeSize);
	init();
	glutMainLoop();
	return 0;
}

 

24 minutes ago, phil67rpg said:

here is my updated code I don't why it does not work, it looks like it should work.

You have posted 5 times in this thread stating a problem but have not asked a single question. This is after many requests (even mods) that you stop doing that. For YEARS.

You post code and expect others to figure it out but if someone gives too much code you say "I want to figure it out myself".

You do projects in winforms, console, OpenGL, DirectX, different languages and you say that you complete games, but never give links or proof to your finished projects.

You have a resume that states you are in no less words a certified professional with years of experience and hold a Bachelor of Science Degree in Computer Science. You have an Associates in electronics. You have certifications in CompTIA Network+, A+, MCTS (in-progress). Your list of experience includes Assembly Language. You have lead teams of students in game development.

You even state on your resume; "Resourceful problem solver with excellent troubleshooting skills; strong follow-through abilities to ensure projects to successful conclusion "

Yet from your last thread, you don't have a firm grasp on how simple Booleans work. This and you have an electronics degree?

Who are you BS'ing? Is your resume bogus and a complete sham or ???

*BS'ing means bullshitting since from my past experience you play dumb on common jargon / can't be bothered to use Google.

 

🙂🙂🙂🙂🙂<←The tone posse, ready for action.

20 hours ago, fleabay said:

can't be bothered to use Google

I have used google  but with no success, my question is how do I use texturing to draw sprites to the screen, I want to  use either .png or .bmp file formats.

1 hour ago, phil67rpg said:

I have used google  but with no success, my question is how do I use texturing to draw sprites to the screen, I want to  use either .png or .bmp file formats.

How come you have OpenGL listed on your resume as an API you know if you don't know it?
 

🙂🙂🙂🙂🙂<←The tone posse, ready for action.

can I please get some help on my question not just a critique on my resume by the way I am going to stop looking for a computer programming jobs I am going to do programming just for fun.

42 minutes ago, phil67rpg said:

can I please get some help on my question not just a critique on my resume

I am not critiquing your resume. You are not who you say you are. You don't write like you have a Bachelors degree. Maybe you have been trolling this site for years now. Or maybe you lied on your resume. It's one or the other.

If your resume is factual then I doubt many people here are qualified to help you based on your higher education and skills acquired.

🙂🙂🙂🙂🙂<←The tone posse, ready for action.

Hello - The book "OpenGL - Build High Performance Graphics" has a section in the first chapter that goes over loading and displaying an image in OpenGL using SOIL (they also use FreeGlut like you do as an added bonus). Below is the source code for that section. I would look it over and see what they're doing differently and get some ideas from it.

https://github.com/PacktPublishing/OpenGL-Build-High-Performance-Graphics/blob/master/Module 1/Chapter01/ImageLoader/ImageLoader/main.cpp

 

well greenbaron do  you  have any input?

This topic is closed to new replies.

Advertisement